@commercetools-uikit/calendar-utils 19.26.0 → 20.1.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.
@@ -20,7 +20,6 @@ var _Object$defineProperty = require('@babel/runtime-corejs3/core-js-stable/obje
20
20
  var _defineProperty = require('@babel/runtime-corejs3/helpers/defineProperty');
21
21
  var _slicedToArray = require('@babel/runtime-corejs3/helpers/slicedToArray');
22
22
  var _objectWithoutProperties = require('@babel/runtime-corejs3/helpers/objectWithoutProperties');
23
- require('prop-types');
24
23
  var react$1 = require('react');
25
24
  var icons = require('@commercetools-uikit/icons');
26
25
  var Inline = require('@commercetools-uikit/spacings-inline');
@@ -147,6 +146,9 @@ const getClearSectionStyles = () => {
147
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.colorNeutral40, ";}&:hover svg *{fill:", designSystem.designTokens.colorError, ";}" + ("" ), "" );
148
147
  };
149
148
  const getIconBorderColor = (props, state) => {
149
+ if (props.appearance === 'filter') {
150
+ return designSystem.designTokens.colorTransparent;
151
+ }
150
152
  if (props.isDisabled) {
151
153
  return designSystem.designTokens.borderColorForInputWhenDisabled;
152
154
  }
@@ -180,7 +182,7 @@ const getIconFontColor = props => {
180
182
  return 'initial';
181
183
  };
182
184
  const getCalendarIconContainerStyles = (props, state) => {
183
- 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, ";}" + ("" ), "" )];
185
+ 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:", props.appearance === 'filter' ? designSystem.designTokens.colorTransparent : designSystem.designTokens.borderColorForInputWhenFocused, ";}" + ("" ), "" )];
184
186
  };
185
187
  const getInputBorderColor = (props, state) => {
186
188
  if (props.isDisabled) {
@@ -195,7 +197,7 @@ const getInputBorderColor = (props, state) => {
195
197
  if (props.isReadOnly) {
196
198
  return designSystem.designTokens.borderColorForInputWhenReadonly;
197
199
  }
198
- if ((props.isOpen || state.isFocused) && !props.isReadOnly) {
200
+ if (props.isOpen || state.isFocused) {
199
201
  return designSystem.designTokens.borderColorForInputWhenFocused;
200
202
  }
201
203
  return designSystem.designTokens.borderColorForInput;
@@ -216,6 +218,9 @@ const getInputFontColor = props => {
216
218
  return designSystem.designTokens.fontColorForInput;
217
219
  };
218
220
  const getInputContainerBackgroundColor = props => {
221
+ if (props.appearance === 'filter') {
222
+ return designSystem.designTokens.colorTransparent;
223
+ }
219
224
  if (props.isDisabled) {
220
225
  return designSystem.designTokens.backgroundColorForInputWhenDisabled;
221
226
  }
@@ -229,7 +234,7 @@ var _ref$2 = {
229
234
  styles: "box-shadow:inset 0 0 0 1px"
230
235
  } ;
231
236
  const getInputContainerStyles = (props, state) => {
232
- 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:", props.isCondensed ? `${designSystem.designTokens.heightForInputAsSmall}` : `${designSystem.designTokens.heightForInput}`, ";align-items:center;display:flex;font-size:", designSystem.designTokens.fontSize30, ";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:inset 0 0 0 1px ", designSystem.designTokens.borderColorForInputWhenFocused, ";&:hover{background-color:", designSystem.designTokens.colorSurface, ";}}" + ("" ), "" ), (props.hasError || props.hasWarning) && _ref$2];
237
+ 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:", props.isCondensed ? `${designSystem.designTokens.heightForInputAsSmall}` : `${designSystem.designTokens.heightForInput}`, ";align-items:center;display:flex;font-size:", designSystem.designTokens.fontSize30, ";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 ? props.appearance === 'filter' ? designSystem.designTokens.colorTransparent : designSystem.designTokens.backgroundColorForInputWhenHovered : null, ";}&:focus{border-color:", props.isDisabled || props.hasError || props.hasWarning || props.isReadOnly || (props.isOpen || state.isFocused) && !props.isReadOnly ? '' : props.appearance === 'filter' ? designSystem.designTokens.colorTransparent : designSystem.designTokens.borderColorForInputWhenFocused, ";}" + ("" ), "" ), !props.isReadOnly && props.appearance !== 'filter' && /*#__PURE__*/react.css("&:focus-within{border-color:", designSystem.designTokens.borderColorForInputWhenFocused, ";box-shadow:inset 0 0 0 1px ", designSystem.designTokens.borderColorForInputWhenFocused, ";&:hover{background-color:", designSystem.designTokens.colorSurface, ";}}" + ("" ), "" ), (props.hasError || props.hasWarning) && props.appearance !== 'filter' && _ref$2];
233
238
  };
234
239
  const getDateTimeInputStyles = props => {
235
240
  const baseStyles = [inputUtils.getInputStyles(props), /*#__PURE__*/react.css("border:none;background:none!important;&,&:focus:not(:read-only){box-shadow:none;}font-size:", props.isCondensed ? `${designSystem.designTokens.fontSize20}` : `${designSystem.designTokens.fontSize30}`, ";" + ("" ), "" )];
@@ -250,7 +255,6 @@ const ClearSection = props => {
250
255
  })
251
256
  });
252
257
  };
253
- ClearSection.propTypes = {};
254
258
  ClearSection.displayName = 'ClearSection';
255
259
  const CalendarBody = _ref => {
256
260
  let _ref$isClearable = _ref.isClearable,
@@ -300,14 +304,14 @@ const CalendarBody = _ref => {
300
304
  onFocus: handleInputFocus,
301
305
  onBlur: handleInputBlur,
302
306
  "aria-readonly": props.isReadOnly
303
- })), !disabledOrReadOnly && props.hasSelection && isClearable && jsxRuntime.jsx(ClearSection, {
307
+ })), !disabledOrReadOnly && props.hasSelection && isClearable && props.appearance !== 'filter' && jsxRuntime.jsx(ClearSection, {
304
308
  isCondensed: props.isCondensed,
305
309
  hasError: props.hasError,
306
310
  hasWarning: props.hasWarning,
307
311
  isFocused: isFocused,
308
312
  isOpen: props.isOpen,
309
313
  onClear: props.onClear
310
- }), jsxRuntime.jsx("button", _objectSpread$2(_objectSpread$2({
314
+ }), props.appearance !== 'filter' && jsxRuntime.jsx("button", _objectSpread$2(_objectSpread$2({
311
315
  type: "button",
312
316
  css: getCalendarIconContainerStyles(_objectSpread$2({
313
317
  isClearable
@@ -331,7 +335,6 @@ const CalendarBody = _ref => {
331
335
  })
332
336
  });
333
337
  };
334
- CalendarBody.propTypes = {};
335
338
  CalendarBody.displayName = 'CalendarBody';
336
339
  var CalendarBody$1 = CalendarBody;
337
340
 
@@ -350,28 +353,28 @@ const getStyles = props => {
350
353
  var _context, _context2;
351
354
  const styles = [];
352
355
  if (!_includesInstanceProperty__default["default"](_context = ['heading', 'spacing']).call(_context, props.type || '')) {
353
- styles.push( /*#__PURE__*/react.css("text-align:center;padding:", designSystem.designTokens.spacing20, " 0;cursor:default;border-radius:", designSystem.designTokens.borderRadius4, ";" + ("" ), "" ));
356
+ styles.push(/*#__PURE__*/react.css("text-align:center;padding:", designSystem.designTokens.spacing20, " 0;cursor:default;border-radius:", designSystem.designTokens.borderRadius4, ";" + ("" ), "" ));
354
357
  }
355
358
  if (_includesInstanceProperty__default["default"](_context2 = ['heading', 'spacing']).call(_context2, props.type || '')) {
356
- styles.push( /*#__PURE__*/react.css("text-align:center;padding:", designSystem.designTokens.spacing20, " 0;cursor:default;color:", designSystem.designTokens.colorNeutral60, ";" + ("" ), "" ));
359
+ styles.push(/*#__PURE__*/react.css("text-align:center;padding:", designSystem.designTokens.spacing20, " 0;cursor:default;color:", designSystem.designTokens.colorNeutral60, ";" + ("" ), "" ));
357
360
  }
358
361
  if (props.isHighlighted) {
359
- styles.push( /*#__PURE__*/react.css("background-color:", designSystem.designTokens.colorNeutral90, ";" + ("" ), "" ));
362
+ styles.push(/*#__PURE__*/react.css("background-color:", designSystem.designTokens.colorNeutral90, ";" + ("" ), "" ));
360
363
  }
361
364
  if (props.isSelected) {
362
- styles.push( /*#__PURE__*/react.css("background-color:", designSystem.designTokens.colorPrimary, ";color:", designSystem.designTokens.colorSurface, ";" + ("" ), "" ));
365
+ styles.push(/*#__PURE__*/react.css("background-color:", designSystem.designTokens.colorPrimary, ";color:", designSystem.designTokens.colorSurface, ";" + ("" ), "" ));
363
366
  }
364
367
  if (props.isRangeStart || props.isRangeEnd) {
365
- styles.push( /*#__PURE__*/react.css("background-color:", designSystem.designTokens.colorPrimary40, ";color:", designSystem.designTokens.colorSurface, ";" + ("" ), "" ));
368
+ styles.push(/*#__PURE__*/react.css("background-color:", designSystem.designTokens.colorPrimary40, ";color:", designSystem.designTokens.colorSurface, ";" + ("" ), "" ));
366
369
  }
367
370
  if (props.isRangeBetween) {
368
- styles.push( /*#__PURE__*/react.css("background-color:", designSystem.designTokens.colorNeutral90, ";color:", designSystem.designTokens.fontColorForInput, ";" + ("" ), "" ));
371
+ styles.push(/*#__PURE__*/react.css("background-color:", designSystem.designTokens.colorNeutral90, ";color:", designSystem.designTokens.fontColorForInput, ";" + ("" ), "" ));
369
372
  }
370
373
  if (!props.isSelected && !props.isRangeStart && !props.isRangeEnd && props.isToday) {
371
- styles.push( /*#__PURE__*/react.css("color:", designSystem.designTokens.colorInfo, ";font-weight:bold;" + ("" ), "" ));
374
+ styles.push(/*#__PURE__*/react.css("color:", designSystem.designTokens.colorInfo, ";font-weight:bold;" + ("" ), "" ));
372
375
  }
373
376
  if (props.disabled) {
374
- styles.push( /*#__PURE__*/react.css("color:", designSystem.designTokens.fontColorForInputWhenDisabled, ";cursor:not-allowed;" + ("" ), "" ));
377
+ styles.push(/*#__PURE__*/react.css("color:", designSystem.designTokens.fontColorForInputWhenDisabled, ";cursor:not-allowed;" + ("" ), "" ));
375
378
  }
376
379
  return styles;
377
380
  };
@@ -394,7 +397,6 @@ const CalendarDay = props => {
394
397
  }, rest))
395
398
  });
396
399
  };
397
- CalendarDay.propTypes = {};
398
400
  CalendarDay.displayName = 'CalendarDay';
399
401
  var CalendarDay$1 = CalendarDay;
400
402
 
@@ -517,11 +519,10 @@ const CalendarHeader = props => {
517
519
  })]
518
520
  });
519
521
  };
520
- CalendarHeader.propTypes = {};
521
522
  CalendarHeader.displayName = 'CalendarHeader';
522
523
  var CalendarHeader$1 = CalendarHeader;
523
524
 
524
- const _excluded = ["hasFooter", "hasWarning", "hasError"];
525
+ const _excluded = ["hasFooter", "hasWarning", "hasError", "appearance"];
525
526
  function ownKeys(e, r) { var t = _Object$keys__default["default"](e); if (_Object$getOwnPropertySymbols__default["default"]) { var o = _Object$getOwnPropertySymbols__default["default"](e); r && (o = _filterInstanceProperty__default["default"](o).call(o, function (r) { return _Object$getOwnPropertyDescriptor__default["default"](e, r).enumerable; })), t.push.apply(t, o); } return t; }
526
527
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context, _context2; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty__default["default"](_context = ownKeys(Object(t), !0)).call(_context, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors__default["default"] ? _Object$defineProperties__default["default"](e, _Object$getOwnPropertyDescriptors__default["default"](t)) : _forEachInstanceProperty__default["default"](_context2 = ownKeys(Object(t))).call(_context2, function (r) { _Object$defineProperty__default["default"](e, r, _Object$getOwnPropertyDescriptor__default["default"](t, r)); }); } return e; }
527
528
  function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? _Reflect$construct__default["default"](o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
@@ -543,19 +544,20 @@ let CalendarMenu = /*#__PURE__*/function (_Component) {
543
544
  hasFooter = _this$props.hasFooter,
544
545
  hasWarning = _this$props.hasWarning,
545
546
  hasError = _this$props.hasError,
547
+ _this$props$appearanc = _this$props.appearance,
548
+ appearance = _this$props$appearanc === void 0 ? 'default' : _this$props$appearanc,
546
549
  rest = _objectWithoutProperties(_this$props, _excluded);
547
550
  return jsxRuntime.jsxs("div", _objectSpread(_objectSpread({}, rest), {}, {
548
- css: [/*#__PURE__*/react.css("overflow-y:scroll;color:", designSystem.designTokens.colorSolid, ";font-family:inherit;border:none;box-shadow:0 2px 5px 0px rgba(0, 0, 0, 0.15);border-radius:", designSystem.designTokens.borderRadiusForInput, ";margin-top:", designSystem.designTokens.spacing10, ";font-size:", designSystem.designTokens.fontSize30, ";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, ";" + ("" ), "" ), "" , "" ],
551
+ css: [/*#__PURE__*/react.css("overflow-y:scroll;color:", designSystem.designTokens.colorSolid, ";font-family:inherit;border:none;box-shadow:", appearance === 'filter' ? 'none' : '0 2px 5px 0px rgba(0, 0, 0, 0.15)', ";border-radius:", designSystem.designTokens.borderRadiusForInput, ";margin-top:", designSystem.designTokens.spacing10, ";font-size:", designSystem.designTokens.fontSize30, ";position:", appearance === 'filter' ? 'inherit' : 'absolute', ";box-sizing:border-box;width:100%;background-color:", designSystem.designTokens.colorSurface, ";min-width:", designSystem.designTokens.constraint5, ";z-index:", appearance === 'filter' ? 'inherit' : '99999', ";" + ("" ), "" ), !hasFooter && _ref, hasError && /*#__PURE__*/react.css("border-color:", designSystem.designTokens.borderColorForInputWhenError, ";" + ("" ), "" ), hasWarning && /*#__PURE__*/react.css("border-color:", designSystem.designTokens.borderColorForInputWhenWarning, ";" + ("" ), "" ), "" , "" ],
549
552
  children: [this.props.children, this.props.footer]
550
553
  }));
551
554
  }
552
555
  }]);
553
556
  }(react$1.Component);
554
557
  CalendarMenu.displayName = 'CalendarMenu';
555
- CalendarMenu.propTypes = {};
556
558
 
557
559
  // NOTE: This string will be replaced on build time with the package version.
558
- var version = "19.26.0";
560
+ var version = "20.1.0";
559
561
 
560
562
  exports.CalendarBody = CalendarBody$1;
561
563
  exports.CalendarContent = CalendarContent$1;