@commercetools-uikit/calendar-utils 12.2.4 → 12.2.5
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.dev.js +109 -104
- package/dist/commercetools-uikit-calendar-utils.cjs.prod.js +41 -35
- package/dist/commercetools-uikit-calendar-utils.esm.js +109 -104
- package/dist/declarations/src/calendar-body/calendar-body.d.ts +47 -0
- package/dist/declarations/src/calendar-body/calendar-body.styles.d.ts +10 -0
- package/dist/declarations/src/calendar-body/index.d.ts +1 -0
- package/dist/declarations/src/calendar-content/calendar-content.d.ts +6 -0
- package/dist/declarations/src/calendar-content/index.d.ts +1 -0
- package/dist/declarations/src/calendar-day/calendar-day.d.ts +17 -0
- package/dist/declarations/src/calendar-day/index.d.ts +1 -0
- package/dist/declarations/src/calendar-header/calendar-header.d.ts +14 -0
- package/dist/declarations/src/calendar-header/index.d.ts +1 -0
- package/dist/declarations/src/calendar-header/messages.d.ts +28 -0
- package/dist/declarations/src/calendar-menu/calendar-menu.d.ts +13 -0
- package/dist/declarations/src/calendar-menu/index.d.ts +1 -0
- package/dist/declarations/src/calendar.d.ts +27 -0
- package/dist/declarations/src/index.d.ts +7 -0
- package/dist/declarations/src/version.d.ts +2 -0
- package/package.json +23 -20
|
@@ -20,8 +20,8 @@ var _Object$defineProperties = require('@babel/runtime-corejs3/core-js-stable/ob
|
|
|
20
20
|
var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/object/define-property');
|
|
21
21
|
var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
|
|
22
22
|
var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
|
|
23
|
-
var react$1 = require('react');
|
|
24
23
|
require('prop-types');
|
|
24
|
+
var react$1 = require('react');
|
|
25
25
|
var react = require('@emotion/react');
|
|
26
26
|
var icons = require('@commercetools-uikit/icons');
|
|
27
27
|
var Inline = require('@commercetools-uikit/spacings-inline');
|
|
@@ -166,7 +166,7 @@ var getIsDateInRange = function getIsDateInRange(item, min, max) {
|
|
|
166
166
|
var itemDate = moment__default["default"](item);
|
|
167
167
|
|
|
168
168
|
if (min && max) {
|
|
169
|
-
return itemDate.isBetween(min, max, null, []);
|
|
169
|
+
return itemDate.isBetween(min, max, null, '[]');
|
|
170
170
|
}
|
|
171
171
|
|
|
172
172
|
if (min && !max) {
|
|
@@ -191,12 +191,13 @@ var getExampleDateStrings = function getExampleDateStrings() {
|
|
|
191
191
|
function ownKeys$3(object, enumerableOnly) { var keys = _Object$keys__default["default"](object); if (_Object$getOwnPropertySymbols__default["default"]) { var symbols = _Object$getOwnPropertySymbols__default["default"](object); if (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; }
|
|
192
192
|
|
|
193
193
|
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default["default"](_context = ownKeys$3(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context2; _forEachInstanceProperty__default["default"](_context2 = ownKeys$3(Object(source))).call(_context2, function (key) { _Object$defineProperty__default["default"](target, key, _Object$getOwnPropertyDescriptor__default["default"](source, key)); }); } } return target; }
|
|
194
|
+
|
|
195
|
+
// NOTE: order is important here
|
|
194
196
|
// * a disabled-field currently does not display warning/error-states so it takes precedence
|
|
195
197
|
// * a readonly-field cannot be changed, but it might be relevant for validation, so error and warning are checked first
|
|
196
198
|
// how you can interact with the field is controlled separately by the props, this only influences visuals
|
|
197
|
-
|
|
198
|
-
var
|
|
199
|
-
var vars = _objectSpread$3(_objectSpread$3({}, designSystem.customProperties), props.theme);
|
|
199
|
+
var getClearSectionStyles = function getClearSectionStyles(theme) {
|
|
200
|
+
var vars = _objectSpread$3(_objectSpread$3({}, designSystem.customProperties), theme);
|
|
200
201
|
|
|
201
202
|
return /*#__PURE__*/react.css("align-items:center;box-sizing:border-box;display:flex;margin-right:", vars.spacingXs, ";cursor:pointer;transition:color ", vars.transitionStandard, ",border-color ", vars.transitionStandard, ";&:hover svg *{fill:", vars.colorWarning, ";}" + ("" ), "" );
|
|
202
203
|
};
|
|
@@ -245,8 +246,8 @@ var getIconFontColor = function getIconFontColor(vars, props) {
|
|
|
245
246
|
return 'initial';
|
|
246
247
|
};
|
|
247
248
|
|
|
248
|
-
var getCalendarIconContainerStyles = function getCalendarIconContainerStyles(props, state) {
|
|
249
|
-
var vars = _objectSpread$3(_objectSpread$3({}, designSystem.customProperties),
|
|
249
|
+
var getCalendarIconContainerStyles = function getCalendarIconContainerStyles(props, state, theme) {
|
|
250
|
+
var vars = _objectSpread$3(_objectSpread$3({}, designSystem.customProperties), theme);
|
|
250
251
|
|
|
251
252
|
return /*#__PURE__*/react.css("align-items:center;box-sizing:border-box;background:none;border:0;border-left:1px solid ", vars.borderColorForInput, ";border-top-right-radius:", vars.borderRadiusForInput, ";border-bottom-right-radius:", vars.borderRadiusForInput, ";border-color:", getIconBorderColor(vars, props, state), ";color:", getIconFontColor(vars, props), ";cursor:", props.isDisabled ? 'not-allowed' : 'default', ";height:100%;display:flex;padding:", vars.spacingXs, ";outline:0;transition:color ", vars.transitionStandard, ",border-color ", vars.transitionStandard, ";&:active,&:hover:not(:disabled)&:not(:read-only),&:focus{border-color:", vars.borderColorForInputWhenFocused, ";}" + ("" ), "" );
|
|
252
253
|
};
|
|
@@ -295,8 +296,8 @@ var getInputFontColor = function getInputFontColor(vars, props) {
|
|
|
295
296
|
return vars.fontColorForInput;
|
|
296
297
|
};
|
|
297
298
|
|
|
298
|
-
var getInputContainerStyles = function getInputContainerStyles(props, state) {
|
|
299
|
-
var vars = _objectSpread$3(_objectSpread$3({}, designSystem.customProperties),
|
|
299
|
+
var getInputContainerStyles = function getInputContainerStyles(props, state, theme) {
|
|
300
|
+
var vars = _objectSpread$3(_objectSpread$3({}, designSystem.customProperties), theme);
|
|
300
301
|
|
|
301
302
|
return /*#__PURE__*/react.css("appearance:none;background-color:", props.isDisabled ? vars.backgroundColorForInputWhenDisabled : vars.backgroundColorForInput, ";border:1px solid ", getInputBorderColor(vars, props, state), ";border-radius:", vars.borderRadiusForInput, ";box-sizing:border-box;color:", getInputFontColor(vars, props), ";cursor:", props.isDisabled ? 'not-allowed' : 'default', ";width:100%;height:", vars.sizeHeightInput, ";align-items:center;display:flex;font-size:", vars.fontSizeDefault, ";font-family:inherit;transition:border-color ", vars.transitionStandard, ",box-shadow ", vars.transitionStandard, ";&:focus-within{border-color:", vars.borderColorForInputWhenFocused, ";box-shadow:inset 0 0 0 2px ", vars.borderColorForInputWhenFocused, ";}&:focus,&:hover{border-color:", props.isDisabled || props.hasError || props.hasWarning || props.isReadOnly || (props.isOpen || state.isFocused) && !props.isReadOnly ? '' : vars.borderColorForInputWhenFocused, ";}" + ("" ), "" );
|
|
302
303
|
};
|
|
@@ -306,8 +307,8 @@ var _ref$2 = {
|
|
|
306
307
|
styles: "border:none;background:none;&:focus{box-shadow:none;}"
|
|
307
308
|
} ;
|
|
308
309
|
|
|
309
|
-
var getDateTimeInputStyles = function getDateTimeInputStyles(props) {
|
|
310
|
-
var baseStyles = [inputUtils.getInputStyles(props), _ref$2];
|
|
310
|
+
var getDateTimeInputStyles = function getDateTimeInputStyles(props, theme) {
|
|
311
|
+
var baseStyles = [inputUtils.getInputStyles(props, theme), _ref$2];
|
|
311
312
|
return baseStyles;
|
|
312
313
|
};
|
|
313
314
|
|
|
@@ -315,8 +316,9 @@ function ownKeys$2(object, enumerableOnly) { var keys = _Object$keys__default["d
|
|
|
315
316
|
|
|
316
317
|
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty__default["default"](_context = ownKeys$2(Object(source), true)).call(_context, function (key) { _defineProperty(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors__default["default"]) { _Object$defineProperties__default["default"](target, _Object$getOwnPropertyDescriptors__default["default"](source)); } else { var _context2; _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; }
|
|
317
318
|
var ClearSection = function ClearSection(props) {
|
|
319
|
+
var theme = react.useTheme();
|
|
318
320
|
return jsxRuntime.jsx(AccessibleButton__default["default"], {
|
|
319
|
-
css: getClearSectionStyles(
|
|
321
|
+
css: getClearSectionStyles(theme),
|
|
320
322
|
label: "clear",
|
|
321
323
|
onClick: props.onClear,
|
|
322
324
|
"aria-label": "clear",
|
|
@@ -326,30 +328,36 @@ var ClearSection = function ClearSection(props) {
|
|
|
326
328
|
})
|
|
327
329
|
});
|
|
328
330
|
};
|
|
329
|
-
ClearSection.displayName = 'ClearSection';
|
|
330
331
|
ClearSection.propTypes = {};
|
|
332
|
+
ClearSection.displayName = 'ClearSection';
|
|
333
|
+
var defaultProps = {
|
|
334
|
+
isClearable: true
|
|
335
|
+
};
|
|
331
336
|
var CalendarBody = function CalendarBody(props) {
|
|
337
|
+
var _props$inputProps, _props$inputProps2, _props$toggleButtonPr, _props$toggleButtonPr2, _props$inputProps3;
|
|
338
|
+
|
|
332
339
|
var _useToggleState = hooks.useToggleState(false),
|
|
333
340
|
_useToggleState2 = _slicedToArray(_useToggleState, 2),
|
|
334
341
|
isFocused = _useToggleState2[0],
|
|
335
342
|
toggleIsFocused = _useToggleState2[1];
|
|
336
343
|
|
|
337
|
-
var
|
|
344
|
+
var theme = react.useTheme();
|
|
345
|
+
var onInputFocus = (_props$inputProps = props.inputProps) === null || _props$inputProps === void 0 ? void 0 : _props$inputProps.onFocus;
|
|
338
346
|
var handleInputFocus = react$1.useCallback(function (event) {
|
|
339
347
|
toggleIsFocused(true);
|
|
340
348
|
if (onInputFocus) onInputFocus(event);
|
|
341
349
|
}, [onInputFocus, toggleIsFocused]);
|
|
342
|
-
var onInputBlur = props.inputProps.onBlur;
|
|
350
|
+
var onInputBlur = (_props$inputProps2 = props.inputProps) === null || _props$inputProps2 === void 0 ? void 0 : _props$inputProps2.onBlur;
|
|
343
351
|
var handleInputBlur = react$1.useCallback(function (event) {
|
|
344
352
|
toggleIsFocused(false);
|
|
345
353
|
if (onInputBlur) onInputBlur(event);
|
|
346
354
|
}, [onInputBlur, toggleIsFocused]);
|
|
347
|
-
var onToggleFocus = props.toggleButtonProps.onFocus;
|
|
355
|
+
var onToggleFocus = (_props$toggleButtonPr = props.toggleButtonProps) === null || _props$toggleButtonPr === void 0 ? void 0 : _props$toggleButtonPr.onFocus;
|
|
348
356
|
var handleToggleFocus = react$1.useCallback(function (event) {
|
|
349
357
|
toggleIsFocused(true);
|
|
350
358
|
if (onToggleFocus) onToggleFocus(event);
|
|
351
359
|
}, [onToggleFocus, toggleIsFocused]);
|
|
352
|
-
var onToggleBlur = props.toggleButtonProps.onBlur;
|
|
360
|
+
var onToggleBlur = (_props$toggleButtonPr2 = props.toggleButtonProps) === null || _props$toggleButtonPr2 === void 0 ? void 0 : _props$toggleButtonPr2.onBlur;
|
|
353
361
|
var handleToggleBlur = react$1.useCallback(function (event) {
|
|
354
362
|
toggleIsFocused(false);
|
|
355
363
|
if (onToggleBlur) onToggleBlur(event);
|
|
@@ -360,13 +368,13 @@ var CalendarBody = function CalendarBody(props) {
|
|
|
360
368
|
children: jsxRuntime.jsxs("div", {
|
|
361
369
|
css: getInputContainerStyles(props, {
|
|
362
370
|
isFocused: isFocused
|
|
363
|
-
}),
|
|
371
|
+
}, theme),
|
|
364
372
|
children: [jsxRuntime.jsx("input", _objectSpread$2(_objectSpread$2({
|
|
365
373
|
ref: props.inputRef
|
|
366
374
|
}, props.inputProps), {}, {
|
|
367
375
|
disabled: props.isDisabled,
|
|
368
376
|
readOnly: props.isReadOnly,
|
|
369
|
-
css: getDateTimeInputStyles(props),
|
|
377
|
+
css: getDateTimeInputStyles(props, theme),
|
|
370
378
|
onFocus: handleInputFocus,
|
|
371
379
|
onBlur: handleInputBlur,
|
|
372
380
|
"aria-readonly": props.isReadOnly
|
|
@@ -380,12 +388,12 @@ var CalendarBody = function CalendarBody(props) {
|
|
|
380
388
|
type: "button",
|
|
381
389
|
css: getCalendarIconContainerStyles(props, {
|
|
382
390
|
isFocused: isFocused
|
|
383
|
-
})
|
|
391
|
+
}, theme)
|
|
384
392
|
}, props.toggleButtonProps), {}, {
|
|
385
393
|
onFocus: handleToggleFocus,
|
|
386
394
|
onBlur: handleToggleBlur,
|
|
387
395
|
disabled: disabledOrReadOnly,
|
|
388
|
-
onKeyDown: props.inputProps.onKeyDown
|
|
396
|
+
onKeyDown: (_props$inputProps3 = props.inputProps) === null || _props$inputProps3 === void 0 ? void 0 : _props$inputProps3.onKeyDown
|
|
389
397
|
/* keyboard users don't need this button */
|
|
390
398
|
,
|
|
391
399
|
tabIndex: -1,
|
|
@@ -398,15 +406,13 @@ var CalendarBody = function CalendarBody(props) {
|
|
|
398
406
|
})
|
|
399
407
|
});
|
|
400
408
|
};
|
|
401
|
-
CalendarBody.displayName = 'CalendarBody';
|
|
402
409
|
CalendarBody.propTypes = {};
|
|
403
|
-
CalendarBody.
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
var calendarBody = react.withTheme(CalendarBody);
|
|
410
|
+
CalendarBody.displayName = 'CalendarBody';
|
|
411
|
+
CalendarBody.defaultProps = defaultProps;
|
|
412
|
+
var CalendarBody$1 = CalendarBody;
|
|
407
413
|
|
|
408
414
|
var CalendarContent = _styled__default["default"]("ul", {
|
|
409
|
-
target: "
|
|
415
|
+
target: "e17zfb0v0"
|
|
410
416
|
} )({
|
|
411
417
|
name: "1en5ct5",
|
|
412
418
|
styles: "margin:0;padding:0 1%"
|
|
@@ -425,11 +431,11 @@ var getStyles = function getStyles(props) {
|
|
|
425
431
|
|
|
426
432
|
var styles = [];
|
|
427
433
|
|
|
428
|
-
if (!_includesInstanceProperty__default["default"](_context = ['heading', 'spacing']).call(_context, props.type)) {
|
|
434
|
+
if (!_includesInstanceProperty__default["default"](_context = ['heading', 'spacing']).call(_context, props.type || '')) {
|
|
429
435
|
styles.push( /*#__PURE__*/react.css("text-align:center;padding:", designSystem.customProperties.spacingS, " 0;cursor:default;border-radius:", designSystem.customProperties.borderRadius4, ";" + ("" ), "" ));
|
|
430
436
|
}
|
|
431
437
|
|
|
432
|
-
if (_includesInstanceProperty__default["default"](_context2 = ['heading', 'spacing']).call(_context2, props.type)) {
|
|
438
|
+
if (_includesInstanceProperty__default["default"](_context2 = ['heading', 'spacing']).call(_context2, props.type || '')) {
|
|
433
439
|
styles.push( /*#__PURE__*/react.css("text-align:center;padding:", designSystem.customProperties.spacingS, " 0;cursor:default;color:", designSystem.customProperties.colorNeutral60, ";" + ("" ), "" ));
|
|
434
440
|
}
|
|
435
441
|
|
|
@@ -482,8 +488,8 @@ var CalendarDay = function CalendarDay(props) {
|
|
|
482
488
|
});
|
|
483
489
|
};
|
|
484
490
|
|
|
485
|
-
CalendarDay.displayName = 'CalendarDay';
|
|
486
491
|
CalendarDay.propTypes = {};
|
|
492
|
+
CalendarDay.displayName = 'CalendarDay';
|
|
487
493
|
var CalendarDay$1 = CalendarDay;
|
|
488
494
|
|
|
489
495
|
var messages = reactIntl.defineMessages({
|
|
@@ -515,7 +521,7 @@ var messages = reactIntl.defineMessages({
|
|
|
515
521
|
});
|
|
516
522
|
|
|
517
523
|
var WrapperComponent = _styled__default["default"]("div", {
|
|
518
|
-
target: "
|
|
524
|
+
target: "e1q1nv850"
|
|
519
525
|
} )({
|
|
520
526
|
name: "zjik7",
|
|
521
527
|
styles: "display:flex"
|
|
@@ -611,8 +617,8 @@ var CalendarHeader = function CalendarHeader(props) {
|
|
|
611
617
|
});
|
|
612
618
|
};
|
|
613
619
|
|
|
614
|
-
CalendarHeader.displayName = 'CalendarHeader';
|
|
615
620
|
CalendarHeader.propTypes = {};
|
|
621
|
+
CalendarHeader.displayName = 'CalendarHeader';
|
|
616
622
|
var CalendarHeader$1 = CalendarHeader;
|
|
617
623
|
|
|
618
624
|
var _excluded = ["hasFooter", "hasWarning", "hasError"];
|
|
@@ -663,10 +669,10 @@ var CalendarMenu = /*#__PURE__*/function (_Component) {
|
|
|
663
669
|
CalendarMenu.displayName = 'CalendarMenu';
|
|
664
670
|
CalendarMenu.propTypes = {};
|
|
665
671
|
|
|
666
|
-
// NOTE: This string will be replaced
|
|
667
|
-
var version =
|
|
672
|
+
// NOTE: This string will be replaced on build time with the package version.
|
|
673
|
+
var version = "12.2.5";
|
|
668
674
|
|
|
669
|
-
exports.CalendarBody =
|
|
675
|
+
exports.CalendarBody = CalendarBody$1;
|
|
670
676
|
exports.CalendarContent = CalendarContent$1;
|
|
671
677
|
exports.CalendarDay = CalendarDay$1;
|
|
672
678
|
exports.CalendarHeader = CalendarHeader$1;
|