@telus-uds/components-web 1.3.0 → 1.5.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 +32 -2
- package/lib/Breadcrumbs/Breadcrumbs.js +247 -0
- package/lib/Breadcrumbs/Item/Item.js +165 -0
- package/lib/Breadcrumbs/index.js +15 -0
- package/lib/Callout/Callout.js +121 -0
- package/lib/Callout/index.js +13 -0
- package/lib/DatePicker/CalendarContainer.js +221 -0
- package/lib/DatePicker/DatePicker.js +329 -0
- package/lib/DatePicker/dictionary.js +134 -0
- package/lib/DatePicker/index.js +13 -0
- package/lib/DatePicker/reactDatesCss.js +12 -0
- package/lib/ExpandCollapseMini/ExpandCollapseMini.js +75 -0
- package/lib/ExpandCollapseMini/ExpandCollapseMiniControl.js +95 -0
- package/lib/ExpandCollapseMini/index.js +13 -0
- package/lib/Footnote/Footnote.js +571 -0
- package/lib/Footnote/FootnoteLink.js +149 -0
- package/lib/Footnote/dictionary.js +19 -0
- package/lib/Footnote/index.js +16 -0
- package/lib/Paragraph/Paragraph.js +107 -0
- package/lib/Paragraph/index.js +13 -0
- package/lib/PreviewCard/AuthorDate.js +64 -0
- package/lib/PreviewCard/PreviewCard.js +236 -0
- package/lib/PreviewCard/index.js +13 -0
- package/lib/PriceLockup/PriceLockup.js +237 -0
- package/lib/PriceLockup/index.js +13 -0
- package/lib/PriceLockup/tokens.js +131 -0
- package/lib/ResponsiveImage/ResponsiveImage.js +115 -0
- package/lib/ResponsiveImage/index.js +13 -0
- package/lib/Ribbon/Ribbon.js +0 -1
- package/lib/Span/Span.js +88 -0
- package/lib/Span/index.js +13 -0
- package/lib/index.js +91 -1
- package/lib/shared/FullBleedContent/FullBleedContent.js +121 -0
- package/lib/shared/FullBleedContent/getFullBleedBorderRadius.js +73 -0
- package/lib/shared/FullBleedContent/index.js +29 -0
- package/lib/shared/FullBleedContent/useFullBleedContentProps.js +73 -0
- package/lib/utils/index.js +32 -0
- package/lib/utils/logger.js +31 -0
- package/lib/utils/media.js +54 -0
- package/lib/utils/renderStructuredContent.js +89 -0
- package/lib/utils/useTypographyTheme.js +32 -0
- package/lib-module/Breadcrumbs/Breadcrumbs.js +228 -0
- package/lib-module/Breadcrumbs/Item/Item.js +141 -0
- package/lib-module/Breadcrumbs/index.js +1 -0
- package/lib-module/Callout/Callout.js +106 -0
- package/lib-module/Callout/index.js +2 -0
- package/lib-module/DatePicker/CalendarContainer.js +208 -0
- package/lib-module/DatePicker/DatePicker.js +302 -0
- package/lib-module/DatePicker/dictionary.js +127 -0
- package/lib-module/DatePicker/index.js +2 -0
- package/lib-module/DatePicker/reactDatesCss.js +3 -0
- package/lib-module/ExpandCollapseMini/ExpandCollapseMini.js +56 -0
- package/lib-module/ExpandCollapseMini/ExpandCollapseMiniControl.js +80 -0
- package/lib-module/ExpandCollapseMini/index.js +2 -0
- package/lib-module/Footnote/Footnote.js +541 -0
- package/lib-module/Footnote/FootnoteLink.js +130 -0
- package/lib-module/Footnote/dictionary.js +12 -0
- package/lib-module/Footnote/index.js +4 -0
- package/lib-module/Paragraph/Paragraph.js +89 -0
- package/lib-module/Paragraph/index.js +2 -0
- package/lib-module/PreviewCard/AuthorDate.js +53 -0
- package/lib-module/PreviewCard/PreviewCard.js +211 -0
- package/lib-module/PreviewCard/index.js +2 -0
- package/lib-module/PriceLockup/PriceLockup.js +213 -0
- package/lib-module/PriceLockup/index.js +2 -0
- package/lib-module/PriceLockup/tokens.js +120 -0
- package/lib-module/ResponsiveImage/ResponsiveImage.js +100 -0
- package/lib-module/ResponsiveImage/index.js +2 -0
- package/lib-module/Ribbon/Ribbon.js +1 -2
- package/lib-module/Span/Span.js +70 -0
- package/lib-module/Span/index.js +2 -0
- package/lib-module/index.js +10 -0
- package/lib-module/shared/FullBleedContent/FullBleedContent.js +106 -0
- package/lib-module/shared/FullBleedContent/getFullBleedBorderRadius.js +65 -0
- package/lib-module/shared/FullBleedContent/index.js +4 -0
- package/lib-module/shared/FullBleedContent/useFullBleedContentProps.js +65 -0
- package/lib-module/utils/index.js +5 -1
- package/lib-module/utils/logger.js +18 -0
- package/lib-module/utils/media.js +46 -0
- package/lib-module/utils/renderStructuredContent.js +77 -0
- package/lib-module/utils/useTypographyTheme.js +24 -0
- package/package.json +9 -5
- package/src/Breadcrumbs/Breadcrumbs.jsx +222 -0
- package/src/Breadcrumbs/Item/Item.jsx +127 -0
- package/src/Breadcrumbs/index.js +1 -0
- package/src/Callout/Callout.jsx +76 -0
- package/src/Callout/index.js +3 -0
- package/src/DatePicker/CalendarContainer.jsx +210 -0
- package/src/DatePicker/DatePicker.jsx +303 -0
- package/src/DatePicker/dictionary.js +92 -0
- package/src/DatePicker/index.js +3 -0
- package/src/DatePicker/reactDatesCss.js +892 -0
- package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +48 -0
- package/src/ExpandCollapseMini/ExpandCollapseMiniControl.jsx +67 -0
- package/src/ExpandCollapseMini/index.js +3 -0
- package/src/Footnote/Footnote.jsx +468 -0
- package/src/Footnote/FootnoteLink.jsx +120 -0
- package/src/Footnote/dictionary.js +12 -0
- package/src/Footnote/index.js +6 -0
- package/src/Paragraph/Paragraph.jsx +79 -0
- package/src/Paragraph/index.js +3 -0
- package/src/PreviewCard/AuthorDate.jsx +31 -0
- package/src/PreviewCard/PreviewCard.jsx +201 -0
- package/src/PreviewCard/index.js +3 -0
- package/src/PriceLockup/PriceLockup.jsx +210 -0
- package/src/PriceLockup/index.js +3 -0
- package/src/PriceLockup/tokens.js +58 -0
- package/src/ResponsiveImage/ResponsiveImage.jsx +77 -0
- package/src/ResponsiveImage/index.js +3 -0
- package/src/Ribbon/Ribbon.jsx +0 -1
- package/src/Span/Span.jsx +66 -0
- package/src/Span/index.js +3 -0
- package/src/index.js +10 -0
- package/src/shared/FullBleedContent/FullBleedContent.jsx +90 -0
- package/src/shared/FullBleedContent/getFullBleedBorderRadius.js +55 -0
- package/src/shared/FullBleedContent/index.js +6 -0
- package/src/shared/FullBleedContent/useFullBleedContentProps.js +63 -0
- package/src/utils/index.js +5 -1
- package/src/utils/logger.js +20 -0
- package/src/utils/media.js +40 -0
- package/src/utils/renderStructuredContent.jsx +73 -0
- package/src/utils/useTypographyTheme.js +14 -0
- package/types/Callout.d.ts +13 -0
- package/types/DatePicker.d.ts +21 -0
- package/types/Footnote.d.ts +21 -0
- package/types/FootnoteLink.d.ts +20 -0
- package/types/PriceLockup.d.ts +22 -0
- package/types/common.d.ts +14 -0
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
import React, { forwardRef, useState } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import styled from 'styled-components';
|
|
4
|
+
import momentPropTypes from 'react-moment-proptypes';
|
|
5
|
+
import 'react-dates/initialize';
|
|
6
|
+
import SingleDatePicker from 'react-dates/lib/components/SingleDatePicker';
|
|
7
|
+
import DayPickerSingleDateController from 'react-dates/lib/components/DayPickerSingleDateController';
|
|
8
|
+
import { Icon, InputSupports, selectSystemProps, useCopy, useViewport, useThemeTokens, applyTextStyles } from '@telus-uds/components-base';
|
|
9
|
+
import CalendarContainer from './CalendarContainer';
|
|
10
|
+
import dictionary from './dictionary';
|
|
11
|
+
import { htmlAttrs } from '../utils';
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
15
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]);
|
|
16
|
+
|
|
17
|
+
const getResponsiveDaySize = function () {
|
|
18
|
+
let inline = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
19
|
+
let viewport = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'md';
|
|
20
|
+
let responsiveDaySize;
|
|
21
|
+
|
|
22
|
+
if (viewport === 'xs') {
|
|
23
|
+
responsiveDaySize = inline ? undefined : 36;
|
|
24
|
+
} else {
|
|
25
|
+
responsiveDaySize = inline ? 60 : 44;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return responsiveDaySize;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const getIcon = icon => /*#__PURE__*/_jsx(Icon, {
|
|
32
|
+
icon: icon,
|
|
33
|
+
variant: {
|
|
34
|
+
size: 'small'
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
const MonthCenterContainer = /*#__PURE__*/styled.div.withConfig({
|
|
39
|
+
displayName: "DatePicker__MonthCenterContainer",
|
|
40
|
+
componentId: "components-web__sc-mz8fi3-0"
|
|
41
|
+
})({
|
|
42
|
+
display: 'flex',
|
|
43
|
+
justifyContent: 'center'
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* Use DatePicker to select a date on a calendar.
|
|
47
|
+
*
|
|
48
|
+
* ## Usage Criteria
|
|
49
|
+
*
|
|
50
|
+
* - Use DatePicker to select a date on a calendar
|
|
51
|
+
* - Available in 2 formats: Overlay and Inline
|
|
52
|
+
*
|
|
53
|
+
* ### Overlay DatePicker
|
|
54
|
+
* - Use Overlay to display in a modal container
|
|
55
|
+
* - Use Overlay whenever possible as it is the most accessible solution; the input form field is type-accessible and optimized for mobile customers
|
|
56
|
+
* - Includes an input form field to allow manual key-in of dates
|
|
57
|
+
* - Opens the modal when the input form field receives focus
|
|
58
|
+
* - Width expands 100% until max-width of 340px
|
|
59
|
+
*
|
|
60
|
+
* ### Inline DatePicker
|
|
61
|
+
* - Use Inline to display the DatePicker in a larger vieweable area; allows the customer to quickly and easily date availability
|
|
62
|
+
* - Does not include an input form field
|
|
63
|
+
* - Optimized for keyboard interaction and tablet touch
|
|
64
|
+
* - Recommended for viewports greater than or equal to 576px
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
const DatePicker = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
68
|
+
var _dictionary$copy;
|
|
69
|
+
|
|
70
|
+
let {
|
|
71
|
+
copy = 'en',
|
|
72
|
+
id,
|
|
73
|
+
date,
|
|
74
|
+
feedback,
|
|
75
|
+
inline,
|
|
76
|
+
isDayDisabled,
|
|
77
|
+
label,
|
|
78
|
+
onDateChange,
|
|
79
|
+
hint,
|
|
80
|
+
hintPosition = 'inline',
|
|
81
|
+
tooltip,
|
|
82
|
+
tokens,
|
|
83
|
+
variant = {},
|
|
84
|
+
validation,
|
|
85
|
+
...rest
|
|
86
|
+
} = _ref;
|
|
87
|
+
const [inputDate, setInputDate] = useState(date);
|
|
88
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
89
|
+
const getCopy = useCopy({
|
|
90
|
+
dictionary,
|
|
91
|
+
copy
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const onFocusChange = _ref2 => {
|
|
95
|
+
let {
|
|
96
|
+
focused
|
|
97
|
+
} = _ref2;
|
|
98
|
+
setIsFocused(focused);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const onChange = value => {
|
|
102
|
+
setInputDate(value);
|
|
103
|
+
if (onDateChange) onDateChange(value);
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const viewport = useViewport();
|
|
107
|
+
const daySize = getResponsiveDaySize(inline, viewport);
|
|
108
|
+
const value = date ?? inputDate;
|
|
109
|
+
const HiddenInputFieldContainer = /*#__PURE__*/styled.div.withConfig({
|
|
110
|
+
displayName: "DatePicker__HiddenInputFieldContainer",
|
|
111
|
+
componentId: "components-web__sc-mz8fi3-1"
|
|
112
|
+
})(["height:", ";width:", ";overflow:hidden;"], props => props.height, props => props.width);
|
|
113
|
+
const {
|
|
114
|
+
hiddenInputFieldContainerHeight,
|
|
115
|
+
hiddenInputFieldContainerWidth,
|
|
116
|
+
previousIcon,
|
|
117
|
+
nextIcon,
|
|
118
|
+
...remainingTokens
|
|
119
|
+
} = useThemeTokens('DatePicker', tokens, variant, {
|
|
120
|
+
viewport
|
|
121
|
+
});
|
|
122
|
+
const defaultFontTokens = applyTextStyles({
|
|
123
|
+
fontName: remainingTokens.calendarDayDefaultFontName,
|
|
124
|
+
fontWeight: remainingTokens.calendarDayDefaultFontWeight
|
|
125
|
+
});
|
|
126
|
+
const calendarMonthFontTokens = applyTextStyles({
|
|
127
|
+
fontName: remainingTokens.calendarMonthCaptionFontName,
|
|
128
|
+
fontWeight: remainingTokens.calendarMonthCaptionFontWeight
|
|
129
|
+
});
|
|
130
|
+
const dayPickerNavigationButtonTokens = applyTextStyles({
|
|
131
|
+
fontName: remainingTokens.dayPickerWeekHeaderFontName,
|
|
132
|
+
fontWeight: remainingTokens.dayPickerWeekHeaderFontWeight
|
|
133
|
+
});
|
|
134
|
+
return /*#__PURE__*/_jsx(CalendarContainer, { ...selectProps(rest),
|
|
135
|
+
daySize: daySize,
|
|
136
|
+
validation: validation,
|
|
137
|
+
remainingTokens: remainingTokens,
|
|
138
|
+
calendarMonthFontTokens: calendarMonthFontTokens,
|
|
139
|
+
dayPickerNavigationButtonTokens: dayPickerNavigationButtonTokens,
|
|
140
|
+
defaultFontTokens: defaultFontTokens,
|
|
141
|
+
children: /*#__PURE__*/_jsx(InputSupports, {
|
|
142
|
+
copy: copy,
|
|
143
|
+
feedback: feedback,
|
|
144
|
+
hint: hint,
|
|
145
|
+
hintPosition: hintPosition,
|
|
146
|
+
label: ((_dictionary$copy = dictionary[copy]) === null || _dictionary$copy === void 0 ? void 0 : _dictionary$copy.roleDescription) ?? label,
|
|
147
|
+
nativeID: id,
|
|
148
|
+
tooltip: tooltip,
|
|
149
|
+
validation: validation,
|
|
150
|
+
children: inline ? /*#__PURE__*/_jsxs(_Fragment, {
|
|
151
|
+
children: [/*#__PURE__*/_jsx(HiddenInputFieldContainer, {
|
|
152
|
+
height: hiddenInputFieldContainerHeight,
|
|
153
|
+
width: hiddenInputFieldContainerWidth,
|
|
154
|
+
children: /*#__PURE__*/_jsx("input", {
|
|
155
|
+
ref: ref,
|
|
156
|
+
id: id,
|
|
157
|
+
type: "text",
|
|
158
|
+
value: (value === null || value === void 0 ? void 0 : value.format('YYYY-MM-DD')) ?? '',
|
|
159
|
+
readOnly: true
|
|
160
|
+
})
|
|
161
|
+
}), /*#__PURE__*/_jsx(DayPickerSingleDateController, {
|
|
162
|
+
date: value,
|
|
163
|
+
onDateChange: onChange,
|
|
164
|
+
focused: isFocused,
|
|
165
|
+
onFocusChange: onFocusChange,
|
|
166
|
+
numberOfMonths: 1,
|
|
167
|
+
hideKeyboardShortcutsPanel: true,
|
|
168
|
+
keepOpenOnDateSelect: false,
|
|
169
|
+
daySize: daySize,
|
|
170
|
+
navPrev: getIcon(previousIcon),
|
|
171
|
+
navNext: getIcon(nextIcon),
|
|
172
|
+
isOutsideRange: isDayDisabled,
|
|
173
|
+
phrases: getCopy(),
|
|
174
|
+
renderMonthElement: _ref3 => {
|
|
175
|
+
let {
|
|
176
|
+
month
|
|
177
|
+
} = _ref3;
|
|
178
|
+
return /*#__PURE__*/_jsx(MonthCenterContainer, {
|
|
179
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
180
|
+
children: [dictionary[copy] ? dictionary[copy].months[month.month()] : month.format('MMMM'), ' ', month.year()]
|
|
181
|
+
})
|
|
182
|
+
});
|
|
183
|
+
},
|
|
184
|
+
renderWeekHeaderElement: day => /*#__PURE__*/_jsx("div", {
|
|
185
|
+
children: dictionary[copy] ? dictionary[copy].weekDays[day] : day
|
|
186
|
+
})
|
|
187
|
+
})]
|
|
188
|
+
}) : /*#__PURE__*/_jsx(SingleDatePicker, {
|
|
189
|
+
ref: ref,
|
|
190
|
+
id: id,
|
|
191
|
+
date: value,
|
|
192
|
+
onDateChange: onChange,
|
|
193
|
+
focused: isFocused,
|
|
194
|
+
onFocusChange: onFocusChange,
|
|
195
|
+
numberOfMonths: 1,
|
|
196
|
+
hideKeyboardShortcutsPanel: true,
|
|
197
|
+
displayFormat: "DD / MM / YYYY",
|
|
198
|
+
placeholder: "DD / MM / YYYY",
|
|
199
|
+
keepOpenOnDateSelect: false,
|
|
200
|
+
daySize: daySize,
|
|
201
|
+
navPrev: getIcon(previousIcon),
|
|
202
|
+
navNext: getIcon(nextIcon),
|
|
203
|
+
isOutsideRange: isDayDisabled,
|
|
204
|
+
phrases: getCopy(),
|
|
205
|
+
renderMonthElement: _ref4 => {
|
|
206
|
+
let {
|
|
207
|
+
month
|
|
208
|
+
} = _ref4;
|
|
209
|
+
return /*#__PURE__*/_jsx(MonthCenterContainer, {
|
|
210
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
211
|
+
children: [dictionary[copy] ? dictionary[copy].months[month.month()] : month.format('MMMM'), ' ', month.year()]
|
|
212
|
+
})
|
|
213
|
+
});
|
|
214
|
+
},
|
|
215
|
+
renderWeekHeaderElement: day => /*#__PURE__*/_jsx("div", {
|
|
216
|
+
children: dictionary[copy] ? dictionary[copy].weekDays[day] : day
|
|
217
|
+
})
|
|
218
|
+
})
|
|
219
|
+
})
|
|
220
|
+
});
|
|
221
|
+
});
|
|
222
|
+
DatePicker.displayName = 'DatePicker';
|
|
223
|
+
DatePicker.propTypes = { ...selectedSystemPropTypes,
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* A unique identifier.
|
|
227
|
+
*/
|
|
228
|
+
id: PropTypes.string.isRequired,
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
* Whether the English or French copy will be used (e.g. for accessibility labels).
|
|
232
|
+
*/
|
|
233
|
+
copy: PropTypes.oneOf(['en', 'fr']),
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* A Moment instance representing the currently selected date, i.e. `moment()`
|
|
237
|
+
*/
|
|
238
|
+
date: momentPropTypes.momentObj,
|
|
239
|
+
|
|
240
|
+
/**
|
|
241
|
+
* A detailed description of validation error/success or additional instructions.
|
|
242
|
+
* Visual variant is determined based on the `validation` prop.
|
|
243
|
+
*/
|
|
244
|
+
feedback: PropTypes.string,
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Event triggered every time a new date is clicked on
|
|
248
|
+
* @param {Moment} date The new date that was selected
|
|
249
|
+
*/
|
|
250
|
+
onDateChange: PropTypes.func,
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* A function determining whether a given date should be disabled
|
|
254
|
+
* @param {Moment} date The date to optionally disable
|
|
255
|
+
* @returns {bool}
|
|
256
|
+
*/
|
|
257
|
+
isDayDisabled: PropTypes.func,
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* The field label to be displayed above the calendar
|
|
261
|
+
*/
|
|
262
|
+
label: PropTypes.string,
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* A flag determining if the calendar picker is standalone or an input with overlay
|
|
266
|
+
*/
|
|
267
|
+
inline: PropTypes.bool,
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* A short description of the expected input.
|
|
271
|
+
*/
|
|
272
|
+
hint: PropTypes.string,
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Position of the hint relative to label. Use `below` to display a larger hint below the label.
|
|
276
|
+
*/
|
|
277
|
+
hintPosition: PropTypes.oneOf(['inline', 'below']),
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Content of an optional `Tooltip`. If set, a tooltip button will be shown next to the label.
|
|
281
|
+
*/
|
|
282
|
+
tooltip: PropTypes.string,
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Use to visually mark an input as valid or invalid.
|
|
286
|
+
*/
|
|
287
|
+
validation: PropTypes.oneOf(['error', 'success'])
|
|
288
|
+
};
|
|
289
|
+
DatePicker.defaultProps = {
|
|
290
|
+
copy: 'en',
|
|
291
|
+
date: undefined,
|
|
292
|
+
feedback: undefined,
|
|
293
|
+
inline: false,
|
|
294
|
+
isDayDisabled: undefined,
|
|
295
|
+
label: undefined,
|
|
296
|
+
hint: undefined,
|
|
297
|
+
hintPosition: 'inline',
|
|
298
|
+
tooltip: undefined,
|
|
299
|
+
onDateChange: () => {},
|
|
300
|
+
validation: undefined
|
|
301
|
+
};
|
|
302
|
+
export default DatePicker;
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
// from https://github.com/airbnb/react-dates/blob/master/src/defaultPhrases.js
|
|
2
|
+
const calendarLabel = 'Calendrier';
|
|
3
|
+
const roleDescription = 'Sélecteur de date';
|
|
4
|
+
const closeDatePicker = 'Fermer ';
|
|
5
|
+
const clearDate = 'Supprimer la date';
|
|
6
|
+
const jumpToPrevMonth = 'Reculer pour passer au mois précédent.';
|
|
7
|
+
const jumpToNextMonth = 'Avancer pour passer au mois suivant.';
|
|
8
|
+
const keyboardShortcuts = 'Raccourcis clavier ';
|
|
9
|
+
const showKeyboardShortcutsPanel = 'Ouvrir le panneau de raccourcis clavier.';
|
|
10
|
+
const hideKeyboardShortcutsPanel = 'Fermez le panneau de raccourcis.';
|
|
11
|
+
const openThisPanel = 'Ouvrir le panneau. ';
|
|
12
|
+
const enterKey = 'Touche Entrée ';
|
|
13
|
+
const leftArrowRightArrow = 'Touches de direction droite et gauche';
|
|
14
|
+
const upArrowDownArrow = 'Touches de direction haut et bas';
|
|
15
|
+
const pageUpPageDown = 'Touches Page précédente et Page suivante';
|
|
16
|
+
const homeEnd = 'Touches Accueil et Fin';
|
|
17
|
+
const escape = 'Touche Échap.';
|
|
18
|
+
const questionMark = `Point d'interrogation`;
|
|
19
|
+
const selectFocusedDate = 'Sélectionner la date mise au point.';
|
|
20
|
+
const moveFocusByOneDay = `Reculer (à gauche) et avancer (à droite) d'un jour.`;
|
|
21
|
+
const moveFocusByOneWeek = `Reculer (vers le haut) et avancer (vers le bas) d'une semaine.`;
|
|
22
|
+
const moveFocusByOneMonth = 'Changer de mois.';
|
|
23
|
+
const moveFocustoStartAndEndOfWeek = 'Aller au premier ou au dernier jour de la semaine.';
|
|
24
|
+
const returnFocusToInput = 'Revenir au champ de saisie de la date.';
|
|
25
|
+
const keyboardForwardNavigationInstructions = `Naviguer vers l'avant pour interagir avec le calendrier et sélectionner une date. Appuyer sur la touche Point d'interrogation pour obtenir les raccourcis clavier permettant de modifier les dates.`;
|
|
26
|
+
const keyboardBackwardNavigationInstructions = `Naviguer en arrière pour interagir avec le calendrier et sélectionner une date. Appuyer sur la touche Point d'interrogation pour obtenir les raccourcis clavier permettant de modifier les dates.`;
|
|
27
|
+
const months = ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Julliet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'];
|
|
28
|
+
const weekDays = {
|
|
29
|
+
Su: 'Dim',
|
|
30
|
+
Mo: 'Lun',
|
|
31
|
+
Tu: 'Mar',
|
|
32
|
+
We: 'Mer',
|
|
33
|
+
Th: 'Jeu',
|
|
34
|
+
Fr: 'Ven',
|
|
35
|
+
Sa: 'Sam'
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const chooseAvailableStartDate = _ref => {
|
|
39
|
+
let {
|
|
40
|
+
date
|
|
41
|
+
} = _ref;
|
|
42
|
+
return `Choisir ${date}. Disponible.`;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const chooseAvailableEndDate = _ref2 => {
|
|
46
|
+
let {
|
|
47
|
+
date
|
|
48
|
+
} = _ref2;
|
|
49
|
+
return `Non disponible. ${date}`;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const chooseAvailableDate = _ref3 => {
|
|
53
|
+
let {
|
|
54
|
+
date
|
|
55
|
+
} = _ref3;
|
|
56
|
+
return date;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const dateIsUnavailable = _ref4 => {
|
|
60
|
+
let {
|
|
61
|
+
date
|
|
62
|
+
} = _ref4;
|
|
63
|
+
return `Not available. ${date}`;
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
const dateIsSelected = _ref5 => {
|
|
67
|
+
let {
|
|
68
|
+
date
|
|
69
|
+
} = _ref5;
|
|
70
|
+
return `Choisie. ${date}`;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const dateIsSelectedAsStartDate = _ref6 => {
|
|
74
|
+
let {
|
|
75
|
+
date
|
|
76
|
+
} = _ref6;
|
|
77
|
+
return `Choisie comme date de début. ${date}`;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const dateIsSelectedAsEndDate = _ref7 => {
|
|
81
|
+
let {
|
|
82
|
+
date
|
|
83
|
+
} = _ref7;
|
|
84
|
+
return `Choisie comme date de fin. ${date}`;
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const dictionary = {
|
|
88
|
+
en: undefined,
|
|
89
|
+
// uses react-dates defaults
|
|
90
|
+
fr: {
|
|
91
|
+
calendarLabel,
|
|
92
|
+
roleDescription,
|
|
93
|
+
jumpToPrevMonth,
|
|
94
|
+
jumpToNextMonth,
|
|
95
|
+
keyboardShortcuts,
|
|
96
|
+
showKeyboardShortcutsPanel,
|
|
97
|
+
hideKeyboardShortcutsPanel,
|
|
98
|
+
openThisPanel,
|
|
99
|
+
enterKey,
|
|
100
|
+
leftArrowRightArrow,
|
|
101
|
+
upArrowDownArrow,
|
|
102
|
+
pageUpPageDown,
|
|
103
|
+
homeEnd,
|
|
104
|
+
escape,
|
|
105
|
+
questionMark,
|
|
106
|
+
selectFocusedDate,
|
|
107
|
+
moveFocusByOneDay,
|
|
108
|
+
moveFocusByOneWeek,
|
|
109
|
+
moveFocusByOneMonth,
|
|
110
|
+
moveFocustoStartAndEndOfWeek,
|
|
111
|
+
returnFocusToInput,
|
|
112
|
+
months,
|
|
113
|
+
weekDays,
|
|
114
|
+
chooseAvailableStartDate,
|
|
115
|
+
chooseAvailableEndDate,
|
|
116
|
+
chooseAvailableDate,
|
|
117
|
+
dateIsUnavailable,
|
|
118
|
+
dateIsSelected,
|
|
119
|
+
dateIsSelectedAsStartDate,
|
|
120
|
+
dateIsSelectedAsEndDate,
|
|
121
|
+
closeDatePicker,
|
|
122
|
+
clearDate,
|
|
123
|
+
keyboardForwardNavigationInstructions,
|
|
124
|
+
keyboardBackwardNavigationInstructions
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
export default dictionary;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { css } from 'styled-components';
|
|
2
|
+
const defaultReactDatesCss = /*#__PURE__*/css([".PresetDateRangePicker_panel{padding:0 22px 11px;}.PresetDateRangePicker_button{position:relative;height:100%;text-align:center;background:0 0;border:2px solid #00a699;color:#00a699;padding:4px 12px;margin-right:8px;font:inherit;font-weight:700;line-height:normal;overflow:visible;-moz-box-sizing:border-box;box-sizing:border-box;cursor:pointer;}.PresetDateRangePicker_button:active{outline:0;}.PresetDateRangePicker_button__selected{color:#fff;background:#00a699;}.SingleDatePickerInput{display:inline-block;background-color:#fff;}.SingleDatePickerInput__withBorder{border-radius:2px;border:1px solid #dbdbdb;}.SingleDatePickerInput__rtl{direction:rtl;}.SingleDatePickerInput__disabled{background-color:#f2f2f2;}.SingleDatePickerInput__block{display:block;}.SingleDatePickerInput__showClearDate{padding-right:30px;}.SingleDatePickerInput_clearDate{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;padding:10px;margin:0 10px 0 5px;position:absolute;right:0;top:50%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);}.SingleDatePickerInput_clearDate__default:focus,.SingleDatePickerInput_clearDate__default:hover{background:#dbdbdb;border-radius:50%;}.SingleDatePickerInput_clearDate__small{padding:6px;}.SingleDatePickerInput_clearDate__hide{visibility:hidden;}.SingleDatePickerInput_clearDate_svg{fill:#82888a;height:12px;width:15px;vertical-align:middle;}.SingleDatePickerInput_clearDate_svg__small{height:9px;}.SingleDatePickerInput_calendarIcon{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;display:inline-block;vertical-align:middle;padding:10px;margin:0 5px 0 10px;}.SingleDatePickerInput_calendarIcon_svg{fill:#82888a;height:15px;width:14px;vertical-align:middle;}.SingleDatePicker{position:relative;display:inline-block;}.SingleDatePicker__block{display:block;}.SingleDatePicker_picker{z-index:1;background-color:#fff;position:absolute;}.SingleDatePicker_picker__rtl{direction:rtl;}.SingleDatePicker_picker__directionLeft{left:0;}.SingleDatePicker_picker__directionRight{right:0;}.SingleDatePicker_picker__portal{background-color:rgba(0,0,0,0.3);position:fixed;top:0;left:0;height:100%;width:100%;}.SingleDatePicker_picker__fullScreenPortal{background-color:#fff;}.SingleDatePicker_closeButton{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;position:absolute;top:0;right:0;padding:15px;z-index:2;}.SingleDatePicker_closeButton:focus,.SingleDatePicker_closeButton:hover{color:darken(#cacccd,10%);text-decoration:none;}.SingleDatePicker_closeButton_svg{height:15px;width:15px;fill:#cacccd;}.DayPickerKeyboardShortcuts_buttonReset{background:0 0;border:0;border-radius:0;color:inherit;font:inherit;line-height:normal;overflow:visible;padding:0;cursor:pointer;font-size:14px;}.DayPickerKeyboardShortcuts_buttonReset:active{outline:0;}.DayPickerKeyboardShortcuts_show{width:33px;height:26px;position:absolute;z-index:2;}.DayPickerKeyboardShortcuts_show::before{content:'';display:block;position:absolute;}.DayPickerKeyboardShortcuts_show__bottomRight{bottom:0;right:0;}.DayPickerKeyboardShortcuts_show__bottomRight::before{border-top:26px solid transparent;border-right:33px solid #00a699;bottom:0;right:0;}.DayPickerKeyboardShortcuts_show__bottomRight:hover::before{border-right:33px solid #008489;}.DayPickerKeyboardShortcuts_show__topRight{top:0;right:0;}.DayPickerKeyboardShortcuts_show__topRight::before{border-bottom:26px solid transparent;border-right:33px solid #00a699;top:0;right:0;}.DayPickerKeyboardShortcuts_show__topRight:hover::before{border-right:33px solid #008489;}.DayPickerKeyboardShortcuts_show__topLeft{top:0;left:0;}.DayPickerKeyboardShortcuts_show__topLeft::before{border-bottom:26px solid transparent;border-left:33px solid #00a699;top:0;left:0;}.DayPickerKeyboardShortcuts_show__topLeft:hover::before{border-left:33px solid #008489;}.DayPickerKeyboardShortcuts_showSpan{color:#fff;position:absolute;}.DayPickerKeyboardShortcuts_showSpan__bottomRight{bottom:0;right:5px;}.DayPickerKeyboardShortcuts_showSpan__topRight{top:1px;right:5px;}.DayPickerKeyboardShortcuts_showSpan__topLeft{top:1px;left:5px;}.DayPickerKeyboardShortcuts_panel{overflow:auto;background:#fff;border:1px solid #dbdbdb;border-radius:2px;position:absolute;top:0;bottom:0;right:0;left:0;z-index:2;padding:22px;margin:33px;text-align:left;}.DayPickerKeyboardShortcuts_title{font-size:16px;font-weight:700;margin:0;}.DayPickerKeyboardShortcuts_list{list-style:none;padding:0;font-size:14px;}.DayPickerKeyboardShortcuts_close{position:absolute;right:22px;top:22px;z-index:2;}.DayPickerKeyboardShortcuts_close:active{outline:0;}.DayPickerKeyboardShortcuts_closeSvg{height:15px;width:15px;fill:#cacccd;}.DayPickerKeyboardShortcuts_closeSvg:focus,.DayPickerKeyboardShortcuts_closeSvg:hover{fill:#82888a;}.CalendarDay{-moz-box-sizing:border-box;box-sizing:border-box;cursor:pointer;font-size:14px;text-align:center;}.CalendarDay:active{outline:0;}.CalendarDay__defaultCursor{cursor:default;}.CalendarDay__default{border:1px solid #e4e7e7;color:#484848;background:#fff;}.CalendarDay__default:hover{background:#e4e7e7;border:1px solid #e4e7e7;color:inherit;}.CalendarDay__hovered_offset{background:#f4f5f5;border:1px double #e4e7e7;color:inherit;}.CalendarDay__outside{border:0;background:#fff;color:#484848;}.CalendarDay__outside:hover{border:0;}.CalendarDay__blocked_minimum_nights{background:#fff;border:1px solid #eceeee;color:#cacccd;}.CalendarDay__blocked_minimum_nights:active,.CalendarDay__blocked_minimum_nights:hover{background:#fff;color:#cacccd;}.CalendarDay__highlighted_calendar{background:#ffe8bc;color:#484848;}.CalendarDay__highlighted_calendar:active,.CalendarDay__highlighted_calendar:hover{background:#ffce71;color:#484848;}.CalendarDay__selected_span{background:#66e2da;border:1px double #33dacd;color:#fff;}.CalendarDay__selected_span:active,.CalendarDay__selected_span:hover{background:#33dacd;border:1px double #33dacd;color:#fff;}.CalendarDay__selected,.CalendarDay__selected:active,.CalendarDay__selected:hover{background:#00a699;border:1px double #00a699;color:#fff;}.CalendarDay__hovered_span,.CalendarDay__hovered_span:hover{background:#b2f1ec;border:1px double #80e8e0;color:#007a87;}.CalendarDay__hovered_span:active{background:#80e8e0;border:1px double #80e8e0;color:#007a87;}.CalendarDay__blocked_calendar,.CalendarDay__blocked_calendar:active,.CalendarDay__blocked_calendar:hover{background:#cacccd;border:1px solid #cacccd;color:#82888a;}.CalendarDay__blocked_out_of_range,.CalendarDay__blocked_out_of_range:active,.CalendarDay__blocked_out_of_range:hover{background:#fff;border:1px solid #e4e7e7;color:#cacccd;}.CalendarDay__hovered_start_first_possible_end{background:#eceeee;border:1px double #eceeee;}.CalendarDay__hovered_start_blocked_min_nights{background:#eceeee;border:1px double #e4e7e7;}.CalendarMonth{background:#fff;text-align:center;vertical-align:top;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.CalendarMonth_table{border-collapse:collapse;border-spacing:0;}.CalendarMonth_verticalSpacing{border-collapse:separate;}.CalendarMonth_caption{color:#484848;font-size:18px;text-align:center;padding-top:22px;padding-bottom:37px;caption-side:initial;}.CalendarMonth_caption__verticalScrollable{padding-top:12px;padding-bottom:7px;}.CalendarMonthGrid{background:#fff;text-align:left;z-index:0;}.CalendarMonthGrid__animating{z-index:1;}.CalendarMonthGrid__horizontal{position:absolute;left:9px;}.CalendarMonthGrid__vertical,.CalendarMonthGrid__vertical_scrollable{margin:0 auto;}.CalendarMonthGrid_month__horizontal{display:inline-block;vertical-align:top;min-height:100%;}.CalendarMonthGrid_month__hideForAnimation{position:absolute;z-index:-1;opacity:0;pointer-events:none;}.CalendarMonthGrid_month__hidden{visibility:hidden;}.DayPickerNavigation{position:relative;z-index:2;}.DayPickerNavigation__horizontal{height:0;}.DayPickerNavigation__verticalScrollable_prevNav{z-index:1;}.DayPickerNavigation__verticalDefault{position:absolute;width:100%;height:52px;bottom:0;left:0;}.DayPickerNavigation__verticalScrollableDefault{position:relative;}.DayPickerNavigation__bottom{height:auto;}.DayPickerNavigation__bottomDefault{-webkit-box-pack:justify;-ms-flex-pack:justify;display:-webkit-box;display:-moz-box;display:-ms-flexbox;display:-webkit-flex;display:flex;-webkit-justify-content:space-between;justify-content:space-between;}.DayPickerNavigation_button{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;border:0;padding:0;margin:0;}.DayPickerNavigation_button__default{border:1px solid #e4e7e7;background-color:#fff;color:#757575;}.DayPickerNavigation_button__default:focus,.DayPickerNavigation_button__default:hover{border:1px solid #c4c4c4;}.DayPickerNavigation_button__default:active{background:#f2f2f2;}.DayPickerNavigation_button__disabled{cursor:default;border:1px solid #f2f2f2;}.DayPickerNavigation_button__disabled:focus,.DayPickerNavigation_button__disabled:hover{border:1px solid #f2f2f2;}.DayPickerNavigation_button__disabled:active{background:0 0;}.DayPickerNavigation_button__horizontalDefault{position:absolute;top:18px;line-height:0.78;border-radius:3px;padding:6px 9px;}.DayPickerNavigation_bottomButton__horizontalDefault{position:static;margin:-10px 22px 30px;}.DayPickerNavigation_leftButton__horizontalDefault{left:22px;}.DayPickerNavigation_rightButton__horizontalDefault{right:22px;}.DayPickerNavigation_button__verticalDefault{padding:5px;background:#fff;box-shadow:0 0 5px 2px rgba(0,0,0,0.1);position:relative;display:inline-block;text-align:center;height:100%;width:50%;}.DayPickerNavigation_nextButton__verticalDefault{border-left:0;}.DayPickerNavigation_nextButton__verticalScrollableDefault,.DayPickerNavigation_prevButton__verticalScrollableDefault{width:100%;}.DayPickerNavigation_svg__horizontal{height:19px;width:19px;fill:#82888a;display:block;}.DayPickerNavigation_svg__vertical{height:42px;width:42px;fill:#484848;}.DayPickerNavigation_svg__disabled{fill:#f2f2f2;}.DayPicker{background:#fff;position:relative;text-align:left;}.DayPicker__horizontal{background:#fff;}.DayPicker__verticalScrollable{height:100%;}.DayPicker__hidden{visibility:hidden;}.DayPicker__withBorder{box-shadow:0 2px 6px rgba(0,0,0,0.05),0 0 0 1px rgba(0,0,0,0.07);border-radius:3px;}.DayPicker_portal__horizontal{box-shadow:none;position:absolute;left:50%;top:50%;}.DayPicker_portal__vertical{position:initial;}.DayPicker_focusRegion{outline:0;}.DayPicker_calendarInfo__horizontal,.DayPicker_wrapper__horizontal{display:inline-block;vertical-align:top;}.DayPicker_weekHeaders{position:relative;}.DayPicker_weekHeaders__horizontal{margin-left:9px;}.DayPicker_weekHeader{color:#757575;position:absolute;top:62px;z-index:2;text-align:left;}.DayPicker_weekHeader__vertical{left:50%;}.DayPicker_weekHeader__verticalScrollable{top:0;display:table-row;border-bottom:1px solid #dbdbdb;background:#fff;margin-left:0;left:0;width:100%;text-align:center;}.DayPicker_weekHeader_ul{list-style:none;margin:1px 0;padding-left:0;padding-right:0;font-size:14px;}.DayPicker_weekHeader_li{display:inline-block;text-align:center;}.DayPicker_transitionContainer{position:relative;overflow:hidden;border-radius:3px;}.DayPicker_transitionContainer__horizontal{-webkit-transition:height 0.2s ease-in-out;-moz-transition:height 0.2s ease-in-out;transition:height 0.2s ease-in-out;}.DayPicker_transitionContainer__vertical{width:100%;}.DayPicker_transitionContainer__verticalScrollable{padding-top:20px;height:100%;position:absolute;top:0;bottom:0;right:0;left:0;overflow-y:scroll;}.DateInput{margin:0;padding:0;background:#fff;position:relative;display:inline-block;width:130px;vertical-align:middle;}.DateInput__small{width:97px;}.DateInput__block{width:100%;}.DateInput__disabled{background:#f2f2f2;color:#dbdbdb;}.DateInput_input{font-weight:200;font-size:19px;line-height:24px;color:#484848;background-color:#fff;width:100%;padding:11px 11px 9px;border:0;border-top:0;border-right:0;border-bottom:2px solid transparent;border-left:0;border-radius:0;}.DateInput_input__small{font-size:15px;line-height:18px;letter-spacing:0.2px;padding:7px 7px 5px;}.DateInput_input__regular{font-weight:auto;}.DateInput_input__readOnly{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;}.DateInput_input__focused{outline:0;background:#fff;border:0;border-top:0;border-right:0;border-bottom:2px solid #008489;border-left:0;}.DateInput_input__disabled{background:#f2f2f2;font-style:italic;}.DateInput_screenReaderMessage{border:0;clip:rect(0,0,0,0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;}.DateInput_fang{position:absolute;width:20px;height:10px;left:22px;z-index:2;}.DateInput_fangShape{fill:#fff;}.DateInput_fangStroke{stroke:#dbdbdb;fill:transparent;}.DateRangePickerInput{background-color:#fff;display:inline-block;}.DateRangePickerInput__disabled{background:#f2f2f2;}.DateRangePickerInput__withBorder{border-radius:2px;border:1px solid #dbdbdb;}.DateRangePickerInput__rtl{direction:rtl;}.DateRangePickerInput__block{display:block;}.DateRangePickerInput__showClearDates{padding-right:30px;}.DateRangePickerInput_arrow{display:inline-block;vertical-align:middle;color:#484848;}.DateRangePickerInput_arrow_svg{vertical-align:middle;fill:#484848;height:24px;width:24px;}.DateRangePickerInput_clearDates{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;padding:10px;margin:0 10px 0 5px;position:absolute;right:0;top:50%;-webkit-transform:translateY(-50%);-ms-transform:translateY(-50%);transform:translateY(-50%);}.DateRangePickerInput_clearDates__small{padding:6px;}.DateRangePickerInput_clearDates_default:focus,.DateRangePickerInput_clearDates_default:hover{background:#dbdbdb;border-radius:50%;}.DateRangePickerInput_clearDates__hide{visibility:hidden;}.DateRangePickerInput_clearDates_svg{fill:#82888a;height:12px;width:15px;vertical-align:middle;}.DateRangePickerInput_clearDates_svg__small{height:9px;}.DateRangePickerInput_calendarIcon{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;display:inline-block;vertical-align:middle;padding:10px;margin:0 5px 0 10px;}.DateRangePickerInput_calendarIcon_svg{fill:#82888a;height:15px;width:14px;vertical-align:middle;}.DateRangePicker{position:relative;display:inline-block;}.DateRangePicker__block{display:block;}.DateRangePicker_picker{z-index:1;background-color:#fff;position:absolute;}.DateRangePicker_picker__rtl{direction:rtl;}.DateRangePicker_picker__directionLeft{left:0;}.DateRangePicker_picker__directionRight{right:0;}.DateRangePicker_picker__portal{background-color:rgba(0,0,0,0.3);position:fixed;top:0;left:0;height:100%;width:100%;}.DateRangePicker_picker__fullScreenPortal{background-color:#fff;}.DateRangePicker_closeButton{background:0 0;border:0;color:inherit;font:inherit;line-height:normal;overflow:visible;cursor:pointer;position:absolute;top:0;right:0;padding:15px;z-index:2;}.DateRangePicker_closeButton:focus,.DateRangePicker_closeButton:hover{color:darken(#cacccd,10%);text-decoration:none;}.DateRangePicker_closeButton_svg{height:15px;width:15px;fill:#cacccd;}"]);
|
|
3
|
+
export default defaultReactDatesCss;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React, { forwardRef } from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { ExpandCollapse, useThemeTokens } from '@telus-uds/components-base';
|
|
4
|
+
import ExpandCollapseMiniControl from './ExpandCollapseMiniControl';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const ExpandCollapseMini = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
7
|
+
let {
|
|
8
|
+
children,
|
|
9
|
+
onToggle,
|
|
10
|
+
tokens,
|
|
11
|
+
...rest
|
|
12
|
+
} = _ref;
|
|
13
|
+
const {
|
|
14
|
+
variant
|
|
15
|
+
} = rest;
|
|
16
|
+
const {
|
|
17
|
+
borderWidth
|
|
18
|
+
} = useThemeTokens('ExpandCollapseMini', tokens, variant);
|
|
19
|
+
|
|
20
|
+
const handleChange = (openPanels, event) => {
|
|
21
|
+
if (typeof onToggle === 'function') {
|
|
22
|
+
const isOpen = openPanels.length > 0;
|
|
23
|
+
onToggle(event, isOpen);
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
return /*#__PURE__*/_jsx(ExpandCollapse, {
|
|
28
|
+
tokens: {
|
|
29
|
+
borderWidth
|
|
30
|
+
},
|
|
31
|
+
onChange: handleChange,
|
|
32
|
+
children: expandProps => /*#__PURE__*/_jsx(ExpandCollapse.Panel, { ...expandProps,
|
|
33
|
+
panelId: "ExpandCollapseMiniPanel",
|
|
34
|
+
controlTokens: {
|
|
35
|
+
icon: null
|
|
36
|
+
} // TODO refactor
|
|
37
|
+
// eslint-disable-next-line react/no-unstable-nested-components
|
|
38
|
+
,
|
|
39
|
+
control: pressableState => /*#__PURE__*/_jsx(ExpandCollapseMiniControl, {
|
|
40
|
+
pressableState: pressableState,
|
|
41
|
+
...rest
|
|
42
|
+
}),
|
|
43
|
+
controlRef: ref,
|
|
44
|
+
children: children
|
|
45
|
+
})
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
ExpandCollapseMini.displayName = 'ExpandCollapseMini';
|
|
49
|
+
ExpandCollapseMini.propTypes = { ...ExpandCollapseMiniControl.propTypes,
|
|
50
|
+
onToggle: PropTypes.func,
|
|
51
|
+
children: PropTypes.node.isRequired
|
|
52
|
+
};
|
|
53
|
+
ExpandCollapseMini.defaultProps = {
|
|
54
|
+
onToggle: () => {}
|
|
55
|
+
};
|
|
56
|
+
export default ExpandCollapseMini;
|
|
@@ -0,0 +1,80 @@
|
|
|
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
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
const [selectProps, selectedSystemPropTypes] = selectSystemProps([htmlAttrs]); // The ExpandCollapseControl has all the appropriate role, a11y, press handling etc
|
|
7
|
+
// and a more appropriate press area, defer interaction handling to it.
|
|
8
|
+
|
|
9
|
+
const presentationOnly = {
|
|
10
|
+
accessibilityRole: null,
|
|
11
|
+
// Treat as regular flow content with the Control
|
|
12
|
+
pointerEvents: 'none',
|
|
13
|
+
// Stop RNW from stopping clicks from bubbling to Control
|
|
14
|
+
focusable: false // Stop RNW from setting tabIndex={0}: focus goes to Control only
|
|
15
|
+
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const ExpandCollapseMiniControl = _ref => {
|
|
19
|
+
let {
|
|
20
|
+
pressableState,
|
|
21
|
+
collapseTitle,
|
|
22
|
+
expandTitle = collapseTitle,
|
|
23
|
+
iconPosition = 'right',
|
|
24
|
+
tokens,
|
|
25
|
+
variant = {},
|
|
26
|
+
...rest
|
|
27
|
+
} = _ref;
|
|
28
|
+
const {
|
|
29
|
+
expanded,
|
|
30
|
+
hover
|
|
31
|
+
} = pressableState || {};
|
|
32
|
+
const {
|
|
33
|
+
size,
|
|
34
|
+
icon
|
|
35
|
+
} = useThemeTokens('ExpandCollapseMiniControl', tokens, variant, {
|
|
36
|
+
expanded
|
|
37
|
+
}); // Choose hover styles when any part of Control is hoverred
|
|
38
|
+
|
|
39
|
+
const appearance = { ...variant,
|
|
40
|
+
hover
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const getTokens = linkState => {
|
|
44
|
+
const {
|
|
45
|
+
hover: linkHover
|
|
46
|
+
} = linkState || {};
|
|
47
|
+
const isHovered = hover || linkHover;
|
|
48
|
+
|
|
49
|
+
if (isHovered) {
|
|
50
|
+
// Include vertical icon animation on hover alongside built-in Link theme, the size is size4
|
|
51
|
+
return {
|
|
52
|
+
iconTranslateY: (expanded ? -1 : 1) * size
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return {};
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
return /*#__PURE__*/_jsx(Link, {
|
|
60
|
+
variant: appearance,
|
|
61
|
+
icon: icon,
|
|
62
|
+
iconPosition: iconPosition,
|
|
63
|
+
tokens: linkState => ({ ...getTokens(linkState),
|
|
64
|
+
outerBorderWidth: 0
|
|
65
|
+
}),
|
|
66
|
+
...presentationOnly,
|
|
67
|
+
...selectProps(rest),
|
|
68
|
+
children: expanded ? expandTitle : collapseTitle
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
ExpandCollapseMiniControl.propTypes = { ...selectedSystemPropTypes,
|
|
73
|
+
...Link.propTypes,
|
|
74
|
+
onPress: PropTypes.func,
|
|
75
|
+
expandTitle: PropTypes.string.isRequired,
|
|
76
|
+
collapseTitle: PropTypes.string.isRequired,
|
|
77
|
+
pressableState: PropTypes.object,
|
|
78
|
+
variant: PropTypes.object
|
|
79
|
+
};
|
|
80
|
+
export default ExpandCollapseMiniControl;
|