@commercetools-uikit/calendar-utils 15.15.0 → 15.15.1
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/dist/commercetools-uikit-calendar-utils.cjs.d.ts +1 -0
- package/dist/commercetools-uikit-calendar-utils.cjs.d.ts.map +1 -0
- package/dist/commercetools-uikit-calendar-utils.cjs.dev.js +103 -146
- package/dist/commercetools-uikit-calendar-utils.cjs.prod.js +103 -146
- package/dist/commercetools-uikit-calendar-utils.esm.js +103 -145
- package/package.json +12 -12
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _toConsumableArray = require('@babel/runtime-corejs3/helpers/toConsumableArray');
|
|
6
|
-
var _concatInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/concat');
|
|
7
5
|
var _sliceInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/slice');
|
|
8
6
|
var _mapInstanceProperty = require('@babel/runtime-corejs3/core-js-stable/instance/map');
|
|
9
7
|
var _Array$from = require('@babel/runtime-corejs3/core-js-stable/array/from');
|
|
@@ -46,7 +44,6 @@ var _getPrototypeOf = require('@babel/runtime-corejs3/helpers/getPrototypeOf');
|
|
|
46
44
|
|
|
47
45
|
function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
|
|
48
46
|
|
|
49
|
-
var _concatInstanceProperty__default = /*#__PURE__*/_interopDefault(_concatInstanceProperty);
|
|
50
47
|
var _sliceInstanceProperty__default = /*#__PURE__*/_interopDefault(_sliceInstanceProperty);
|
|
51
48
|
var _mapInstanceProperty__default = /*#__PURE__*/_interopDefault(_mapInstanceProperty);
|
|
52
49
|
var _Array$from__default = /*#__PURE__*/_interopDefault(_Array$from);
|
|
@@ -70,100 +67,62 @@ var Text__default = /*#__PURE__*/_interopDefault(Text);
|
|
|
70
67
|
var Tooltip__default = /*#__PURE__*/_interopDefault(Tooltip);
|
|
71
68
|
var _Reflect$construct__default = /*#__PURE__*/_interopDefault(_Reflect$construct);
|
|
72
69
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return day ? moment__default["default"](day, 'YYYY-MM-DD', locale).format('L') : '';
|
|
84
|
-
};
|
|
85
|
-
var changeMonth = function changeMonth(day, delta) {
|
|
86
|
-
return moment__default["default"](day).add(delta, 'month').format('YYYY-MM-DD');
|
|
87
|
-
};
|
|
88
|
-
var getNextDay = function getNextDay(day) {
|
|
89
|
-
return moment__default["default"](day).add(1, 'day').format('YYYY-MM-DD');
|
|
90
|
-
};
|
|
91
|
-
var getPreviousDay = function getPreviousDay(day) {
|
|
92
|
-
return moment__default["default"](day).subtract(1, 'day').format('YYYY-MM-DD');
|
|
93
|
-
};
|
|
94
|
-
var getPaddingDayCount = function getPaddingDayCount(day, locale) {
|
|
95
|
-
var firstDayOfWeek = moment__default["default"].localeData(locale).firstDayOfWeek();
|
|
96
|
-
var firstDayOfMonth = moment__default["default"](day).startOf('month').day(); // ensure number is always positive
|
|
70
|
+
const getDaysInMonth = day => moment__default["default"](day).daysInMonth();
|
|
71
|
+
const getDateInMonth = day => moment__default["default"](day).date();
|
|
72
|
+
const getToday = () => moment__default["default"]().format('YYYY-MM-DD');
|
|
73
|
+
const formatDate = (day, locale) => day ? moment__default["default"](day, 'YYYY-MM-DD', locale).format('L') : '';
|
|
74
|
+
const changeMonth = (day, delta) => moment__default["default"](day).add(delta, 'month').format('YYYY-MM-DD');
|
|
75
|
+
const getNextDay = day => moment__default["default"](day).add(1, 'day').format('YYYY-MM-DD');
|
|
76
|
+
const getPreviousDay = day => moment__default["default"](day).subtract(1, 'day').format('YYYY-MM-DD');
|
|
77
|
+
const getPaddingDayCount = (day, locale) => {
|
|
78
|
+
const firstDayOfWeek = moment__default["default"].localeData(locale).firstDayOfWeek();
|
|
79
|
+
const firstDayOfMonth = moment__default["default"](day).startOf('month').day(); // ensure number is always positive
|
|
97
80
|
|
|
98
81
|
return (firstDayOfMonth - firstDayOfWeek + 7) % 7;
|
|
99
82
|
};
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
var isSameDay = function isSameDay(a, b) {
|
|
114
|
-
return moment__default["default"](a).isSame(b, 'day');
|
|
115
|
-
};
|
|
116
|
-
var getCalendarDayLabel = function getCalendarDayLabel(day) {
|
|
117
|
-
return moment__default["default"](day).format('D');
|
|
118
|
-
};
|
|
119
|
-
var isBetween = function isBetween(item, start, end) {
|
|
120
|
-
var itemDate = moment__default["default"](item);
|
|
121
|
-
var startDate = moment__default["default"](start);
|
|
122
|
-
var endDate = moment__default["default"](end);
|
|
83
|
+
const getWeekdayNames = locale => {
|
|
84
|
+
const weekDays = moment__default["default"].localeData(locale).weekdaysMin();
|
|
85
|
+
const firstDay = moment__default["default"].localeData(locale).firstDayOfWeek();
|
|
86
|
+
return [..._sliceInstanceProperty__default["default"](weekDays).call(weekDays, firstDay), ..._sliceInstanceProperty__default["default"](weekDays).call(weekDays, 0, firstDay)];
|
|
87
|
+
};
|
|
88
|
+
const getMonthCalendarLabel = (day, locale) => moment__default["default"](day, 'YYYY-MM-DD', locale).format('MMMM');
|
|
89
|
+
const getYearCalendarLabel = (day, locale) => moment__default["default"](day, 'YYYY-MM-DD', locale).format('YYYY');
|
|
90
|
+
const isSameDay = (a, b) => moment__default["default"](a).isSame(b, 'day');
|
|
91
|
+
const getCalendarDayLabel = day => moment__default["default"](day).format('D');
|
|
92
|
+
const isBetween = (item, start, end) => {
|
|
93
|
+
const itemDate = moment__default["default"](item);
|
|
94
|
+
const startDate = moment__default["default"](start);
|
|
95
|
+
const endDate = moment__default["default"](end);
|
|
123
96
|
return itemDate.isBetween(startDate, endDate) || itemDate.isBetween(endDate, startDate);
|
|
124
97
|
};
|
|
125
98
|
|
|
126
|
-
|
|
127
|
-
return moment__default["default"](day).date(dayOfMonth).format('YYYY-MM-DD');
|
|
128
|
-
};
|
|
99
|
+
const changeDateInMonth = (day, dayOfMonth) => moment__default["default"](day).date(dayOfMonth).format('YYYY-MM-DD');
|
|
129
100
|
|
|
130
|
-
|
|
131
|
-
var
|
|
101
|
+
const createCalendarItems = day => {
|
|
102
|
+
var _context;
|
|
132
103
|
|
|
133
|
-
return _mapInstanceProperty__default["default"](
|
|
104
|
+
return _mapInstanceProperty__default["default"](_context = _Array$from__default["default"]({
|
|
134
105
|
length: getDaysInMonth(day)
|
|
135
|
-
})).call(
|
|
136
|
-
|
|
137
|
-
|
|
106
|
+
})).call(_context, (_, i) => {
|
|
107
|
+
const dayOfMonth = i + 1;
|
|
108
|
+
const date = changeDateInMonth(day, dayOfMonth);
|
|
138
109
|
return date;
|
|
139
110
|
});
|
|
140
111
|
};
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}).join(' - ') : formatDate(item, locale);
|
|
146
|
-
};
|
|
147
|
-
};
|
|
148
|
-
var createItemToString = function createItemToString(locale) {
|
|
149
|
-
return function (item) {
|
|
150
|
-
return item ? formatDate(item, locale) : '';
|
|
151
|
-
};
|
|
152
|
-
};
|
|
153
|
-
var formatRange = function formatRange(range, locale) {
|
|
154
|
-
var _context3;
|
|
112
|
+
const createItemRangeToString = locale => item => _Array$isArray__default["default"](item) ? _mapInstanceProperty__default["default"](item).call(item, i => i ? formatDate(i, locale) : '').join(' - ') : formatDate(item, locale);
|
|
113
|
+
const createItemToString = locale => item => item ? formatDate(item, locale) : '';
|
|
114
|
+
const formatRange = (range, locale) => {
|
|
115
|
+
var _context2;
|
|
155
116
|
|
|
156
|
-
return _mapInstanceProperty__default["default"](
|
|
157
|
-
return formatDate(item, locale);
|
|
158
|
-
}).join(' - ');
|
|
117
|
+
return _mapInstanceProperty__default["default"](_context2 = _sortInstanceProperty__default["default"](range).call(range)).call(_context2, item => formatDate(item, locale)).join(' - ');
|
|
159
118
|
};
|
|
160
|
-
|
|
161
|
-
|
|
119
|
+
const parseInputToDate = (text, locale) => {
|
|
120
|
+
const localeDate = moment__default["default"](text, moment__default["default"].localeData(locale).longDateFormat('L'), locale);
|
|
162
121
|
if (localeDate.isValid()) return localeDate.format('YYYY-MM-DD');
|
|
163
122
|
return '';
|
|
164
123
|
};
|
|
165
|
-
|
|
166
|
-
|
|
124
|
+
const getIsDateInRange = (item, min, max) => {
|
|
125
|
+
const itemDate = moment__default["default"](item);
|
|
167
126
|
|
|
168
127
|
if (min && max) {
|
|
169
128
|
return itemDate.isBetween(min, max, null, '[]');
|
|
@@ -179,24 +138,22 @@ var getIsDateInRange = function getIsDateInRange(item, min, max) {
|
|
|
179
138
|
|
|
180
139
|
return true;
|
|
181
140
|
};
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
};
|
|
189
|
-
};
|
|
141
|
+
const getExampleDateStrings = () => ({
|
|
142
|
+
currentDate: moment__default["default"]().format('YYYY-MM-DD'),
|
|
143
|
+
preselectedDate: moment__default["default"]().add(3, 'days').format('YYYY-MM-DD'),
|
|
144
|
+
minDate: moment__default["default"]().format('YYYY-MM-DD'),
|
|
145
|
+
maxDate: moment__default["default"]().add(1, 'year').format('YYYY-MM-DD')
|
|
146
|
+
});
|
|
190
147
|
|
|
191
148
|
// NOTE: order is important here
|
|
192
149
|
// * a disabled-field currently does not display warning/error-states so it takes precedence
|
|
193
150
|
// * a readonly-field cannot be changed, but it might be relevant for validation, so error and warning are checked first
|
|
194
151
|
// how you can interact with the field is controlled separately by the props, this only influences visuals
|
|
195
|
-
|
|
152
|
+
const getClearSectionStyles = () => {
|
|
196
153
|
return /*#__PURE__*/react.css("align-items:center;box-sizing:border-box;display:flex;margin-right:", designSystem.designTokens.spacing10, ";cursor:pointer;transition:color ", designSystem.designTokens.transitionStandard, ",border-color ", designSystem.designTokens.transitionStandard, ";& svg *:not([fill='none']){fill:", designSystem.designTokens.iconColorForDatetimeInputIcon, ";}&:hover svg *{fill:", designSystem.designTokens.iconColorForDatetimeInputIconWhenHovered, ";}" + ("" ), "" );
|
|
197
154
|
};
|
|
198
155
|
|
|
199
|
-
|
|
156
|
+
const getIconBorderColor = (props, state) => {
|
|
200
157
|
if (props.isDisabled) {
|
|
201
158
|
return designSystem.designTokens.borderColorForInputWhenDisabled;
|
|
202
159
|
}
|
|
@@ -220,7 +177,7 @@ var getIconBorderColor = function getIconBorderColor(props, state) {
|
|
|
220
177
|
return designSystem.designTokens.borderColorForInput;
|
|
221
178
|
};
|
|
222
179
|
|
|
223
|
-
|
|
180
|
+
const getIconFontColor = props => {
|
|
224
181
|
if (props.isDisabled) {
|
|
225
182
|
return designSystem.designTokens.fontColorForInputWhenDisabled;
|
|
226
183
|
}
|
|
@@ -240,11 +197,11 @@ var getIconFontColor = function getIconFontColor(props) {
|
|
|
240
197
|
return 'initial';
|
|
241
198
|
};
|
|
242
199
|
|
|
243
|
-
|
|
200
|
+
const getCalendarIconContainerStyles = (props, state, isNewTheme) => {
|
|
244
201
|
return [/*#__PURE__*/react.css("align-items:center;box-sizing:border-box;background:none;border:0;border-top-right-radius:", designSystem.designTokens.borderRadiusForInput, ";border-bottom-right-radius:", designSystem.designTokens.borderRadiusForInput, ";border-color:", getIconBorderColor(props, state), ";color:", getIconFontColor(props), ";cursor:", props.isDisabled ? 'not-allowed' : 'default', ";height:100%;display:flex;padding:", designSystem.designTokens.spacing10, ";outline:0;transition:color ", designSystem.designTokens.transitionStandard, ",border-color ", designSystem.designTokens.transitionStandard, ";&:active,&:hover:not(:disabled)&:not(:read-only),&:focus{border-color:", designSystem.designTokens.borderColorForInputWhenFocused, ";}" + ("" ), "" ), !isNewTheme && /*#__PURE__*/react.css("border-left:1px solid ", getIconBorderColor(props, state), ";" + ("" ), "" )];
|
|
245
202
|
};
|
|
246
203
|
|
|
247
|
-
|
|
204
|
+
const getInputBorderColor = (props, state) => {
|
|
248
205
|
if (props.isDisabled) {
|
|
249
206
|
return designSystem.designTokens.borderColorForInputWhenDisabled;
|
|
250
207
|
}
|
|
@@ -268,7 +225,7 @@ var getInputBorderColor = function getInputBorderColor(props, state) {
|
|
|
268
225
|
return designSystem.designTokens.borderColorForInput;
|
|
269
226
|
};
|
|
270
227
|
|
|
271
|
-
|
|
228
|
+
const getInputFontColor = props => {
|
|
272
229
|
if (props.isDisabled) {
|
|
273
230
|
return designSystem.designTokens.fontColorForInputWhenDisabled;
|
|
274
231
|
}
|
|
@@ -288,7 +245,7 @@ var getInputFontColor = function getInputFontColor(props) {
|
|
|
288
245
|
return designSystem.designTokens.fontColorForInput;
|
|
289
246
|
};
|
|
290
247
|
|
|
291
|
-
|
|
248
|
+
const getInputContainerBackgroundColor = props => {
|
|
292
249
|
if (props.isDisabled) {
|
|
293
250
|
return designSystem.designTokens.backgroundColorForInputWhenDisabled;
|
|
294
251
|
}
|
|
@@ -300,7 +257,7 @@ var getInputContainerBackgroundColor = function getInputContainerBackgroundColor
|
|
|
300
257
|
return designSystem.designTokens.backgroundColorForInput;
|
|
301
258
|
};
|
|
302
259
|
|
|
303
|
-
|
|
260
|
+
const getInputContainerStyles = (props, state, isNewTheme) => {
|
|
304
261
|
return [/*#__PURE__*/react.css("appearance:none;background-color:", getInputContainerBackgroundColor(props), ";border:1px solid ", getInputBorderColor(props, state), ";border-radius:", designSystem.designTokens.borderRadiusForInput, ";box-sizing:border-box;color:", getInputFontColor(props), ";cursor:", props.isDisabled ? 'not-allowed' : 'default', ";width:100%;height:", designSystem.designTokens.heightForInput, ";align-items:center;display:flex;font-size:", designSystem.designTokens.fontSizeForInput, ";font-family:inherit;min-width:", designSystem.designTokens.constraint5, ";transition:border-color ", designSystem.designTokens.transitionStandard, ",box-shadow ", designSystem.designTokens.transitionStandard, ";&:hover:not(:focus){background-color:", !props.isDisabled && !props.isReadOnly ? designSystem.designTokens.backgroundColorForInputWhenHovered : null, ";}&:focus{border-color:", props.isDisabled || props.hasError || props.hasWarning || props.isReadOnly || (props.isOpen || state.isFocused) && !props.isReadOnly ? '' : designSystem.designTokens.borderColorForInputWhenFocused, ";}" + ("" ), "" ), !props.isReadOnly && /*#__PURE__*/react.css("&:focus-within{border-color:", designSystem.designTokens.borderColorForInputWhenFocused, ";box-shadow:", designSystem.designTokens.boxShadowForDatetimeInputWhenHovered, " ", designSystem.designTokens.borderColorForInputWhenFocused, ";&:hover{background-color:", designSystem.designTokens.colorSurface, ";}}" + ("" ), "" ), !isNewTheme && /*#__PURE__*/react.css("&:hover,&:hover>button,&:focus>button{border-color:", props.isDisabled || props.hasError || props.hasWarning || props.isReadOnly || (props.isOpen || state.isFocused) && !props.isReadOnly ? '' : designSystem.designTokens.borderColorForInputWhenFocused, ";}" + ("" ), "" ), isNewTheme && (props.hasError || props.hasWarning) && /*#__PURE__*/react.css("box-shadow:", designSystem.designTokens.boxShadowForDatetimeInputWhenHovered, ";" + ("" ), "" )];
|
|
305
262
|
};
|
|
306
263
|
|
|
@@ -309,15 +266,15 @@ var _ref$2 = {
|
|
|
309
266
|
styles: "border:none;background:none!important;&,&:focus:not(:read-only){box-shadow:none;}"
|
|
310
267
|
} ;
|
|
311
268
|
|
|
312
|
-
|
|
313
|
-
|
|
269
|
+
const getDateTimeInputStyles = props => {
|
|
270
|
+
const baseStyles = [inputUtils.getInputStyles(props), _ref$2];
|
|
314
271
|
return baseStyles;
|
|
315
272
|
};
|
|
316
273
|
|
|
317
274
|
function ownKeys$2(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
318
275
|
|
|
319
276
|
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys$2(Object(source), !0)).call(_context, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys$2(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
320
|
-
|
|
277
|
+
const ClearSection = props => {
|
|
321
278
|
return jsxRuntime.jsx(AccessibleButton__default["default"], {
|
|
322
279
|
css: getClearSectionStyles(),
|
|
323
280
|
label: "clear",
|
|
@@ -330,46 +287,46 @@ var ClearSection = function ClearSection(props) {
|
|
|
330
287
|
};
|
|
331
288
|
ClearSection.propTypes = {};
|
|
332
289
|
ClearSection.displayName = 'ClearSection';
|
|
333
|
-
|
|
290
|
+
const defaultProps = {
|
|
334
291
|
isClearable: true
|
|
335
292
|
};
|
|
336
|
-
|
|
293
|
+
const CalendarBody = props => {
|
|
337
294
|
var _props$inputProps, _props$inputProps2, _props$toggleButtonPr, _props$toggleButtonPr2, _props$inputProps3;
|
|
338
295
|
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
296
|
+
const _useToggleState = hooks.useToggleState(false),
|
|
297
|
+
_useToggleState2 = _slicedToArray(_useToggleState, 2),
|
|
298
|
+
isFocused = _useToggleState2[0],
|
|
299
|
+
toggleIsFocused = _useToggleState2[1];
|
|
343
300
|
|
|
344
|
-
|
|
345
|
-
|
|
301
|
+
const _useTheme = designSystem.useTheme(),
|
|
302
|
+
isNewTheme = _useTheme.isNewTheme;
|
|
346
303
|
|
|
347
|
-
|
|
348
|
-
|
|
304
|
+
const onInputFocus = (_props$inputProps = props.inputProps) === null || _props$inputProps === void 0 ? void 0 : _props$inputProps.onFocus;
|
|
305
|
+
const handleInputFocus = react$1.useCallback(event => {
|
|
349
306
|
toggleIsFocused(true);
|
|
350
307
|
if (onInputFocus) onInputFocus(event);
|
|
351
308
|
}, [onInputFocus, toggleIsFocused]);
|
|
352
|
-
|
|
353
|
-
|
|
309
|
+
const onInputBlur = (_props$inputProps2 = props.inputProps) === null || _props$inputProps2 === void 0 ? void 0 : _props$inputProps2.onBlur;
|
|
310
|
+
const handleInputBlur = react$1.useCallback(event => {
|
|
354
311
|
toggleIsFocused(false);
|
|
355
312
|
if (onInputBlur) onInputBlur(event);
|
|
356
313
|
}, [onInputBlur, toggleIsFocused]);
|
|
357
|
-
|
|
358
|
-
|
|
314
|
+
const onToggleFocus = (_props$toggleButtonPr = props.toggleButtonProps) === null || _props$toggleButtonPr === void 0 ? void 0 : _props$toggleButtonPr.onFocus;
|
|
315
|
+
const handleToggleFocus = react$1.useCallback(event => {
|
|
359
316
|
toggleIsFocused(true);
|
|
360
317
|
if (onToggleFocus) onToggleFocus(event);
|
|
361
318
|
}, [onToggleFocus, toggleIsFocused]);
|
|
362
|
-
|
|
363
|
-
|
|
319
|
+
const onToggleBlur = (_props$toggleButtonPr2 = props.toggleButtonProps) === null || _props$toggleButtonPr2 === void 0 ? void 0 : _props$toggleButtonPr2.onBlur;
|
|
320
|
+
const handleToggleBlur = react$1.useCallback(event => {
|
|
364
321
|
toggleIsFocused(false);
|
|
365
322
|
if (onToggleBlur) onToggleBlur(event);
|
|
366
323
|
}, [onToggleBlur, toggleIsFocused]);
|
|
367
|
-
|
|
324
|
+
const disabledOrReadOnly = props.isDisabled || props.isReadOnly;
|
|
368
325
|
return jsxRuntime.jsx(Inline__default["default"], {
|
|
369
326
|
alignItems: "center",
|
|
370
327
|
children: jsxRuntime.jsxs("div", {
|
|
371
328
|
css: getInputContainerStyles(props, {
|
|
372
|
-
isFocused
|
|
329
|
+
isFocused
|
|
373
330
|
}, isNewTheme),
|
|
374
331
|
children: [jsxRuntime.jsx("input", _objectSpread$2(_objectSpread$2({
|
|
375
332
|
ref: props.inputRef
|
|
@@ -389,7 +346,7 @@ var CalendarBody = function CalendarBody(props) {
|
|
|
389
346
|
}), jsxRuntime.jsx("button", _objectSpread$2(_objectSpread$2({
|
|
390
347
|
type: "button",
|
|
391
348
|
css: getCalendarIconContainerStyles(props, {
|
|
392
|
-
isFocused
|
|
349
|
+
isFocused
|
|
393
350
|
}, isNewTheme)
|
|
394
351
|
}, props.toggleButtonProps), {}, {
|
|
395
352
|
onFocus: handleToggleFocus,
|
|
@@ -413,7 +370,7 @@ CalendarBody.displayName = 'CalendarBody';
|
|
|
413
370
|
CalendarBody.defaultProps = defaultProps;
|
|
414
371
|
var CalendarBody$1 = CalendarBody;
|
|
415
372
|
|
|
416
|
-
|
|
373
|
+
const CalendarContent = /*#__PURE__*/_styled__default["default"]("ul", {
|
|
417
374
|
target: "e17zfb0v0"
|
|
418
375
|
} )({
|
|
419
376
|
name: "1en5ct5",
|
|
@@ -422,16 +379,16 @@ var CalendarContent = /*#__PURE__*/_styled__default["default"]("ul", {
|
|
|
422
379
|
|
|
423
380
|
var CalendarContent$1 = CalendarContent;
|
|
424
381
|
|
|
425
|
-
|
|
382
|
+
const _excluded$1 = ["isHighlighted", "isSelected", "isRangeStart", "isRangeBetween", "isRangeEnd", "isToday"];
|
|
426
383
|
|
|
427
384
|
function ownKeys$1(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
428
385
|
|
|
429
386
|
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var _context3, _context4; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty__default["default"](_context3 = ownKeys$1(Object(source), !0)).call(_context3, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)) : _forEachInstanceProperty__default["default"](_context4 = ownKeys$1(Object(source))).call(_context4, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
430
387
|
|
|
431
|
-
|
|
388
|
+
const getStyles = props => {
|
|
432
389
|
var _context, _context2;
|
|
433
390
|
|
|
434
|
-
|
|
391
|
+
const styles = [];
|
|
435
392
|
|
|
436
393
|
if (!_includesInstanceProperty__default["default"](_context = ['heading', 'spacing']).call(_context, props.type || '')) {
|
|
437
394
|
styles.push( /*#__PURE__*/react.css("text-align:center;padding:", designSystem.designTokens.spacing20, " 0;cursor:default;border-radius:", designSystem.designTokens.borderRadius4, ";" + ("" ), "" ));
|
|
@@ -473,14 +430,14 @@ var _ref$1 = {
|
|
|
473
430
|
styles: "list-style-type:none;display:inline-block;margin:2px 1%;width:12%"
|
|
474
431
|
} ;
|
|
475
432
|
|
|
476
|
-
|
|
433
|
+
const CalendarDay = props => {
|
|
477
434
|
props.isHighlighted;
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
435
|
+
props.isSelected;
|
|
436
|
+
props.isRangeStart;
|
|
437
|
+
props.isRangeBetween;
|
|
438
|
+
props.isRangeEnd;
|
|
439
|
+
props.isToday;
|
|
440
|
+
const rest = _objectWithoutProperties(props, _excluded$1);
|
|
484
441
|
|
|
485
442
|
return jsxRuntime.jsx("li", {
|
|
486
443
|
css: _ref$1,
|
|
@@ -522,19 +479,19 @@ var messages = reactIntl.defineMessages({
|
|
|
522
479
|
}
|
|
523
480
|
});
|
|
524
481
|
|
|
525
|
-
|
|
482
|
+
const WrapperComponent = /*#__PURE__*/_styled__default["default"]("div", {
|
|
526
483
|
target: "e1q1nv850"
|
|
527
484
|
} )({
|
|
528
485
|
name: "zjik7",
|
|
529
486
|
styles: "display:flex"
|
|
530
487
|
} );
|
|
531
488
|
|
|
532
|
-
|
|
533
|
-
|
|
489
|
+
const CalendarHeader = props => {
|
|
490
|
+
const intl = reactIntl.useIntl(); // https://codepen.io/mudassir0909/pen/eIHqB
|
|
534
491
|
// we prevent all our defined onClicks inside of the CalendarHeader
|
|
535
492
|
// from blurring our input.
|
|
536
493
|
|
|
537
|
-
|
|
494
|
+
const onMouseDown = react$1.useCallback(event => {
|
|
538
495
|
event.preventDefault();
|
|
539
496
|
}, []);
|
|
540
497
|
return jsxRuntime.jsxs("div", {
|
|
@@ -546,7 +503,7 @@ var CalendarHeader = function CalendarHeader(props) {
|
|
|
546
503
|
children: [jsxRuntime.jsx(Tooltip__default["default"], {
|
|
547
504
|
title: intl.formatMessage(messages.previousMonthTooltip),
|
|
548
505
|
components: {
|
|
549
|
-
WrapperComponent
|
|
506
|
+
WrapperComponent
|
|
550
507
|
},
|
|
551
508
|
children: jsxRuntime.jsx(SecondaryIconButton__default["default"], {
|
|
552
509
|
label: "show prev month",
|
|
@@ -557,7 +514,7 @@ var CalendarHeader = function CalendarHeader(props) {
|
|
|
557
514
|
}), jsxRuntime.jsx(Tooltip__default["default"], {
|
|
558
515
|
title: intl.formatMessage(messages.todayTooltip),
|
|
559
516
|
components: {
|
|
560
|
-
WrapperComponent
|
|
517
|
+
WrapperComponent
|
|
561
518
|
},
|
|
562
519
|
children: jsxRuntime.jsx(SecondaryIconButton__default["default"], {
|
|
563
520
|
label: "show today",
|
|
@@ -568,7 +525,7 @@ var CalendarHeader = function CalendarHeader(props) {
|
|
|
568
525
|
}), jsxRuntime.jsx(Tooltip__default["default"], {
|
|
569
526
|
title: intl.formatMessage(messages.nextMonthTooltip),
|
|
570
527
|
components: {
|
|
571
|
-
WrapperComponent
|
|
528
|
+
WrapperComponent
|
|
572
529
|
},
|
|
573
530
|
children: jsxRuntime.jsx(SecondaryIconButton__default["default"], {
|
|
574
531
|
label: "show next month",
|
|
@@ -587,7 +544,7 @@ var CalendarHeader = function CalendarHeader(props) {
|
|
|
587
544
|
children: [jsxRuntime.jsx(Tooltip__default["default"], {
|
|
588
545
|
title: intl.formatMessage(messages.previousYearTooltip),
|
|
589
546
|
components: {
|
|
590
|
-
WrapperComponent
|
|
547
|
+
WrapperComponent
|
|
591
548
|
},
|
|
592
549
|
children: jsxRuntime.jsx(SecondaryIconButton__default["default"], {
|
|
593
550
|
label: "show prev year",
|
|
@@ -601,7 +558,7 @@ var CalendarHeader = function CalendarHeader(props) {
|
|
|
601
558
|
}), jsxRuntime.jsx(Tooltip__default["default"], {
|
|
602
559
|
title: intl.formatMessage(messages.nextYearTooltip),
|
|
603
560
|
components: {
|
|
604
|
-
WrapperComponent
|
|
561
|
+
WrapperComponent
|
|
605
562
|
},
|
|
606
563
|
children: jsxRuntime.jsx(SecondaryIconButton__default["default"], {
|
|
607
564
|
label: "show next year",
|
|
@@ -618,7 +575,7 @@ CalendarHeader.propTypes = {};
|
|
|
618
575
|
CalendarHeader.displayName = 'CalendarHeader';
|
|
619
576
|
var CalendarHeader$1 = CalendarHeader;
|
|
620
577
|
|
|
621
|
-
|
|
578
|
+
const _excluded = ["hasFooter", "hasWarning", "hasError"];
|
|
622
579
|
|
|
623
580
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); enumerableOnly && (symbols = _filterInstanceProperty__default["default"](symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor__default["default"](object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
624
581
|
|
|
@@ -633,7 +590,7 @@ var _ref = {
|
|
|
633
590
|
styles: "padding-bottom:10px"
|
|
634
591
|
} ;
|
|
635
592
|
|
|
636
|
-
|
|
593
|
+
let CalendarMenu = /*#__PURE__*/function (_Component) {
|
|
637
594
|
_inherits(CalendarMenu, _Component);
|
|
638
595
|
|
|
639
596
|
var _super = _createSuper(CalendarMenu);
|
|
@@ -647,11 +604,11 @@ var CalendarMenu = /*#__PURE__*/function (_Component) {
|
|
|
647
604
|
_createClass(CalendarMenu, [{
|
|
648
605
|
key: "render",
|
|
649
606
|
value: function render() {
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
607
|
+
const _this$props = this.props,
|
|
608
|
+
hasFooter = _this$props.hasFooter,
|
|
609
|
+
hasWarning = _this$props.hasWarning,
|
|
610
|
+
hasError = _this$props.hasError,
|
|
611
|
+
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
655
612
|
|
|
656
613
|
return jsxRuntime.jsxs("div", _objectSpread(_objectSpread({}, rest), {}, {
|
|
657
614
|
css: [/*#__PURE__*/react.css("overflow-y:scroll;color:", designSystem.designTokens.colorSolid, ";font-family:inherit;border:", designSystem.designTokens.borderForCalendarMenuWhenFocused, ";box-shadow:", designSystem.designTokens.boxShadowForCalendarMenuWhenFocused, ";border-radius:", designSystem.designTokens.borderRadiusForInput, ";margin-top:", designSystem.designTokens.spacing10, ";font-size:", designSystem.designTokens.fontSizeDefault, ";position:absolute;box-sizing:border-box;width:100%;background-color:", designSystem.designTokens.colorSurface, ";min-width:", designSystem.designTokens.constraint5, ";z-index:99999;" + ("" ), "" ), !hasFooter && _ref, hasError && /*#__PURE__*/react.css("border-color:", designSystem.designTokens.borderColorForInputWhenError, ";" + ("" ), "" ), hasWarning && /*#__PURE__*/react.css("border-color:", designSystem.designTokens.borderColorForInputWhenWarning, ";" + ("" ), "" ), "" , "" ],
|
|
@@ -667,7 +624,7 @@ CalendarMenu.displayName = 'CalendarMenu';
|
|
|
667
624
|
CalendarMenu.propTypes = {};
|
|
668
625
|
|
|
669
626
|
// NOTE: This string will be replaced on build time with the package version.
|
|
670
|
-
var version = "15.15.
|
|
627
|
+
var version = "15.15.1";
|
|
671
628
|
|
|
672
629
|
exports.CalendarBody = CalendarBody$1;
|
|
673
630
|
exports.CalendarContent = CalendarContent$1;
|