@commercetools-uikit/calendar-utils 16.0.0 → 16.1.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.dev.js +31 -111
- package/dist/commercetools-uikit-calendar-utils.cjs.prod.js +29 -104
- package/dist/commercetools-uikit-calendar-utils.esm.js +31 -111
- package/dist/declarations/src/calendar-body/calendar-body.styles.d.ts +2 -2
- package/package.json +12 -12
|
@@ -20,12 +20,12 @@ var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
|
20
20
|
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
21
21
|
require('prop-types');
|
|
22
22
|
var react$1 = require('react');
|
|
23
|
-
var designSystem = require('@commercetools-uikit/design-system');
|
|
24
23
|
var icons = require('@commercetools-uikit/icons');
|
|
25
24
|
var Inline = require('@commercetools-uikit/spacings-inline');
|
|
26
25
|
var hooks = require('@commercetools-uikit/hooks');
|
|
27
26
|
var AccessibleButton = require('@commercetools-uikit/accessible-button');
|
|
28
27
|
var react = require('@emotion/react');
|
|
28
|
+
var designSystem = require('@commercetools-uikit/design-system');
|
|
29
29
|
var inputUtils = require('@commercetools-uikit/input-utils');
|
|
30
30
|
var jsxRuntime = require('@emotion/react/jsx-runtime');
|
|
31
31
|
var _styled = require('@emotion/styled/base');
|
|
@@ -76,8 +76,9 @@ const getNextDay = day => moment__default["default"](day).add(1, 'day').format('
|
|
|
76
76
|
const getPreviousDay = day => moment__default["default"](day).subtract(1, 'day').format('YYYY-MM-DD');
|
|
77
77
|
const getPaddingDayCount = (day, locale) => {
|
|
78
78
|
const firstDayOfWeek = moment__default["default"].localeData(locale).firstDayOfWeek();
|
|
79
|
-
const firstDayOfMonth = moment__default["default"](day).startOf('month').day();
|
|
79
|
+
const firstDayOfMonth = moment__default["default"](day).startOf('month').day();
|
|
80
80
|
|
|
81
|
+
// ensure number is always positive
|
|
81
82
|
return (firstDayOfMonth - firstDayOfWeek + 7) % 7;
|
|
82
83
|
};
|
|
83
84
|
const getWeekdayNames = locale => {
|
|
@@ -95,12 +96,9 @@ const isBetween = (item, start, end) => {
|
|
|
95
96
|
const endDate = moment__default["default"](end);
|
|
96
97
|
return itemDate.isBetween(startDate, endDate) || itemDate.isBetween(endDate, startDate);
|
|
97
98
|
};
|
|
98
|
-
|
|
99
99
|
const changeDateInMonth = (day, dayOfMonth) => moment__default["default"](day).date(dayOfMonth).format('YYYY-MM-DD');
|
|
100
|
-
|
|
101
100
|
const createCalendarItems = day => {
|
|
102
101
|
var _context;
|
|
103
|
-
|
|
104
102
|
return _mapInstanceProperty__default["default"](_context = _Array$from__default["default"]({
|
|
105
103
|
length: getDaysInMonth(day)
|
|
106
104
|
})).call(_context, (_, i) => {
|
|
@@ -113,7 +111,6 @@ const createItemRangeToString = locale => item => _Array$isArray__default["defau
|
|
|
113
111
|
const createItemToString = locale => item => item ? formatDate(item, locale) : '';
|
|
114
112
|
const formatRange = (range, locale) => {
|
|
115
113
|
var _context2;
|
|
116
|
-
|
|
117
114
|
return _mapInstanceProperty__default["default"](_context2 = _sortInstanceProperty__default["default"](range).call(range)).call(_context2, item => formatDate(item, locale)).join(' - ');
|
|
118
115
|
};
|
|
119
116
|
const parseInputToDate = (text, locale) => {
|
|
@@ -123,19 +120,15 @@ const parseInputToDate = (text, locale) => {
|
|
|
123
120
|
};
|
|
124
121
|
const getIsDateInRange = (item, min, max) => {
|
|
125
122
|
const itemDate = moment__default["default"](item);
|
|
126
|
-
|
|
127
123
|
if (min && max) {
|
|
128
124
|
return itemDate.isBetween(min, max, null, '[]');
|
|
129
125
|
}
|
|
130
|
-
|
|
131
126
|
if (min && !max) {
|
|
132
127
|
return itemDate.isSameOrAfter(min);
|
|
133
128
|
}
|
|
134
|
-
|
|
135
129
|
if (!min && max) {
|
|
136
130
|
return itemDate.isSameOrBefore(max);
|
|
137
131
|
}
|
|
138
|
-
|
|
139
132
|
return true;
|
|
140
133
|
};
|
|
141
134
|
const getExampleDateStrings = () => ({
|
|
@@ -152,127 +145,97 @@ const getExampleDateStrings = () => ({
|
|
|
152
145
|
const getClearSectionStyles = () => {
|
|
153
146
|
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, ";}" + ("" ), "" );
|
|
154
147
|
};
|
|
155
|
-
|
|
156
148
|
const getIconBorderColor = (props, state) => {
|
|
157
149
|
if (props.isDisabled) {
|
|
158
150
|
return designSystem.designTokens.borderColorForInputWhenDisabled;
|
|
159
151
|
}
|
|
160
|
-
|
|
161
152
|
if (props.hasError) {
|
|
162
153
|
return designSystem.designTokens.borderColorForInputWhenError;
|
|
163
154
|
}
|
|
164
|
-
|
|
165
155
|
if (props.hasWarning) {
|
|
166
156
|
return designSystem.designTokens.borderColorForInputWhenWarning;
|
|
167
157
|
}
|
|
168
|
-
|
|
169
158
|
if (props.isReadOnly) {
|
|
170
159
|
return designSystem.designTokens.borderColorForInputWhenReadonly;
|
|
171
160
|
}
|
|
172
|
-
|
|
173
161
|
if (props.isOpen || state.isFocused) {
|
|
174
162
|
return designSystem.designTokens.borderColorForInputWhenFocused;
|
|
175
163
|
}
|
|
176
|
-
|
|
177
164
|
return designSystem.designTokens.borderColorForInput;
|
|
178
165
|
};
|
|
179
|
-
|
|
180
166
|
const getIconFontColor = props => {
|
|
181
167
|
if (props.isDisabled) {
|
|
182
168
|
return designSystem.designTokens.fontColorForInputWhenDisabled;
|
|
183
169
|
}
|
|
184
|
-
|
|
185
170
|
if (props.hasError) {
|
|
186
171
|
return designSystem.designTokens.fontColorForInputWhenError;
|
|
187
172
|
}
|
|
188
|
-
|
|
189
173
|
if (props.hasWarning) {
|
|
190
174
|
return designSystem.designTokens.fontColorForInputWhenWarning;
|
|
191
175
|
}
|
|
192
|
-
|
|
193
176
|
if (props.isReadOnly) {
|
|
194
177
|
return designSystem.designTokens.fontColorForInputWhenReadonly;
|
|
195
178
|
}
|
|
196
|
-
|
|
197
179
|
return 'initial';
|
|
198
180
|
};
|
|
199
|
-
|
|
200
|
-
|
|
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), ";" + ("" ), "" )];
|
|
181
|
+
const getCalendarIconContainerStyles = (props, state) => {
|
|
182
|
+
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, ";}" + ("" ), "" )];
|
|
202
183
|
};
|
|
203
|
-
|
|
204
184
|
const getInputBorderColor = (props, state) => {
|
|
205
185
|
if (props.isDisabled) {
|
|
206
186
|
return designSystem.designTokens.borderColorForInputWhenDisabled;
|
|
207
187
|
}
|
|
208
|
-
|
|
209
188
|
if (props.hasError) {
|
|
210
189
|
return designSystem.designTokens.borderColorForInputWhenError;
|
|
211
190
|
}
|
|
212
|
-
|
|
213
191
|
if (props.hasWarning) {
|
|
214
192
|
return designSystem.designTokens.borderColorForInputWhenWarning;
|
|
215
193
|
}
|
|
216
|
-
|
|
217
194
|
if (props.isReadOnly) {
|
|
218
195
|
return designSystem.designTokens.borderColorForInputWhenReadonly;
|
|
219
196
|
}
|
|
220
|
-
|
|
221
197
|
if ((props.isOpen || state.isFocused) && !props.isReadOnly) {
|
|
222
198
|
return designSystem.designTokens.borderColorForInputWhenFocused;
|
|
223
199
|
}
|
|
224
|
-
|
|
225
200
|
return designSystem.designTokens.borderColorForInput;
|
|
226
201
|
};
|
|
227
|
-
|
|
228
202
|
const getInputFontColor = props => {
|
|
229
203
|
if (props.isDisabled) {
|
|
230
204
|
return designSystem.designTokens.fontColorForInputWhenDisabled;
|
|
231
205
|
}
|
|
232
|
-
|
|
233
206
|
if (props.hasError) {
|
|
234
207
|
return designSystem.designTokens.fontColorForInputWhenError;
|
|
235
208
|
}
|
|
236
|
-
|
|
237
209
|
if (props.hasWarning) {
|
|
238
210
|
return designSystem.designTokens.fontColorForInputWhenWarning;
|
|
239
211
|
}
|
|
240
|
-
|
|
241
212
|
if (props.isReadOnly) {
|
|
242
213
|
return designSystem.designTokens.fontColorForInputWhenReadonly;
|
|
243
214
|
}
|
|
244
|
-
|
|
245
215
|
return designSystem.designTokens.fontColorForInput;
|
|
246
216
|
};
|
|
247
|
-
|
|
248
217
|
const getInputContainerBackgroundColor = props => {
|
|
249
218
|
if (props.isDisabled) {
|
|
250
219
|
return designSystem.designTokens.backgroundColorForInputWhenDisabled;
|
|
251
220
|
}
|
|
252
|
-
|
|
253
221
|
if (props.isReadOnly) {
|
|
254
222
|
return designSystem.designTokens.backgroundColorForInputWhenReadonly;
|
|
255
223
|
}
|
|
256
|
-
|
|
257
224
|
return designSystem.designTokens.backgroundColorForInput;
|
|
258
225
|
};
|
|
259
|
-
|
|
260
|
-
|
|
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, ";" + ("" ), "" )];
|
|
226
|
+
const getInputContainerStyles = (props, state) => {
|
|
227
|
+
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, ";}}" + ("" ), "" ), (props.hasError || props.hasWarning) && /*#__PURE__*/react.css("box-shadow:", designSystem.designTokens.boxShadowForDatetimeInputWhenHovered, ";" + ("" ), "" )];
|
|
262
228
|
};
|
|
263
|
-
|
|
264
229
|
var _ref$2 = {
|
|
265
230
|
name: "1wj7icd",
|
|
266
231
|
styles: "border:none;background:none!important;&,&:focus:not(:read-only){box-shadow:none;}"
|
|
267
232
|
} ;
|
|
268
|
-
|
|
269
233
|
const getDateTimeInputStyles = props => {
|
|
270
234
|
const baseStyles = [inputUtils.getInputStyles(props), _ref$2];
|
|
271
235
|
return baseStyles;
|
|
272
236
|
};
|
|
273
237
|
|
|
274
238
|
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; }
|
|
275
|
-
|
|
276
239
|
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; }
|
|
277
240
|
const ClearSection = props => {
|
|
278
241
|
return jsxRuntime.jsx(AccessibleButton__default["default"], {
|
|
@@ -292,15 +255,10 @@ const defaultProps = {
|
|
|
292
255
|
};
|
|
293
256
|
const CalendarBody = props => {
|
|
294
257
|
var _props$inputProps, _props$inputProps2, _props$toggleButtonPr, _props$toggleButtonPr2, _props$inputProps3;
|
|
295
|
-
|
|
296
258
|
const _useToggleState = hooks.useToggleState(false),
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
const _useTheme = designSystem.useTheme(),
|
|
302
|
-
isNewTheme = _useTheme.isNewTheme;
|
|
303
|
-
|
|
259
|
+
_useToggleState2 = _slicedToArray(_useToggleState, 2),
|
|
260
|
+
isFocused = _useToggleState2[0],
|
|
261
|
+
toggleIsFocused = _useToggleState2[1];
|
|
304
262
|
const onInputFocus = (_props$inputProps = props.inputProps) === null || _props$inputProps === void 0 ? void 0 : _props$inputProps.onFocus;
|
|
305
263
|
const handleInputFocus = react$1.useCallback(event => {
|
|
306
264
|
toggleIsFocused(true);
|
|
@@ -327,7 +285,7 @@ const CalendarBody = props => {
|
|
|
327
285
|
children: jsxRuntime.jsxs("div", {
|
|
328
286
|
css: getInputContainerStyles(props, {
|
|
329
287
|
isFocused
|
|
330
|
-
}
|
|
288
|
+
}),
|
|
331
289
|
children: [jsxRuntime.jsx("input", _objectSpread$2(_objectSpread$2({
|
|
332
290
|
ref: props.inputRef
|
|
333
291
|
}, props.inputProps), {}, {
|
|
@@ -347,19 +305,18 @@ const CalendarBody = props => {
|
|
|
347
305
|
type: "button",
|
|
348
306
|
css: getCalendarIconContainerStyles(props, {
|
|
349
307
|
isFocused
|
|
350
|
-
}
|
|
308
|
+
})
|
|
351
309
|
}, props.toggleButtonProps), {}, {
|
|
352
310
|
onFocus: handleToggleFocus,
|
|
353
311
|
onBlur: handleToggleBlur,
|
|
354
312
|
disabled: disabledOrReadOnly,
|
|
355
313
|
onKeyDown: (_props$inputProps3 = props.inputProps) === null || _props$inputProps3 === void 0 ? void 0 : _props$inputProps3.onKeyDown
|
|
356
|
-
/* keyboard users don't need this button
|
|
357
|
-
,
|
|
314
|
+
/* keyboard users don't need this button */,
|
|
358
315
|
tabIndex: -1,
|
|
359
316
|
children: props.icon === 'clock' ? jsxRuntime.jsx(icons.ClockIcon, {
|
|
360
|
-
color:
|
|
317
|
+
color: "neutral60"
|
|
361
318
|
}) : jsxRuntime.jsx(icons.CalendarIcon, {
|
|
362
|
-
color:
|
|
319
|
+
color: "neutral60"
|
|
363
320
|
})
|
|
364
321
|
}))]
|
|
365
322
|
})
|
|
@@ -376,69 +333,52 @@ const CalendarContent = /*#__PURE__*/_styled__default["default"]("ul", {
|
|
|
376
333
|
name: "1en5ct5",
|
|
377
334
|
styles: "margin:0;padding:0 1%"
|
|
378
335
|
} );
|
|
379
|
-
|
|
380
336
|
var CalendarContent$1 = CalendarContent;
|
|
381
337
|
|
|
382
338
|
const _excluded$1 = ["isHighlighted", "isSelected", "isRangeStart", "isRangeBetween", "isRangeEnd", "isToday"];
|
|
383
|
-
|
|
384
339
|
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; }
|
|
385
|
-
|
|
386
340
|
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; }
|
|
387
|
-
|
|
388
341
|
const getStyles = props => {
|
|
389
342
|
var _context, _context2;
|
|
390
|
-
|
|
391
343
|
const styles = [];
|
|
392
|
-
|
|
393
344
|
if (!_includesInstanceProperty__default["default"](_context = ['heading', 'spacing']).call(_context, props.type || '')) {
|
|
394
345
|
styles.push( /*#__PURE__*/react.css("text-align:center;padding:", designSystem.designTokens.spacing20, " 0;cursor:default;border-radius:", designSystem.designTokens.borderRadius4, ";" + ("" ), "" ));
|
|
395
346
|
}
|
|
396
|
-
|
|
397
347
|
if (_includesInstanceProperty__default["default"](_context2 = ['heading', 'spacing']).call(_context2, props.type || '')) {
|
|
398
348
|
styles.push( /*#__PURE__*/react.css("text-align:center;padding:", designSystem.designTokens.spacing20, " 0;cursor:default;color:", designSystem.designTokens.colorNeutral60, ";" + ("" ), "" ));
|
|
399
349
|
}
|
|
400
|
-
|
|
401
350
|
if (props.isHighlighted) {
|
|
402
351
|
styles.push( /*#__PURE__*/react.css("background-color:", designSystem.designTokens.colorNeutral90, ";" + ("" ), "" ));
|
|
403
352
|
}
|
|
404
|
-
|
|
405
353
|
if (props.isSelected) {
|
|
406
354
|
styles.push( /*#__PURE__*/react.css("background-color:", designSystem.designTokens.colorPrimary, ";color:", designSystem.designTokens.colorSurface, ";" + ("" ), "" ));
|
|
407
355
|
}
|
|
408
|
-
|
|
409
356
|
if (props.isRangeStart || props.isRangeEnd) {
|
|
410
357
|
styles.push( /*#__PURE__*/react.css("background-color:", designSystem.designTokens.colorPrimary40, ";color:", designSystem.designTokens.colorSurface, ";" + ("" ), "" ));
|
|
411
358
|
}
|
|
412
|
-
|
|
413
359
|
if (props.isRangeBetween) {
|
|
414
360
|
styles.push( /*#__PURE__*/react.css("background-color:", designSystem.designTokens.colorNeutral90, ";color:", designSystem.designTokens.fontColorForInput, ";" + ("" ), "" ));
|
|
415
361
|
}
|
|
416
|
-
|
|
417
362
|
if (!props.isSelected && !props.isRangeStart && !props.isRangeEnd && props.isToday) {
|
|
418
363
|
styles.push( /*#__PURE__*/react.css("color:", designSystem.designTokens.colorInfo, ";font-weight:bold;" + ("" ), "" ));
|
|
419
364
|
}
|
|
420
|
-
|
|
421
365
|
if (props.disabled) {
|
|
422
366
|
styles.push( /*#__PURE__*/react.css("color:", designSystem.designTokens.fontColorForInputWhenDisabled, ";cursor:not-allowed;" + ("" ), "" ));
|
|
423
367
|
}
|
|
424
|
-
|
|
425
368
|
return styles;
|
|
426
369
|
};
|
|
427
|
-
|
|
428
370
|
var _ref$1 = {
|
|
429
371
|
name: "9xt9sg",
|
|
430
372
|
styles: "list-style-type:none;display:inline-block;margin:2px 1%;width:12%"
|
|
431
373
|
} ;
|
|
432
|
-
|
|
433
374
|
const CalendarDay = props => {
|
|
434
375
|
props.isHighlighted;
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
376
|
+
props.isSelected;
|
|
377
|
+
props.isRangeStart;
|
|
378
|
+
props.isRangeBetween;
|
|
379
|
+
props.isRangeEnd;
|
|
380
|
+
props.isToday;
|
|
381
|
+
const rest = _objectWithoutProperties(props, _excluded$1);
|
|
442
382
|
return jsxRuntime.jsx("li", {
|
|
443
383
|
css: _ref$1,
|
|
444
384
|
children: jsxRuntime.jsx("div", _objectSpread$1({
|
|
@@ -446,7 +386,6 @@ const CalendarDay = props => {
|
|
|
446
386
|
}, rest))
|
|
447
387
|
});
|
|
448
388
|
};
|
|
449
|
-
|
|
450
389
|
CalendarDay.propTypes = {};
|
|
451
390
|
CalendarDay.displayName = 'CalendarDay';
|
|
452
391
|
var CalendarDay$1 = CalendarDay;
|
|
@@ -485,12 +424,12 @@ const WrapperComponent = /*#__PURE__*/_styled__default["default"]("div", {
|
|
|
485
424
|
name: "zjik7",
|
|
486
425
|
styles: "display:flex"
|
|
487
426
|
} );
|
|
488
|
-
|
|
489
427
|
const CalendarHeader = props => {
|
|
490
|
-
const intl = reactIntl.useIntl();
|
|
428
|
+
const intl = reactIntl.useIntl();
|
|
429
|
+
// https://codepen.io/mudassir0909/pen/eIHqB
|
|
430
|
+
|
|
491
431
|
// we prevent all our defined onClicks inside of the CalendarHeader
|
|
492
432
|
// from blurring our input.
|
|
493
|
-
|
|
494
433
|
const onMouseDown = react$1.useCallback(event => {
|
|
495
434
|
event.preventDefault();
|
|
496
435
|
}, []);
|
|
@@ -570,61 +509,47 @@ const CalendarHeader = props => {
|
|
|
570
509
|
})]
|
|
571
510
|
});
|
|
572
511
|
};
|
|
573
|
-
|
|
574
512
|
CalendarHeader.propTypes = {};
|
|
575
513
|
CalendarHeader.displayName = 'CalendarHeader';
|
|
576
514
|
var CalendarHeader$1 = CalendarHeader;
|
|
577
515
|
|
|
578
516
|
const _excluded = ["hasFooter", "hasWarning", "hasError"];
|
|
579
|
-
|
|
580
517
|
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; }
|
|
581
|
-
|
|
582
518
|
function _objectSpread(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(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(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } return target; }
|
|
583
|
-
|
|
584
519
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct__default["default"](Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
585
|
-
|
|
586
520
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct__default["default"]) return false; if (_Reflect$construct__default["default"].sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct__default["default"](Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
587
|
-
|
|
588
521
|
var _ref = {
|
|
589
522
|
name: "1yaiq4p",
|
|
590
523
|
styles: "padding-bottom:10px"
|
|
591
524
|
} ;
|
|
592
|
-
|
|
593
525
|
let CalendarMenu = /*#__PURE__*/function (_Component) {
|
|
594
526
|
_inherits(CalendarMenu, _Component);
|
|
595
|
-
|
|
596
527
|
var _super = _createSuper(CalendarMenu);
|
|
597
|
-
|
|
598
528
|
function CalendarMenu() {
|
|
599
529
|
_classCallCheck(this, CalendarMenu);
|
|
600
|
-
|
|
601
530
|
return _super.apply(this, arguments);
|
|
602
531
|
}
|
|
603
|
-
|
|
604
532
|
_createClass(CalendarMenu, [{
|
|
605
533
|
key: "render",
|
|
606
534
|
value: function render() {
|
|
607
535
|
const _this$props = this.props,
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
536
|
+
hasFooter = _this$props.hasFooter,
|
|
537
|
+
hasWarning = _this$props.hasWarning,
|
|
538
|
+
hasError = _this$props.hasError,
|
|
539
|
+
rest = _objectWithoutProperties(_this$props, _excluded);
|
|
613
540
|
return jsxRuntime.jsxs("div", _objectSpread(_objectSpread({}, rest), {}, {
|
|
614
541
|
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, ";" + ("" ), "" ), "" , "" ],
|
|
615
542
|
children: [this.props.children, this.props.footer]
|
|
616
543
|
}));
|
|
617
544
|
}
|
|
618
545
|
}]);
|
|
619
|
-
|
|
620
546
|
return CalendarMenu;
|
|
621
547
|
}(react$1.Component);
|
|
622
|
-
|
|
623
548
|
CalendarMenu.displayName = 'CalendarMenu';
|
|
624
549
|
CalendarMenu.propTypes = {};
|
|
625
550
|
|
|
626
551
|
// NOTE: This string will be replaced on build time with the package version.
|
|
627
|
-
var version = "16.
|
|
552
|
+
var version = "16.1.1";
|
|
628
553
|
|
|
629
554
|
exports.CalendarBody = CalendarBody$1;
|
|
630
555
|
exports.CalendarContent = CalendarContent$1;
|