@telus-uds/components-web 2.6.0 → 2.8.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.
- package/CHANGELOG.md +36 -2
- package/component-docs.json +12 -10
- package/lib/Autocomplete/Autocomplete.js +6 -5
- package/lib/DatePicker/CalendarContainer.js +10 -25
- package/lib/DatePicker/DatePicker.js +104 -57
- package/lib/DatePicker/reactDatesCss.js +1 -1
- package/lib/ExpandCollapseMini/ExpandCollapseMini.js +3 -1
- package/lib/Footnote/Footnote.js +6 -2
- package/lib/Listbox/ListboxItem.js +3 -2
- package/lib/Listbox/ListboxOverlay.js +3 -1
- package/lib/NavigationBar/NavigationItem.js +5 -4
- package/lib/StoryCard/StoryCard.js +3 -6
- package/lib/Table/Table.js +1 -1
- package/lib/WebPortal/WebPortal.js +46 -0
- package/lib/WebPortal/index.js +13 -0
- package/lib/WebVideo/WebVideo.js +1 -1
- package/lib/baseExports.js +6 -0
- package/lib/index.js +10 -1
- package/lib-module/Autocomplete/Autocomplete.js +6 -5
- package/lib-module/DatePicker/CalendarContainer.js +10 -25
- package/lib-module/DatePicker/DatePicker.js +103 -58
- package/lib-module/DatePicker/reactDatesCss.js +1 -1
- package/lib-module/ExpandCollapseMini/ExpandCollapseMini.js +3 -1
- package/lib-module/Footnote/Footnote.js +6 -2
- package/lib-module/Listbox/ListboxItem.js +3 -2
- package/lib-module/Listbox/ListboxOverlay.js +3 -2
- package/lib-module/NavigationBar/NavigationItem.js +6 -3
- package/lib-module/StoryCard/StoryCard.js +3 -6
- package/lib-module/Table/Table.js +1 -1
- package/lib-module/WebPortal/WebPortal.js +35 -0
- package/lib-module/WebPortal/index.js +2 -0
- package/lib-module/WebVideo/WebVideo.js +1 -1
- package/lib-module/baseExports.js +1 -1
- package/lib-module/index.js +1 -0
- package/package.json +5 -4
- package/src/Autocomplete/Autocomplete.jsx +3 -2
- package/src/DatePicker/CalendarContainer.jsx +10 -25
- package/src/DatePicker/DatePicker.jsx +99 -65
- package/src/DatePicker/reactDatesCss.js +4 -67
- package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +1 -1
- package/src/Footnote/Footnote.jsx +6 -2
- package/src/Listbox/ListboxItem.jsx +3 -2
- package/src/Listbox/ListboxOverlay.jsx +4 -3
- package/src/NavigationBar/NavigationItem.jsx +5 -3
- package/src/StoryCard/StoryCard.jsx +3 -7
- package/src/Table/Table.jsx +1 -1
- package/src/WebPortal/WebPortal.jsx +36 -0
- package/src/WebPortal/index.js +3 -0
- package/src/WebVideo/WebVideo.jsx +1 -1
- package/src/baseExports.js +2 -1
- package/src/index.js +1 -0
- package/types/WebVideo.d.ts +2 -2
|
@@ -120,8 +120,7 @@ const StoryCard = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
|
120
120
|
},
|
|
121
121
|
children: [Boolean(tag) && /*#__PURE__*/_jsx(Typography, {
|
|
122
122
|
variant: {
|
|
123
|
-
size: 'eyebrow'
|
|
124
|
-
colour: 'secondary'
|
|
123
|
+
size: 'eyebrow'
|
|
125
124
|
},
|
|
126
125
|
children: tag
|
|
127
126
|
}), Boolean(date) &&
|
|
@@ -130,8 +129,7 @@ const StoryCard = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
|
130
129
|
// Get locale based on decision of https://github.com/telus/universal-design-system/issues/715
|
|
131
130
|
_jsx(Typography, {
|
|
132
131
|
variant: {
|
|
133
|
-
size: 'small'
|
|
134
|
-
colour: 'secondary'
|
|
132
|
+
size: 'small'
|
|
135
133
|
},
|
|
136
134
|
children: date
|
|
137
135
|
})]
|
|
@@ -145,8 +143,7 @@ const StoryCard = /*#__PURE__*/forwardRef((_ref3, ref) => {
|
|
|
145
143
|
space: 3
|
|
146
144
|
}), /*#__PURE__*/_jsx(Typography, {
|
|
147
145
|
variant: {
|
|
148
|
-
size: 'h3'
|
|
149
|
-
colour: 'secondary'
|
|
146
|
+
size: 'h3'
|
|
150
147
|
},
|
|
151
148
|
children: title
|
|
152
149
|
}), /*#__PURE__*/_jsx(Spacer, {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom';
|
|
3
|
+
/**
|
|
4
|
+
* WebPortal component renders its children in a separate portal container appended to the document body.
|
|
5
|
+
*
|
|
6
|
+
* While `@gorhom/portal` works well for a lot of use-cases, there are some issues with it, particularly around
|
|
7
|
+
* reading context values (see issues below). For web-only components, it is safe to replace `Portal` from `@gorhom/portal`
|
|
8
|
+
* to `WebPortal` to solve such issues
|
|
9
|
+
*
|
|
10
|
+
* https://github.com/gorhom/react-native-portal/issues/34
|
|
11
|
+
* https://github.com/gorhom/react-native-portal/issues/2
|
|
12
|
+
* https://github.com/gorhom/react-native-portal/issues/3
|
|
13
|
+
* https://github.com/gorhom/react-native-portal/issues/31
|
|
14
|
+
*
|
|
15
|
+
* @component
|
|
16
|
+
* @param {object} props - The component props.
|
|
17
|
+
* @param {React.ReactNode} props.children - The content to render within the portal.
|
|
18
|
+
* @returns {React.ReactPortal} The React portal component.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const WebPortal = _ref => {
|
|
22
|
+
let {
|
|
23
|
+
children
|
|
24
|
+
} = _ref;
|
|
25
|
+
const portalContainer = document.createElement('div');
|
|
26
|
+
useEffect(() => {
|
|
27
|
+
document.body.appendChild(portalContainer);
|
|
28
|
+
return () => {
|
|
29
|
+
document.body.removeChild(portalContainer);
|
|
30
|
+
};
|
|
31
|
+
}, [portalContainer]);
|
|
32
|
+
return /*#__PURE__*/ReactDOM.createPortal(children, portalContainer);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default WebPortal;
|
|
@@ -133,7 +133,7 @@ export const VideoProps = { ...selectedSystemPropTypes,
|
|
|
133
133
|
/**
|
|
134
134
|
* The splash screen UI's language as an ISO language code. It currently supports English and French.
|
|
135
135
|
*/
|
|
136
|
-
copy: PropTypes.oneOf(['en', 'fr'])
|
|
136
|
+
copy: PropTypes.oneOf(['en', 'fr']),
|
|
137
137
|
|
|
138
138
|
/**
|
|
139
139
|
* A function to be run when the play button is pressed on the video splash screen and the video is ready to play.
|
|
@@ -12,4 +12,4 @@ A11yText, ActivityIndicator, Box, Button, BaseProvider, A11yInfoProvider, Viewpo
|
|
|
12
12
|
*/
|
|
13
13
|
// Enable access to the viewports system for app-specific responsive layouts and features
|
|
14
14
|
useResponsiveProp, useViewport, // TODO reenable ViewportContext once published from base // enable localised viewport overrides e.g. in tests, narrow columns, etc
|
|
15
|
-
useCarousel } from '@telus-uds/components-base';
|
|
15
|
+
useCarousel, useSetTheme } from '@telus-uds/components-base';
|
package/lib-module/index.js
CHANGED
|
@@ -37,5 +37,6 @@ export { default as TermsAndConditions } from './TermsAndConditions';
|
|
|
37
37
|
export { default as NavigationBar } from './NavigationBar';
|
|
38
38
|
export { default as Progress } from './Progress';
|
|
39
39
|
export { default as SkeletonProvider } from './SkeletonProvider';
|
|
40
|
+
export { default as WebPortal } from './WebPortal';
|
|
40
41
|
export { ssrStyles } from './utils';
|
|
41
42
|
export * from './baseExports';
|
package/package.json
CHANGED
|
@@ -5,17 +5,18 @@
|
|
|
5
5
|
],
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"@gorhom/portal": "^1.0.14",
|
|
8
|
-
"@telus-uds/components-base": "1.
|
|
8
|
+
"@telus-uds/components-base": "1.50.0",
|
|
9
9
|
"@telus-uds/system-constants": "^1.2.1",
|
|
10
10
|
"fscreen": "^1.2.0",
|
|
11
11
|
"lodash.omit": "^4.5.0",
|
|
12
12
|
"react-dates": "^21.8.0",
|
|
13
13
|
"react-helmet-async": "^1.3.0",
|
|
14
14
|
"react-moment-proptypes": "^1.8.1",
|
|
15
|
-
"@telus-uds/system-theme-tokens": "^2.
|
|
15
|
+
"@telus-uds/system-theme-tokens": "^2.32.0",
|
|
16
16
|
"prop-types": "^15.7.2",
|
|
17
17
|
"lodash.throttle": "^4.1.1",
|
|
18
|
-
"react-youtube": "^10.1.0"
|
|
18
|
+
"react-youtube": "^10.1.0",
|
|
19
|
+
"moment": "2.29.4"
|
|
19
20
|
},
|
|
20
21
|
"description": "UDS mult-brand web components",
|
|
21
22
|
"devDependencies": {
|
|
@@ -62,5 +63,5 @@
|
|
|
62
63
|
"skip": true
|
|
63
64
|
},
|
|
64
65
|
"types": "types/index.d.ts",
|
|
65
|
-
"version": "2.
|
|
66
|
+
"version": "2.8.0"
|
|
66
67
|
}
|
|
@@ -32,8 +32,6 @@ const [selectProps, selectedSystemPropTypes] = selectSystemProps([
|
|
|
32
32
|
textInputProps
|
|
33
33
|
])
|
|
34
34
|
|
|
35
|
-
const inputTokens = { paddingLeft: INPUT_LEFT_PADDING }
|
|
36
|
-
|
|
37
35
|
// Returns JSX to display a bold string `str` with unbolded occurrences of the
|
|
38
36
|
// `substring` based in the array of `matchIndexes` provided
|
|
39
37
|
const highlightAllMatches = (str, substring = '', matchIndexes = []) => (
|
|
@@ -104,6 +102,8 @@ const Autocomplete = forwardRef(
|
|
|
104
102
|
// We need to store the current value as well to be able to highlight it
|
|
105
103
|
const [currentValue, setCurrentValue] = useState(value ?? initialValue)
|
|
106
104
|
|
|
105
|
+
const inputTokens = { paddingLeft: INPUT_LEFT_PADDING }
|
|
106
|
+
|
|
107
107
|
// Setting up the overlay
|
|
108
108
|
const openOverlayRef = useRef()
|
|
109
109
|
const [isExpanded, setIsExpanded] = useState((value ?? initialValue)?.length >= minToSuggestion)
|
|
@@ -229,6 +229,7 @@ const Autocomplete = forwardRef(
|
|
|
229
229
|
readOnly={readOnly}
|
|
230
230
|
ref={inputRef}
|
|
231
231
|
tokens={inputTokens}
|
|
232
|
+
validation={validation}
|
|
232
233
|
{...selectedProps}
|
|
233
234
|
{...props}
|
|
234
235
|
{...(isControlled ? { value } : { initialValue })}
|
|
@@ -7,7 +7,6 @@ import defaultReactDatesCss from './reactDatesCss'
|
|
|
7
7
|
const CalendarContainer = styled.div(
|
|
8
8
|
({
|
|
9
9
|
daySize,
|
|
10
|
-
validation,
|
|
11
10
|
remainingTokens,
|
|
12
11
|
calendarMonthFontTokens,
|
|
13
12
|
calendarDayDefaultHeight,
|
|
@@ -35,31 +34,10 @@ const CalendarContainer = styled.div(
|
|
|
35
34
|
}
|
|
36
35
|
.DateInput {
|
|
37
36
|
width: 100%;
|
|
38
|
-
border: 2px solid ${remainingTokens.dateInputBorderColor};
|
|
39
|
-
${validation === 'error' && `input { border-color: ${remainingTokens.invalidInputMixin}; }`};
|
|
40
|
-
${validation === 'success' && `input { border-color: ${remainingTokens.validInputMixin}; }`};
|
|
41
|
-
}
|
|
42
|
-
.DateInput:hover {
|
|
43
|
-
border-radius: ${remainingTokens.dateInputBorderRadius}px;
|
|
44
|
-
border: 2px solid ${remainingTokens.dateInputHoverBorderColor};
|
|
45
|
-
}
|
|
46
|
-
.DateInput_input:focus {
|
|
47
|
-
border: 3px solid ${remainingTokens.dateInputFocusBorderColor};
|
|
48
37
|
}
|
|
49
38
|
.SingleDatePickerInput__withBorder {
|
|
50
39
|
border: 0 !important;
|
|
51
40
|
}
|
|
52
|
-
.DateInput_input {
|
|
53
|
-
box-sizing: border-box;
|
|
54
|
-
padding: 1rem;
|
|
55
|
-
border: 1px solid ${remainingTokens.dateInputInsideBorderColor};
|
|
56
|
-
border-radius: 4px;
|
|
57
|
-
min-height: 3.25rem;
|
|
58
|
-
color: ${remainingTokens.dateInputInsideColor};
|
|
59
|
-
font-weight: 400;
|
|
60
|
-
font-size: 1rem;
|
|
61
|
-
box-shadow: 0 1px 8px rgba(0, 0, 0, 0.05);
|
|
62
|
-
}
|
|
63
41
|
.DateInput_fang {
|
|
64
42
|
transform: translateY(2px);
|
|
65
43
|
z-index: 4;
|
|
@@ -166,10 +144,8 @@ const CalendarContainer = styled.div(
|
|
|
166
144
|
}
|
|
167
145
|
.CalendarDay__selected,
|
|
168
146
|
.CalendarDay__selected:active,
|
|
169
|
-
.CalendarDay__selected:hover
|
|
170
147
|
.CalendarDay__default.CalendarDay__selected,
|
|
171
|
-
.CalendarDay__default.CalendarDay__selected:active
|
|
172
|
-
.CalendarDay__default.CalendarDay__selected:hover{
|
|
148
|
+
.CalendarDay__default.CalendarDay__selected:active{
|
|
173
149
|
background: ${remainingTokens.calendarDayDefaultCalendarDaySelectedHoverBackground};
|
|
174
150
|
border: 1px solid ${remainingTokens.calendarDaySelectedHoverBorderColor};
|
|
175
151
|
color: ${remainingTokens.calendarDayDefaultCalendarDaySelectedHoverColor};
|
|
@@ -179,6 +155,15 @@ const CalendarContainer = styled.div(
|
|
|
179
155
|
background: ${remainingTokens.calendarDayDefaultCalendarDaySelectedHoverBeforeBackground};
|
|
180
156
|
}
|
|
181
157
|
}
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
.CalendarDay__selected:hover
|
|
161
|
+
.CalendarDay__default.CalendarDay__selected:hover{
|
|
162
|
+
&:before {
|
|
163
|
+
background: ${remainingTokens.calendarDayDefaultCalendarDaySelectedHoverBeforeBackground};
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
182
167
|
.CalendarDay__blocked_out_of_range,
|
|
183
168
|
.CalendarDay__blocked_out_of_range:active,
|
|
184
169
|
.CalendarDay__blocked_out_of_range:hover,
|
|
@@ -7,19 +7,21 @@ import SingleDatePicker from 'react-dates/lib/components/SingleDatePicker'
|
|
|
7
7
|
import DayPickerSingleDateController from 'react-dates/lib/components/DayPickerSingleDateController'
|
|
8
8
|
import {
|
|
9
9
|
IconButton,
|
|
10
|
-
|
|
10
|
+
TextInput,
|
|
11
11
|
selectSystemProps,
|
|
12
12
|
useCopy,
|
|
13
13
|
useViewport,
|
|
14
14
|
useThemeTokens,
|
|
15
15
|
applyTextStyles
|
|
16
16
|
} from '@telus-uds/components-base'
|
|
17
|
+
import moment from 'moment'
|
|
17
18
|
import CalendarContainer from './CalendarContainer'
|
|
18
19
|
import dictionary from './dictionary'
|
|
19
20
|
import { htmlAttrs } from '../utils'
|
|
20
21
|
|
|
21
22
|
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs])
|
|
22
|
-
|
|
23
|
+
const dateFormat = 'DD / MM / YYYY'
|
|
24
|
+
const dateFormatWithoutSpaces = 'DD/MM/YYYY'
|
|
23
25
|
const getResponsiveDaySize = (inline = false, viewport = 'md') => {
|
|
24
26
|
let responsiveDaySize
|
|
25
27
|
if (viewport === 'xs') {
|
|
@@ -46,6 +48,11 @@ const MonthCenterContainer = styled.div({
|
|
|
46
48
|
justifyContent: 'center'
|
|
47
49
|
})
|
|
48
50
|
|
|
51
|
+
const DateInputWrapper = styled.div({
|
|
52
|
+
display: 'flex',
|
|
53
|
+
flexDirection: 'column'
|
|
54
|
+
})
|
|
55
|
+
|
|
49
56
|
/**
|
|
50
57
|
* Use DatePicker to select a date on a calendar.
|
|
51
58
|
*
|
|
@@ -90,15 +97,40 @@ const DatePicker = forwardRef(
|
|
|
90
97
|
) => {
|
|
91
98
|
const [inputDate, setInputDate] = useState(date)
|
|
92
99
|
const [isFocused, setIsFocused] = useState(false)
|
|
93
|
-
|
|
100
|
+
const [inputText, setInputText] = useState(moment(date, dateFormat, true).isValid() ? date : '')
|
|
101
|
+
const [isClickedInside, setIsClickedInside] = useState(false)
|
|
94
102
|
const getCopy = useCopy({ dictionary, copy })
|
|
95
103
|
const onFocusChange = ({ focused }) => {
|
|
96
|
-
|
|
104
|
+
if (!isClickedInside) {
|
|
105
|
+
setIsFocused(focused)
|
|
106
|
+
}
|
|
107
|
+
setIsClickedInside(false)
|
|
108
|
+
}
|
|
109
|
+
const handleFocus = () => {
|
|
110
|
+
setIsFocused(true)
|
|
111
|
+
}
|
|
112
|
+
const handleMouseDown = (event) => {
|
|
113
|
+
if (event.target.tagName === 'INPUT') {
|
|
114
|
+
setIsClickedInside(true)
|
|
115
|
+
setIsFocused(true)
|
|
116
|
+
} else {
|
|
117
|
+
event.stopPropagation()
|
|
118
|
+
}
|
|
97
119
|
}
|
|
98
120
|
const onChange = (value) => {
|
|
99
121
|
setInputDate(value)
|
|
122
|
+
setInputText(value.format(dateFormat))
|
|
100
123
|
if (onDateChange) onDateChange(value)
|
|
101
124
|
}
|
|
125
|
+
const onChangeInput = (value) => {
|
|
126
|
+
if (moment(value.replace(/\s/g, ''), dateFormatWithoutSpaces, true).isValid()) {
|
|
127
|
+
setInputDate(moment(value, dateFormat))
|
|
128
|
+
if (onDateChange) onDateChange(moment(value, dateFormat))
|
|
129
|
+
setInputText(moment(value, dateFormatWithoutSpaces).format(dateFormat))
|
|
130
|
+
} else {
|
|
131
|
+
setInputText(value)
|
|
132
|
+
}
|
|
133
|
+
}
|
|
102
134
|
const viewport = useViewport()
|
|
103
135
|
const daySize = getResponsiveDaySize(inline, viewport)
|
|
104
136
|
const circleSize = getResponsiveCircleSize(inline, viewport)
|
|
@@ -164,76 +196,33 @@ const DatePicker = forwardRef(
|
|
|
164
196
|
calendarWeekFontTokens={calendarWeekFontTokens}
|
|
165
197
|
defaultFontTokens={defaultFontTokens}
|
|
166
198
|
>
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
<HiddenInputFieldContainer
|
|
180
|
-
height={hiddenInputFieldContainerHeight}
|
|
181
|
-
width={hiddenInputFieldContainerWidth}
|
|
182
|
-
>
|
|
183
|
-
<input
|
|
184
|
-
ref={ref}
|
|
185
|
-
id={id}
|
|
186
|
-
type="text"
|
|
187
|
-
value={value?.format('YYYY-MM-DD') ?? ''}
|
|
188
|
-
readOnly
|
|
189
|
-
/>
|
|
190
|
-
</HiddenInputFieldContainer>
|
|
191
|
-
<DayPickerSingleDateController
|
|
192
|
-
date={value}
|
|
193
|
-
onDateChange={onChange}
|
|
194
|
-
focused={isFocused}
|
|
195
|
-
onFocusChange={onFocusChange}
|
|
196
|
-
numberOfMonths={1}
|
|
197
|
-
hideKeyboardShortcutsPanel={true}
|
|
198
|
-
keepOpenOnDateSelect={false}
|
|
199
|
-
daySize={daySize}
|
|
200
|
-
renderNavPrevButton={renderPrevButton}
|
|
201
|
-
renderNavNextButton={renderNextButton}
|
|
202
|
-
isOutsideRange={isDayDisabled}
|
|
203
|
-
phrases={getCopy()}
|
|
204
|
-
renderMonthElement={({ month }) => (
|
|
205
|
-
<MonthCenterContainer>
|
|
206
|
-
<div>
|
|
207
|
-
{dictionary[copy]
|
|
208
|
-
? dictionary[copy].months[month.month()]
|
|
209
|
-
: month.format('MMMM')}{' '}
|
|
210
|
-
{month.year()}
|
|
211
|
-
</div>
|
|
212
|
-
</MonthCenterContainer>
|
|
213
|
-
)}
|
|
214
|
-
renderWeekHeaderElement={(day) => (
|
|
215
|
-
<div>{dictionary[copy] ? dictionary[copy].weekDays[day] : day}</div>
|
|
216
|
-
)}
|
|
199
|
+
{inline ? (
|
|
200
|
+
<>
|
|
201
|
+
<HiddenInputFieldContainer
|
|
202
|
+
height={hiddenInputFieldContainerHeight}
|
|
203
|
+
width={hiddenInputFieldContainerWidth}
|
|
204
|
+
>
|
|
205
|
+
<input
|
|
206
|
+
ref={ref}
|
|
207
|
+
id={id}
|
|
208
|
+
type="text"
|
|
209
|
+
value={value?.format('DD/MM/YYYY') ?? ''}
|
|
210
|
+
readOnly
|
|
217
211
|
/>
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
<SingleDatePicker
|
|
212
|
+
</HiddenInputFieldContainer>
|
|
213
|
+
<DayPickerSingleDateController
|
|
221
214
|
date={value}
|
|
222
215
|
onDateChange={onChange}
|
|
223
216
|
focused={isFocused}
|
|
224
217
|
onFocusChange={onFocusChange}
|
|
225
218
|
numberOfMonths={1}
|
|
226
219
|
hideKeyboardShortcutsPanel={true}
|
|
227
|
-
keepOpenOnDateSelect={
|
|
220
|
+
keepOpenOnDateSelect={false}
|
|
228
221
|
daySize={daySize}
|
|
229
|
-
ref={ref}
|
|
230
222
|
renderNavPrevButton={renderPrevButton}
|
|
223
|
+
renderNavNextButton={renderNextButton}
|
|
231
224
|
isOutsideRange={isDayDisabled}
|
|
232
225
|
phrases={getCopy()}
|
|
233
|
-
id={id}
|
|
234
|
-
displayFormat="DD / MM / YYYY"
|
|
235
|
-
placeholder="DD / MM / YYYY"
|
|
236
|
-
renderNavNextButton={renderNextButton}
|
|
237
226
|
renderMonthElement={({ month }) => (
|
|
238
227
|
<MonthCenterContainer>
|
|
239
228
|
<div>
|
|
@@ -248,8 +237,53 @@ const DatePicker = forwardRef(
|
|
|
248
237
|
<div>{dictionary[copy] ? dictionary[copy].weekDays[day] : day}</div>
|
|
249
238
|
)}
|
|
250
239
|
/>
|
|
251
|
-
|
|
252
|
-
|
|
240
|
+
</>
|
|
241
|
+
) : (
|
|
242
|
+
<DateInputWrapper onMouseDown={handleMouseDown} onFocus={handleFocus}>
|
|
243
|
+
<TextInput
|
|
244
|
+
copy={copy}
|
|
245
|
+
feedback={feedback}
|
|
246
|
+
hint={hint}
|
|
247
|
+
placeholder="DD / MM / YYYY"
|
|
248
|
+
onChange={onChangeInput}
|
|
249
|
+
tooltip={tooltip}
|
|
250
|
+
hintPosition={hintPosition}
|
|
251
|
+
label={dictionary[copy]?.roleDescription ?? label}
|
|
252
|
+
value={inputText}
|
|
253
|
+
validation={validation}
|
|
254
|
+
>
|
|
255
|
+
<SingleDatePicker
|
|
256
|
+
date={value}
|
|
257
|
+
onDateChange={onChange}
|
|
258
|
+
focused={isFocused}
|
|
259
|
+
onFocusChange={onFocusChange}
|
|
260
|
+
numberOfMonths={1}
|
|
261
|
+
hideKeyboardShortcutsPanel={true}
|
|
262
|
+
keepOpenOnDateSelect={true}
|
|
263
|
+
daySize={daySize}
|
|
264
|
+
ref={ref}
|
|
265
|
+
renderNavPrevButton={renderPrevButton}
|
|
266
|
+
isOutsideRange={isDayDisabled}
|
|
267
|
+
phrases={getCopy()}
|
|
268
|
+
id={id}
|
|
269
|
+
renderNavNextButton={renderNextButton}
|
|
270
|
+
renderMonthElement={({ month }) => (
|
|
271
|
+
<MonthCenterContainer>
|
|
272
|
+
<div>
|
|
273
|
+
{dictionary[copy]
|
|
274
|
+
? dictionary[copy].months[month.month()]
|
|
275
|
+
: month.format('MMMM')}{' '}
|
|
276
|
+
{month.year()}
|
|
277
|
+
</div>
|
|
278
|
+
</MonthCenterContainer>
|
|
279
|
+
)}
|
|
280
|
+
renderWeekHeaderElement={(day) => (
|
|
281
|
+
<div>{dictionary[copy] ? dictionary[copy].weekDays[day] : day}</div>
|
|
282
|
+
)}
|
|
283
|
+
/>
|
|
284
|
+
</TextInput>
|
|
285
|
+
</DateInputWrapper>
|
|
286
|
+
)}
|
|
253
287
|
</CalendarContainer>
|
|
254
288
|
)
|
|
255
289
|
}
|
|
@@ -31,13 +31,8 @@ const defaultReactDatesCss = css`
|
|
|
31
31
|
.SingleDatePickerInput {
|
|
32
32
|
display: inline-block;
|
|
33
33
|
background-color: #fff;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
border-radius: 2px;
|
|
37
|
-
border: 1px solid #dbdbdb;
|
|
38
|
-
}
|
|
39
|
-
.SingleDatePickerInput__rtl {
|
|
40
|
-
direction: rtl;
|
|
34
|
+
position: absolute;
|
|
35
|
+
top: -55px;
|
|
41
36
|
}
|
|
42
37
|
.SingleDatePickerInput__disabled {
|
|
43
38
|
background-color: #f2f2f2;
|
|
@@ -658,67 +653,8 @@ const defaultReactDatesCss = css`
|
|
|
658
653
|
left: 0;
|
|
659
654
|
overflow-y: scroll;
|
|
660
655
|
}
|
|
661
|
-
.DateInput {
|
|
662
|
-
margin: 0;
|
|
663
|
-
padding: 0;
|
|
664
|
-
background: #fff;
|
|
665
|
-
position: relative;
|
|
666
|
-
display: inline-block;
|
|
667
|
-
width: 130px;
|
|
668
|
-
vertical-align: middle;
|
|
669
|
-
}
|
|
670
|
-
.DateInput__small {
|
|
671
|
-
width: 97px;
|
|
672
|
-
}
|
|
673
|
-
.DateInput__block {
|
|
674
|
-
width: 100%;
|
|
675
|
-
}
|
|
676
|
-
.DateInput__disabled {
|
|
677
|
-
background: #f2f2f2;
|
|
678
|
-
color: #dbdbdb;
|
|
679
|
-
}
|
|
680
656
|
.DateInput_input {
|
|
681
|
-
|
|
682
|
-
font-size: 19px;
|
|
683
|
-
line-height: 24px;
|
|
684
|
-
color: #484848;
|
|
685
|
-
background-color: #fff;
|
|
686
|
-
width: 100%;
|
|
687
|
-
padding: 11px 11px 9px;
|
|
688
|
-
border: 0;
|
|
689
|
-
border-top: 0;
|
|
690
|
-
border-right: 0;
|
|
691
|
-
border-bottom: 2px solid transparent;
|
|
692
|
-
border-left: 0;
|
|
693
|
-
border-radius: 0;
|
|
694
|
-
}
|
|
695
|
-
.DateInput_input__small {
|
|
696
|
-
font-size: 15px;
|
|
697
|
-
line-height: 18px;
|
|
698
|
-
letter-spacing: 0.2px;
|
|
699
|
-
padding: 7px 7px 5px;
|
|
700
|
-
}
|
|
701
|
-
.DateInput_input__regular {
|
|
702
|
-
font-weight: auto;
|
|
703
|
-
}
|
|
704
|
-
.DateInput_input__readOnly {
|
|
705
|
-
-webkit-user-select: none;
|
|
706
|
-
-moz-user-select: none;
|
|
707
|
-
-ms-user-select: none;
|
|
708
|
-
user-select: none;
|
|
709
|
-
}
|
|
710
|
-
.DateInput_input__focused {
|
|
711
|
-
outline: 0;
|
|
712
|
-
background: #fff;
|
|
713
|
-
border: 0;
|
|
714
|
-
border-top: 0;
|
|
715
|
-
border-right: 0;
|
|
716
|
-
border-bottom: 2px solid #008489;
|
|
717
|
-
border-left: 0;
|
|
718
|
-
}
|
|
719
|
-
.DateInput_input__disabled {
|
|
720
|
-
background: #f2f2f2;
|
|
721
|
-
font-style: italic;
|
|
657
|
+
display: none;
|
|
722
658
|
}
|
|
723
659
|
.DateInput_screenReaderMessage {
|
|
724
660
|
border: 0;
|
|
@@ -732,6 +668,7 @@ const defaultReactDatesCss = css`
|
|
|
732
668
|
}
|
|
733
669
|
.DateInput_fang {
|
|
734
670
|
position: absolute;
|
|
671
|
+
top: 55px;
|
|
735
672
|
width: 20px;
|
|
736
673
|
height: 10px;
|
|
737
674
|
left: 22px;
|
|
@@ -20,7 +20,7 @@ const ExpandCollapseMini = forwardRef(({ children, onToggle, tokens, ...rest },
|
|
|
20
20
|
<ExpandCollapse.Panel
|
|
21
21
|
{...expandProps}
|
|
22
22
|
panelId="ExpandCollapseMiniPanel"
|
|
23
|
-
|
|
23
|
+
variant={{ mini: true }}
|
|
24
24
|
controlTokens={{ icon: null }}
|
|
25
25
|
// TODO refactor
|
|
26
26
|
// eslint-disable-next-line react/no-unstable-nested-components
|
|
@@ -271,6 +271,10 @@ const Footnote = (props) => {
|
|
|
271
271
|
// Listen for ESCAPE, close button clicks, and clicks outside of the Footnote. Call onClose.
|
|
272
272
|
const handleClose = useCallback(
|
|
273
273
|
(event) => {
|
|
274
|
+
if (!isVisible) {
|
|
275
|
+
return
|
|
276
|
+
}
|
|
277
|
+
|
|
274
278
|
if (event.type === 'keydown') {
|
|
275
279
|
if (event.key === 'Escape' || event.key === 27) {
|
|
276
280
|
closeFootnote(event, { returnFocus: true })
|
|
@@ -293,7 +297,7 @@ const Footnote = (props) => {
|
|
|
293
297
|
closeFootnote(event, { returnFocus: false })
|
|
294
298
|
}
|
|
295
299
|
},
|
|
296
|
-
[closeFootnote]
|
|
300
|
+
[closeFootnote, isVisible]
|
|
297
301
|
)
|
|
298
302
|
|
|
299
303
|
const saveCurrentHeight = () => {
|
|
@@ -365,7 +369,7 @@ const Footnote = (props) => {
|
|
|
365
369
|
}
|
|
366
370
|
return () => {
|
|
367
371
|
if (isOpen) {
|
|
368
|
-
document.
|
|
372
|
+
document.removeEventListener('mousedown', handleClose)
|
|
369
373
|
window.removeEventListener('click', handleClose)
|
|
370
374
|
window.removeEventListener('keydown', handleClose)
|
|
371
375
|
window.removeEventListener('touchstart', handleClose)
|
|
@@ -53,6 +53,8 @@ const ListboxItem = forwardRef(
|
|
|
53
53
|
prevItemRef,
|
|
54
54
|
tokens,
|
|
55
55
|
variant = {},
|
|
56
|
+
LinkRouter,
|
|
57
|
+
linkRouterProps,
|
|
56
58
|
...rest
|
|
57
59
|
},
|
|
58
60
|
ref
|
|
@@ -94,8 +96,7 @@ ListboxItem.propTypes = {
|
|
|
94
96
|
nextItemRef: PropTypes.object,
|
|
95
97
|
prevItemRef: PropTypes.object,
|
|
96
98
|
onPress: PropTypes.func,
|
|
97
|
-
selected: PropTypes.bool
|
|
98
|
-
reactRouterLinkComponent: PropTypes.oneOfType([PropTypes.func, PropTypes.object])
|
|
99
|
+
selected: PropTypes.bool
|
|
99
100
|
}
|
|
100
101
|
|
|
101
102
|
export default withLinkRouter(ListboxItem)
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/* eslint-disable react/require-default-props */
|
|
2
2
|
import React, { forwardRef } from 'react'
|
|
3
|
-
import { Card,
|
|
3
|
+
import { Card, useThemeTokens } from '@telus-uds/components-base'
|
|
4
4
|
import PropTypes from 'prop-types'
|
|
5
5
|
import { View, StyleSheet } from 'react-native-web'
|
|
6
|
+
import WebPortal from '../WebPortal'
|
|
6
7
|
|
|
7
8
|
const staticStyles = StyleSheet.create({
|
|
8
9
|
positioner: {
|
|
@@ -25,7 +26,7 @@ const DropdownOverlay = forwardRef(
|
|
|
25
26
|
const systemTokens = useThemeTokens('ListBox', {}, {})
|
|
26
27
|
|
|
27
28
|
return (
|
|
28
|
-
<
|
|
29
|
+
<WebPortal>
|
|
29
30
|
<View
|
|
30
31
|
ref={ref}
|
|
31
32
|
onLayout={onLayout}
|
|
@@ -48,7 +49,7 @@ const DropdownOverlay = forwardRef(
|
|
|
48
49
|
{children}
|
|
49
50
|
</Card>
|
|
50
51
|
</View>
|
|
51
|
-
</
|
|
52
|
+
</WebPortal>
|
|
52
53
|
)
|
|
53
54
|
}
|
|
54
55
|
)
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
selectSystemProps,
|
|
6
6
|
useResponsiveProp,
|
|
7
7
|
useViewport,
|
|
8
|
-
withLinkRouter,
|
|
9
8
|
useThemeTokensCallback
|
|
10
9
|
} from '@telus-uds/components-base'
|
|
11
10
|
import styled from 'styled-components'
|
|
@@ -41,6 +40,8 @@ const NavigationItem = forwardRef(
|
|
|
41
40
|
href,
|
|
42
41
|
tokens,
|
|
43
42
|
variant = {},
|
|
43
|
+
LinkRouter,
|
|
44
|
+
linkRouterProps,
|
|
44
45
|
...rest
|
|
45
46
|
},
|
|
46
47
|
ref
|
|
@@ -61,6 +62,8 @@ const NavigationItem = forwardRef(
|
|
|
61
62
|
tokens={getStateTokens}
|
|
62
63
|
variant={{ selected }}
|
|
63
64
|
href={href}
|
|
65
|
+
LinkRouter={LinkRouter}
|
|
66
|
+
linkRouterProps={linkRouterProps}
|
|
64
67
|
{...selectedProps}
|
|
65
68
|
>
|
|
66
69
|
{children}
|
|
@@ -73,11 +76,10 @@ NavigationItem.displayName = 'NavigationItem'
|
|
|
73
76
|
|
|
74
77
|
NavigationItem.propTypes = {
|
|
75
78
|
...selectedSystemPropTypes,
|
|
76
|
-
...withLinkRouter.propTypes,
|
|
77
79
|
onClick: PropTypes.func,
|
|
78
80
|
selected: PropTypes.bool,
|
|
79
81
|
children: PropTypes.oneOfType([PropTypes.string, PropTypes.func]).isRequired
|
|
80
82
|
}
|
|
81
83
|
NavigationItem.defaultProps = { onClick: () => {}, selected: false }
|
|
82
84
|
|
|
83
|
-
export default
|
|
85
|
+
export default NavigationItem
|