@telus-uds/components-web 1.2.0 → 1.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 (140) hide show
  1. package/CHANGELOG.md +34 -2
  2. package/lib/Breadcrumbs/Breadcrumbs.js +247 -0
  3. package/lib/Breadcrumbs/Item/Item.js +165 -0
  4. package/lib/Breadcrumbs/index.js +15 -0
  5. package/lib/Callout/Callout.js +121 -0
  6. package/lib/Callout/index.js +13 -0
  7. package/lib/DatePicker/CalendarContainer.js +221 -0
  8. package/lib/DatePicker/DatePicker.js +329 -0
  9. package/lib/DatePicker/dictionary.js +134 -0
  10. package/lib/DatePicker/index.js +13 -0
  11. package/lib/DatePicker/reactDatesCss.js +12 -0
  12. package/lib/ExpandCollapseMini/ExpandCollapseMini.js +75 -0
  13. package/lib/ExpandCollapseMini/ExpandCollapseMiniControl.js +95 -0
  14. package/lib/ExpandCollapseMini/index.js +13 -0
  15. package/lib/Footnote/Footnote.js +571 -0
  16. package/lib/Footnote/FootnoteLink.js +149 -0
  17. package/lib/Footnote/dictionary.js +19 -0
  18. package/lib/Footnote/index.js +16 -0
  19. package/lib/OrderedList/Item.js +162 -0
  20. package/lib/OrderedList/ItemBase.js +42 -0
  21. package/lib/OrderedList/OrderedList.js +94 -0
  22. package/lib/OrderedList/OrderedListBase.js +68 -0
  23. package/lib/OrderedList/constants.js +9 -0
  24. package/lib/OrderedList/index.js +16 -0
  25. package/lib/PreviewCard/AuthorDate.js +64 -0
  26. package/lib/PreviewCard/PreviewCard.js +236 -0
  27. package/lib/PreviewCard/index.js +13 -0
  28. package/lib/PriceLockup/PriceLockup.js +237 -0
  29. package/lib/PriceLockup/index.js +13 -0
  30. package/lib/PriceLockup/tokens.js +131 -0
  31. package/lib/ResponsiveImage/ResponsiveImage.js +115 -0
  32. package/lib/ResponsiveImage/index.js +13 -0
  33. package/lib/Ribbon/Ribbon.js +0 -1
  34. package/lib/Span/Span.js +88 -0
  35. package/lib/Span/index.js +13 -0
  36. package/lib/index.js +91 -1
  37. package/lib/shared/FullBleedContent/FullBleedContent.js +121 -0
  38. package/lib/shared/FullBleedContent/getFullBleedBorderRadius.js +73 -0
  39. package/lib/shared/FullBleedContent/index.js +29 -0
  40. package/lib/shared/FullBleedContent/useFullBleedContentProps.js +73 -0
  41. package/lib/utils/index.js +32 -0
  42. package/lib/utils/logger.js +31 -0
  43. package/lib/utils/media.js +54 -0
  44. package/lib/utils/renderStructuredContent.js +89 -0
  45. package/lib/utils/useTypographyTheme.js +32 -0
  46. package/lib-module/Breadcrumbs/Breadcrumbs.js +228 -0
  47. package/lib-module/Breadcrumbs/Item/Item.js +141 -0
  48. package/lib-module/Breadcrumbs/index.js +1 -0
  49. package/lib-module/Callout/Callout.js +106 -0
  50. package/lib-module/Callout/index.js +2 -0
  51. package/lib-module/DatePicker/CalendarContainer.js +208 -0
  52. package/lib-module/DatePicker/DatePicker.js +302 -0
  53. package/lib-module/DatePicker/dictionary.js +127 -0
  54. package/lib-module/DatePicker/index.js +2 -0
  55. package/lib-module/DatePicker/reactDatesCss.js +3 -0
  56. package/lib-module/ExpandCollapseMini/ExpandCollapseMini.js +56 -0
  57. package/lib-module/ExpandCollapseMini/ExpandCollapseMiniControl.js +80 -0
  58. package/lib-module/ExpandCollapseMini/index.js +2 -0
  59. package/lib-module/Footnote/Footnote.js +541 -0
  60. package/lib-module/Footnote/FootnoteLink.js +130 -0
  61. package/lib-module/Footnote/dictionary.js +12 -0
  62. package/lib-module/Footnote/index.js +4 -0
  63. package/lib-module/OrderedList/Item.js +139 -0
  64. package/lib-module/OrderedList/ItemBase.js +28 -0
  65. package/lib-module/OrderedList/OrderedList.js +71 -0
  66. package/lib-module/OrderedList/OrderedListBase.js +48 -0
  67. package/lib-module/OrderedList/constants.js +2 -0
  68. package/lib-module/OrderedList/index.js +4 -0
  69. package/lib-module/PreviewCard/AuthorDate.js +53 -0
  70. package/lib-module/PreviewCard/PreviewCard.js +211 -0
  71. package/lib-module/PreviewCard/index.js +2 -0
  72. package/lib-module/PriceLockup/PriceLockup.js +213 -0
  73. package/lib-module/PriceLockup/index.js +2 -0
  74. package/lib-module/PriceLockup/tokens.js +120 -0
  75. package/lib-module/ResponsiveImage/ResponsiveImage.js +100 -0
  76. package/lib-module/ResponsiveImage/index.js +2 -0
  77. package/lib-module/Ribbon/Ribbon.js +1 -2
  78. package/lib-module/Span/Span.js +70 -0
  79. package/lib-module/Span/index.js +2 -0
  80. package/lib-module/index.js +10 -0
  81. package/lib-module/shared/FullBleedContent/FullBleedContent.js +106 -0
  82. package/lib-module/shared/FullBleedContent/getFullBleedBorderRadius.js +65 -0
  83. package/lib-module/shared/FullBleedContent/index.js +4 -0
  84. package/lib-module/shared/FullBleedContent/useFullBleedContentProps.js +65 -0
  85. package/lib-module/utils/index.js +5 -1
  86. package/lib-module/utils/logger.js +18 -0
  87. package/lib-module/utils/media.js +46 -0
  88. package/lib-module/utils/renderStructuredContent.js +77 -0
  89. package/lib-module/utils/useTypographyTheme.js +24 -0
  90. package/package.json +9 -4
  91. package/src/Breadcrumbs/Breadcrumbs.jsx +222 -0
  92. package/src/Breadcrumbs/Item/Item.jsx +127 -0
  93. package/src/Breadcrumbs/index.js +1 -0
  94. package/src/Callout/Callout.jsx +76 -0
  95. package/src/Callout/index.js +3 -0
  96. package/src/DatePicker/CalendarContainer.jsx +210 -0
  97. package/src/DatePicker/DatePicker.jsx +303 -0
  98. package/src/DatePicker/dictionary.js +92 -0
  99. package/src/DatePicker/index.js +3 -0
  100. package/src/DatePicker/reactDatesCss.js +892 -0
  101. package/src/ExpandCollapseMini/ExpandCollapseMini.jsx +48 -0
  102. package/src/ExpandCollapseMini/ExpandCollapseMiniControl.jsx +67 -0
  103. package/src/ExpandCollapseMini/index.js +3 -0
  104. package/src/Footnote/Footnote.jsx +468 -0
  105. package/src/Footnote/FootnoteLink.jsx +120 -0
  106. package/src/Footnote/dictionary.js +12 -0
  107. package/src/Footnote/index.js +6 -0
  108. package/src/OrderedList/Item.jsx +121 -0
  109. package/src/OrderedList/ItemBase.jsx +18 -0
  110. package/src/OrderedList/OrderedList.jsx +61 -0
  111. package/src/OrderedList/OrderedListBase.jsx +38 -0
  112. package/src/OrderedList/constants.js +2 -0
  113. package/src/OrderedList/index.js +6 -0
  114. package/src/PreviewCard/AuthorDate.jsx +31 -0
  115. package/src/PreviewCard/PreviewCard.jsx +201 -0
  116. package/src/PreviewCard/index.js +3 -0
  117. package/src/PriceLockup/PriceLockup.jsx +210 -0
  118. package/src/PriceLockup/index.js +3 -0
  119. package/src/PriceLockup/tokens.js +58 -0
  120. package/src/ResponsiveImage/ResponsiveImage.jsx +77 -0
  121. package/src/ResponsiveImage/index.js +3 -0
  122. package/src/Ribbon/Ribbon.jsx +0 -1
  123. package/src/Span/Span.jsx +66 -0
  124. package/src/Span/index.js +3 -0
  125. package/src/index.js +10 -0
  126. package/src/shared/FullBleedContent/FullBleedContent.jsx +90 -0
  127. package/src/shared/FullBleedContent/getFullBleedBorderRadius.js +55 -0
  128. package/src/shared/FullBleedContent/index.js +6 -0
  129. package/src/shared/FullBleedContent/useFullBleedContentProps.js +63 -0
  130. package/src/utils/index.js +5 -1
  131. package/src/utils/logger.js +20 -0
  132. package/src/utils/media.js +40 -0
  133. package/src/utils/renderStructuredContent.jsx +73 -0
  134. package/src/utils/useTypographyTheme.js +14 -0
  135. package/types/Callout.d.ts +13 -0
  136. package/types/DatePicker.d.ts +21 -0
  137. package/types/Footnote.d.ts +21 -0
  138. package/types/FootnoteLink.d.ts +20 -0
  139. package/types/PriceLockup.d.ts +22 -0
  140. package/types/common.d.ts +14 -0
@@ -0,0 +1,221 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
9
+
10
+ var _reactDatesCss = _interopRequireDefault(require("./reactDatesCss"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ const CalendarContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
15
+ displayName: "CalendarContainer",
16
+ componentId: "components-web__sc-qdc1tg-0"
17
+ })(_ref => {
18
+ let {
19
+ daySize,
20
+ validation,
21
+ remainingTokens,
22
+ calendarMonthFontTokens,
23
+ dayPickerNavigationButtonTokens,
24
+ defaultFontTokens
25
+ } = _ref;
26
+ return `
27
+ ${_reactDatesCss.default}
28
+ > div {
29
+ z-index: 3;
30
+ }
31
+ .SingleDatePicker,
32
+ .SingleDatePickerInput {
33
+ display: block;
34
+ }
35
+ .SingleDatePicker_picker {
36
+ box-shadow: none;
37
+ border: 1px solid ${remainingTokens.singleDatePickerBorderColor};
38
+ border-radius: ${remainingTokens.singleDatePickerRadius};
39
+ padding: ${remainingTokens.singleDatePickerPaddingTopBottom}px ${remainingTokens.singleDatePickerLeftRight}px;
40
+ z-index: 3;
41
+ }
42
+ .DateInput {
43
+ width: 100%;
44
+ border: 2px solid ${remainingTokens.dateInputBorderColor};
45
+ border-radius: ${remainingTokens.dateInputBorderRadius};
46
+ ${validation === 'error' && `input { border-color: ${remainingTokens.invalidInputMixin}; }`};
47
+ ${validation === 'success' && `input { border-color: ${remainingTokens.validInputMixin}; }`};
48
+ }
49
+ .DateInput:hover {
50
+ border: 2px solid ${remainingTokens.dateInputHoverBorderColor};
51
+ }
52
+ .DateInput:focus {
53
+ border: 2px solid ${remainingTokens.dateInputFocusBorderColor};
54
+ }
55
+ .SingleDatePickerInput__withBorder {
56
+ border: 0 !important;
57
+ }
58
+ .DateInput_input {
59
+ box-sizing: border-box;
60
+ padding: 1rem;
61
+ border: 1px solid ${remainingTokens.dateInputInsideBorderColor};
62
+ border-radius: 4px;
63
+ min-height: 3.25rem;
64
+ color: ${remainingTokens.dateInputInsideColor};
65
+ font-weight: 400;
66
+ font-size: 1rem;
67
+ box-shadow: 0 1px 8px rgba(0, 0, 0, 0.05);
68
+ }
69
+ .DateInput_fang {
70
+ transform: translateY(2px);
71
+ z-index: 4;
72
+ left: ${(daySize * 8.5 - 20) / 2}px;
73
+ }
74
+ .DateInput_fangStroke {
75
+ stroke: ${remainingTokens.dateInputStrokeColor};
76
+ }
77
+ .CalendarMonth_caption {
78
+ color: ${remainingTokens.calendarMonthCaptionColor};
79
+ font-family: ${calendarMonthFontTokens.fontFamily};
80
+ font-size: ${remainingTokens.calendarMonthCaptionFontSize};
81
+ font-weight: ${calendarMonthFontTokens.fontWeight};
82
+ line-height: ${remainingTokens.calendarMonthCaptionLineHeight};
83
+ padding-bottom: ${remainingTokens.calendarMonthCaptionPaddingBottom}px;
84
+ }
85
+ .DayPicker__withBorder {
86
+ box-shadow: none;
87
+ }
88
+ .DayPickerNavigation_button {
89
+ align-items: center;
90
+ display: flex;
91
+ justify-content: center;
92
+ border: 1px solid ${remainingTokens.dayPickerNavigationButtonBorderColor};
93
+ background-color: ${remainingTokens.dayPickerNavigationButtonBackgroundColor};
94
+ border-radius: 50%;
95
+ box-shadow: 0 2px 2px rgba(0, 0, 0, 0.1);
96
+ max-height: ${remainingTokens.dayPickerNavigationButtonMaxHeight}px;
97
+ max-width: ${remainingTokens.dayPickerNavigationButtonMaxWidth}px;
98
+ position: absolute;
99
+ top: 18px;
100
+ line-height: 0.78;
101
+ padding: ${remainingTokens.dayPickerNavigationButtonPadding}px;
102
+ cursor: pointer;
103
+ user-select: none;
104
+ &:nth-child(1) {
105
+ left: ${remainingTokens.dayPickerNavigationButtonChildLeft}px;
106
+ }
107
+ &:nth-child(2) {
108
+ right: ${remainingTokens.dayPickerNavigationButtonChildRight}px;
109
+ i {
110
+ font-family: 'TELUS Core Icons';
111
+ display: inline-block;
112
+ font-weight: normal;
113
+ font-style: normal;
114
+ speak: none;
115
+ text-decoration: inherit;
116
+ text-transform: none;
117
+ text-rendering: auto;
118
+ -webkit-font-smoothing: antialiased;
119
+ -moz-osx-font-smoothing: grayscale;
120
+ line-height: 1;
121
+ vertical-align: middle;
122
+ &:before {
123
+ content: '\\F107';
124
+ display: inline-block;
125
+ }
126
+ }
127
+ }
128
+ & svg {
129
+ fill: ${remainingTokens.dayPickerNavigationButtonChildSvgFill};
130
+ }
131
+ }
132
+ .DayPickerNavigation_button__default:focus,
133
+ .DayPickerNavigation_button__default:hover {
134
+ border: 1px solid ${remainingTokens.dayPickerNavigationButtonDefaultHoverBorderColor};
135
+ }
136
+ .DayPickerNavigation_svg__horizontal {
137
+ fill: ${remainingTokens.dayPickerNavigationSVGHorizontalFill};
138
+ }
139
+ .DayPicker_weekHeader {
140
+ color: ${remainingTokens.dayPickerWeekHeaderColor};
141
+ font-family: ${dayPickerNavigationButtonTokens.fontFamily};
142
+ font-weight: ${dayPickerNavigationButtonTokens.fontWeight};
143
+ font-feature-settings: 'ss01' on, 'ss03' on, 'ss08' on;
144
+ line-height: ${remainingTokens.dayPickerWeekHeaderLineHeight};
145
+ & small {
146
+ font-size: ${remainingTokens.dayPickerWeekHeaderSmall};
147
+ }
148
+ & li {
149
+ max-width: ${daySize}px !important;
150
+ }
151
+ }
152
+ .CalendarDay__default {
153
+ padding: 0px;
154
+ position: relative;
155
+ background-clip: padding-box;
156
+ border: ${remainingTokens.calendarDayDefaultBorder} solid ${remainingTokens.calendarDayDefaultBorderColor};
157
+ vertical-align: middle;
158
+ font-family: ${defaultFontTokens.fontFamily};
159
+ font-weight: ${defaultFontTokens.fontWeight}
160
+ font-feature-settings: 'ss01' on, 'ss03' on, 'ss08' on;
161
+ font-size: ${remainingTokens.calendarDayDefaultFontSize};
162
+ line-height: ${daySize - 3}px !important;
163
+ color: ${remainingTokens.calendarDayDefaultColor};
164
+ text-decoration: none;
165
+ transition: all 0.3s;
166
+ &:before {
167
+ content: '';
168
+ position: absolute;
169
+ top: 50%;
170
+ left: 50%;
171
+ transform: translate(-50%, -50%);
172
+ height: ${remainingTokens.calendarDayDefaultBeforeHeight}px;
173
+ width: ${remainingTokens.calendarDayDefaultBeforeWidth}px;
174
+ border-radius: 50%;
175
+ background: transparent;
176
+ transition: all 0.3s;
177
+ z-index: -1;
178
+ }
179
+ }
180
+ .CalendarDay__default:hover,
181
+ .CalendarDay__selected,
182
+ .CalendarDay__selected:active,
183
+ .CalendarDay__selected:hover {
184
+ background: none;
185
+ border: 1px solid ${remainingTokens.calendarDaySelectedHoverBorderColor};
186
+ color: ${remainingTokens.calendarDaySelectedHoverColor};
187
+ text-decoration: none;
188
+ z-index: 0;
189
+ &:before {
190
+ background: ${remainingTokens.calendarDaySelectedHoverBeforeBackground};
191
+ }
192
+ }
193
+ .CalendarDay__default.CalendarDay__selected,
194
+ .CalendarDay__default.CalendarDay__selected:active
195
+ .CalendarDay__default.CalendarDay__selected:hover {
196
+ color: ${remainingTokens.calendarDayDefaultCalendarDaySelectedHoverColor};
197
+ text-decoration: none;
198
+ &:before {
199
+ background: ${remainingTokens.calendarDayDefaultCalendarDaySelectedHoverBackground};
200
+ }
201
+ }
202
+ .CalendarDay__blocked_out_of_range,
203
+ .CalendarDay__blocked_out_of_range:active,
204
+ .CalendarDay__blocked_out_of_range:hover,
205
+ .CalendarDay__blocked_calendar,
206
+ .CalendarDay__blocked_calendar:active,
207
+ .CalendarDay__blocked_calendar:hover {
208
+ font-weight: 300;
209
+ background: ${remainingTokens.calendarDayBlockedCalendarHoverBackground};
210
+ background-clip: padding-box;
211
+ color: ${remainingTokens.calendarDayBlockedCalendarHoverColor};
212
+ text-decoration: none;
213
+ &:before {
214
+ content: none;
215
+ }
216
+ }
217
+ `;
218
+ });
219
+
220
+ var _default = CalendarContainer;
221
+ exports.default = _default;
@@ -0,0 +1,329 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
13
+
14
+ var _reactMomentProptypes = _interopRequireDefault(require("react-moment-proptypes"));
15
+
16
+ require("react-dates/initialize");
17
+
18
+ var _SingleDatePicker = _interopRequireDefault(require("react-dates/lib/components/SingleDatePicker"));
19
+
20
+ var _DayPickerSingleDateController = _interopRequireDefault(require("react-dates/lib/components/DayPickerSingleDateController"));
21
+
22
+ var _componentsBase = require("@telus-uds/components-base");
23
+
24
+ var _CalendarContainer = _interopRequireDefault(require("./CalendarContainer"));
25
+
26
+ var _dictionary = _interopRequireDefault(require("./dictionary"));
27
+
28
+ var _utils = require("../utils");
29
+
30
+ var _jsxRuntime = require("react/jsx-runtime");
31
+
32
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
33
+
34
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
35
+
36
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
37
+
38
+ const [selectProps, selectedSystemPropTypes] = (0, _componentsBase.selectSystemProps)([_utils.htmlAttrs]);
39
+
40
+ const getResponsiveDaySize = function () {
41
+ let inline = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
42
+ let viewport = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'md';
43
+ let responsiveDaySize;
44
+
45
+ if (viewport === 'xs') {
46
+ responsiveDaySize = inline ? undefined : 36;
47
+ } else {
48
+ responsiveDaySize = inline ? 60 : 44;
49
+ }
50
+
51
+ return responsiveDaySize;
52
+ };
53
+
54
+ const getIcon = icon => /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.Icon, {
55
+ icon: icon,
56
+ variant: {
57
+ size: 'small'
58
+ }
59
+ });
60
+
61
+ const MonthCenterContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
62
+ displayName: "DatePicker__MonthCenterContainer",
63
+ componentId: "components-web__sc-mz8fi3-0"
64
+ })({
65
+ display: 'flex',
66
+ justifyContent: 'center'
67
+ });
68
+ /**
69
+ * Use DatePicker to select a date on a calendar.
70
+ *
71
+ * ## Usage Criteria
72
+ *
73
+ * - Use DatePicker to select a date on a calendar
74
+ * - Available in 2 formats: Overlay and Inline
75
+ *
76
+ * ### Overlay DatePicker
77
+ * - Use Overlay to display in a modal container
78
+ * - Use Overlay whenever possible as it is the most accessible solution; the input form field is type-accessible and optimized for mobile customers
79
+ * - Includes an input form field to allow manual key-in of dates
80
+ * - Opens the modal when the input form field receives focus
81
+ * - Width expands 100% until max-width of 340px
82
+ *
83
+ * ### Inline DatePicker
84
+ * - Use Inline to display the DatePicker in a larger vieweable area; allows the customer to quickly and easily date availability
85
+ * - Does not include an input form field
86
+ * - Optimized for keyboard interaction and tablet touch
87
+ * - Recommended for viewports greater than or equal to 576px
88
+ */
89
+
90
+
91
+ const DatePicker = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
92
+ var _dictionary$copy;
93
+
94
+ let {
95
+ copy = 'en',
96
+ id,
97
+ date,
98
+ feedback,
99
+ inline,
100
+ isDayDisabled,
101
+ label,
102
+ onDateChange,
103
+ hint,
104
+ hintPosition = 'inline',
105
+ tooltip,
106
+ tokens,
107
+ variant = {},
108
+ validation,
109
+ ...rest
110
+ } = _ref;
111
+ const [inputDate, setInputDate] = (0, _react.useState)(date);
112
+ const [isFocused, setIsFocused] = (0, _react.useState)(false);
113
+ const getCopy = (0, _componentsBase.useCopy)({
114
+ dictionary: _dictionary.default,
115
+ copy
116
+ });
117
+
118
+ const onFocusChange = _ref2 => {
119
+ let {
120
+ focused
121
+ } = _ref2;
122
+ setIsFocused(focused);
123
+ };
124
+
125
+ const onChange = value => {
126
+ setInputDate(value);
127
+ if (onDateChange) onDateChange(value);
128
+ };
129
+
130
+ const viewport = (0, _componentsBase.useViewport)();
131
+ const daySize = getResponsiveDaySize(inline, viewport);
132
+ const value = date ?? inputDate;
133
+
134
+ const HiddenInputFieldContainer = /*#__PURE__*/_styledComponents.default.div.withConfig({
135
+ displayName: "DatePicker__HiddenInputFieldContainer",
136
+ componentId: "components-web__sc-mz8fi3-1"
137
+ })(["height:", ";width:", ";overflow:hidden;"], props => props.height, props => props.width);
138
+
139
+ const {
140
+ hiddenInputFieldContainerHeight,
141
+ hiddenInputFieldContainerWidth,
142
+ previousIcon,
143
+ nextIcon,
144
+ ...remainingTokens
145
+ } = (0, _componentsBase.useThemeTokens)('DatePicker', tokens, variant, {
146
+ viewport
147
+ });
148
+ const defaultFontTokens = (0, _componentsBase.applyTextStyles)({
149
+ fontName: remainingTokens.calendarDayDefaultFontName,
150
+ fontWeight: remainingTokens.calendarDayDefaultFontWeight
151
+ });
152
+ const calendarMonthFontTokens = (0, _componentsBase.applyTextStyles)({
153
+ fontName: remainingTokens.calendarMonthCaptionFontName,
154
+ fontWeight: remainingTokens.calendarMonthCaptionFontWeight
155
+ });
156
+ const dayPickerNavigationButtonTokens = (0, _componentsBase.applyTextStyles)({
157
+ fontName: remainingTokens.dayPickerWeekHeaderFontName,
158
+ fontWeight: remainingTokens.dayPickerWeekHeaderFontWeight
159
+ });
160
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_CalendarContainer.default, { ...selectProps(rest),
161
+ daySize: daySize,
162
+ validation: validation,
163
+ remainingTokens: remainingTokens,
164
+ calendarMonthFontTokens: calendarMonthFontTokens,
165
+ dayPickerNavigationButtonTokens: dayPickerNavigationButtonTokens,
166
+ defaultFontTokens: defaultFontTokens,
167
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_componentsBase.InputSupports, {
168
+ copy: copy,
169
+ feedback: feedback,
170
+ hint: hint,
171
+ hintPosition: hintPosition,
172
+ label: ((_dictionary$copy = _dictionary.default[copy]) === null || _dictionary$copy === void 0 ? void 0 : _dictionary$copy.roleDescription) ?? label,
173
+ nativeID: id,
174
+ tooltip: tooltip,
175
+ validation: validation,
176
+ children: inline ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
177
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(HiddenInputFieldContainer, {
178
+ height: hiddenInputFieldContainerHeight,
179
+ width: hiddenInputFieldContainerWidth,
180
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
181
+ ref: ref,
182
+ id: id,
183
+ type: "text",
184
+ value: (value === null || value === void 0 ? void 0 : value.format('YYYY-MM-DD')) ?? '',
185
+ readOnly: true
186
+ })
187
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_DayPickerSingleDateController.default, {
188
+ date: value,
189
+ onDateChange: onChange,
190
+ focused: isFocused,
191
+ onFocusChange: onFocusChange,
192
+ numberOfMonths: 1,
193
+ hideKeyboardShortcutsPanel: true,
194
+ keepOpenOnDateSelect: false,
195
+ daySize: daySize,
196
+ navPrev: getIcon(previousIcon),
197
+ navNext: getIcon(nextIcon),
198
+ isOutsideRange: isDayDisabled,
199
+ phrases: getCopy(),
200
+ renderMonthElement: _ref3 => {
201
+ let {
202
+ month
203
+ } = _ref3;
204
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(MonthCenterContainer, {
205
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
206
+ children: [_dictionary.default[copy] ? _dictionary.default[copy].months[month.month()] : month.format('MMMM'), ' ', month.year()]
207
+ })
208
+ });
209
+ },
210
+ renderWeekHeaderElement: day => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
211
+ children: _dictionary.default[copy] ? _dictionary.default[copy].weekDays[day] : day
212
+ })
213
+ })]
214
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_SingleDatePicker.default, {
215
+ ref: ref,
216
+ id: id,
217
+ date: value,
218
+ onDateChange: onChange,
219
+ focused: isFocused,
220
+ onFocusChange: onFocusChange,
221
+ numberOfMonths: 1,
222
+ hideKeyboardShortcutsPanel: true,
223
+ displayFormat: "DD / MM / YYYY",
224
+ placeholder: "DD / MM / YYYY",
225
+ keepOpenOnDateSelect: false,
226
+ daySize: daySize,
227
+ navPrev: getIcon(previousIcon),
228
+ navNext: getIcon(nextIcon),
229
+ isOutsideRange: isDayDisabled,
230
+ phrases: getCopy(),
231
+ renderMonthElement: _ref4 => {
232
+ let {
233
+ month
234
+ } = _ref4;
235
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(MonthCenterContainer, {
236
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
237
+ children: [_dictionary.default[copy] ? _dictionary.default[copy].months[month.month()] : month.format('MMMM'), ' ', month.year()]
238
+ })
239
+ });
240
+ },
241
+ renderWeekHeaderElement: day => /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
242
+ children: _dictionary.default[copy] ? _dictionary.default[copy].weekDays[day] : day
243
+ })
244
+ })
245
+ })
246
+ });
247
+ });
248
+ DatePicker.displayName = 'DatePicker';
249
+ DatePicker.propTypes = { ...selectedSystemPropTypes,
250
+
251
+ /**
252
+ * A unique identifier.
253
+ */
254
+ id: _propTypes.default.string.isRequired,
255
+
256
+ /**
257
+ * Whether the English or French copy will be used (e.g. for accessibility labels).
258
+ */
259
+ copy: _propTypes.default.oneOf(['en', 'fr']),
260
+
261
+ /**
262
+ * A Moment instance representing the currently selected date, i.e. `moment()`
263
+ */
264
+ date: _reactMomentProptypes.default.momentObj,
265
+
266
+ /**
267
+ * A detailed description of validation error/success or additional instructions.
268
+ * Visual variant is determined based on the `validation` prop.
269
+ */
270
+ feedback: _propTypes.default.string,
271
+
272
+ /**
273
+ * Event triggered every time a new date is clicked on
274
+ * @param {Moment} date The new date that was selected
275
+ */
276
+ onDateChange: _propTypes.default.func,
277
+
278
+ /**
279
+ * A function determining whether a given date should be disabled
280
+ * @param {Moment} date The date to optionally disable
281
+ * @returns {bool}
282
+ */
283
+ isDayDisabled: _propTypes.default.func,
284
+
285
+ /**
286
+ * The field label to be displayed above the calendar
287
+ */
288
+ label: _propTypes.default.string,
289
+
290
+ /**
291
+ * A flag determining if the calendar picker is standalone or an input with overlay
292
+ */
293
+ inline: _propTypes.default.bool,
294
+
295
+ /**
296
+ * A short description of the expected input.
297
+ */
298
+ hint: _propTypes.default.string,
299
+
300
+ /**
301
+ * Position of the hint relative to label. Use `below` to display a larger hint below the label.
302
+ */
303
+ hintPosition: _propTypes.default.oneOf(['inline', 'below']),
304
+
305
+ /**
306
+ * Content of an optional `Tooltip`. If set, a tooltip button will be shown next to the label.
307
+ */
308
+ tooltip: _propTypes.default.string,
309
+
310
+ /**
311
+ * Use to visually mark an input as valid or invalid.
312
+ */
313
+ validation: _propTypes.default.oneOf(['error', 'success'])
314
+ };
315
+ DatePicker.defaultProps = {
316
+ copy: 'en',
317
+ date: undefined,
318
+ feedback: undefined,
319
+ inline: false,
320
+ isDayDisabled: undefined,
321
+ label: undefined,
322
+ hint: undefined,
323
+ hintPosition: 'inline',
324
+ tooltip: undefined,
325
+ onDateChange: () => {},
326
+ validation: undefined
327
+ };
328
+ var _default = DatePicker;
329
+ exports.default = _default;
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ // from https://github.com/airbnb/react-dates/blob/master/src/defaultPhrases.js
8
+ const calendarLabel = 'Calendrier';
9
+ const roleDescription = 'Sélecteur de date';
10
+ const closeDatePicker = 'Fermer ';
11
+ const clearDate = 'Supprimer la date';
12
+ const jumpToPrevMonth = 'Reculer pour passer au mois précédent.';
13
+ const jumpToNextMonth = 'Avancer pour passer au mois suivant.';
14
+ const keyboardShortcuts = 'Raccourcis clavier ';
15
+ const showKeyboardShortcutsPanel = 'Ouvrir le panneau de raccourcis clavier.';
16
+ const hideKeyboardShortcutsPanel = 'Fermez le panneau de raccourcis.';
17
+ const openThisPanel = 'Ouvrir le panneau. ';
18
+ const enterKey = 'Touche Entrée ';
19
+ const leftArrowRightArrow = 'Touches de direction droite et gauche';
20
+ const upArrowDownArrow = 'Touches de direction haut et bas';
21
+ const pageUpPageDown = 'Touches Page précédente et Page suivante';
22
+ const homeEnd = 'Touches Accueil et Fin';
23
+ const escape = 'Touche Échap.';
24
+ const questionMark = `Point d'interrogation`;
25
+ const selectFocusedDate = 'Sélectionner la date mise au point.';
26
+ const moveFocusByOneDay = `Reculer (à gauche) et avancer (à droite) d'un jour.`;
27
+ const moveFocusByOneWeek = `Reculer (vers le haut) et avancer (vers le bas) d'une semaine.`;
28
+ const moveFocusByOneMonth = 'Changer de mois.';
29
+ const moveFocustoStartAndEndOfWeek = 'Aller au premier ou au dernier jour de la semaine.';
30
+ const returnFocusToInput = 'Revenir au champ de saisie de la date.';
31
+ 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.`;
32
+ 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.`;
33
+ const months = ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Julliet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre'];
34
+ const weekDays = {
35
+ Su: 'Dim',
36
+ Mo: 'Lun',
37
+ Tu: 'Mar',
38
+ We: 'Mer',
39
+ Th: 'Jeu',
40
+ Fr: 'Ven',
41
+ Sa: 'Sam'
42
+ };
43
+
44
+ const chooseAvailableStartDate = _ref => {
45
+ let {
46
+ date
47
+ } = _ref;
48
+ return `Choisir ${date}. Disponible.`;
49
+ };
50
+
51
+ const chooseAvailableEndDate = _ref2 => {
52
+ let {
53
+ date
54
+ } = _ref2;
55
+ return `Non disponible. ${date}`;
56
+ };
57
+
58
+ const chooseAvailableDate = _ref3 => {
59
+ let {
60
+ date
61
+ } = _ref3;
62
+ return date;
63
+ };
64
+
65
+ const dateIsUnavailable = _ref4 => {
66
+ let {
67
+ date
68
+ } = _ref4;
69
+ return `Not available. ${date}`;
70
+ };
71
+
72
+ const dateIsSelected = _ref5 => {
73
+ let {
74
+ date
75
+ } = _ref5;
76
+ return `Choisie. ${date}`;
77
+ };
78
+
79
+ const dateIsSelectedAsStartDate = _ref6 => {
80
+ let {
81
+ date
82
+ } = _ref6;
83
+ return `Choisie comme date de début. ${date}`;
84
+ };
85
+
86
+ const dateIsSelectedAsEndDate = _ref7 => {
87
+ let {
88
+ date
89
+ } = _ref7;
90
+ return `Choisie comme date de fin. ${date}`;
91
+ };
92
+
93
+ const dictionary = {
94
+ en: undefined,
95
+ // uses react-dates defaults
96
+ fr: {
97
+ calendarLabel,
98
+ roleDescription,
99
+ jumpToPrevMonth,
100
+ jumpToNextMonth,
101
+ keyboardShortcuts,
102
+ showKeyboardShortcutsPanel,
103
+ hideKeyboardShortcutsPanel,
104
+ openThisPanel,
105
+ enterKey,
106
+ leftArrowRightArrow,
107
+ upArrowDownArrow,
108
+ pageUpPageDown,
109
+ homeEnd,
110
+ escape,
111
+ questionMark,
112
+ selectFocusedDate,
113
+ moveFocusByOneDay,
114
+ moveFocusByOneWeek,
115
+ moveFocusByOneMonth,
116
+ moveFocustoStartAndEndOfWeek,
117
+ returnFocusToInput,
118
+ months,
119
+ weekDays,
120
+ chooseAvailableStartDate,
121
+ chooseAvailableEndDate,
122
+ chooseAvailableDate,
123
+ dateIsUnavailable,
124
+ dateIsSelected,
125
+ dateIsSelectedAsStartDate,
126
+ dateIsSelectedAsEndDate,
127
+ closeDatePicker,
128
+ clearDate,
129
+ keyboardForwardNavigationInstructions,
130
+ keyboardBackwardNavigationInstructions
131
+ }
132
+ };
133
+ var _default = dictionary;
134
+ exports.default = _default;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _DatePicker = _interopRequireDefault(require("./DatePicker"));
9
+
10
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+
12
+ var _default = _DatePicker.default;
13
+ exports.default = _default;