carbon-react 8.1.3 → 8.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (170) hide show
  1. package/change_log/v8_1_4/position_date_picker.yml +1 -0
  2. package/change_log/v8_1_5/fix_path.yml +1 -0
  3. package/lib/__experimental__/components/input/input-presentation.component.js +35 -29
  4. package/lib/__experimental__/components/input/input.component.js +36 -28
  5. package/lib/__experimental__/components/input-decorator-bridge/input-decorator-bridge.component.js +45 -35
  6. package/lib/__experimental__/components/select/index.js +4 -4
  7. package/lib/__experimental__/components/select/option.component.js +6 -4
  8. package/lib/__experimental__/components/select/select-list.component.js +39 -35
  9. package/lib/__experimental__/components/select/select.component.js +45 -39
  10. package/lib/__experimental__/components/select-async/index.js +4 -4
  11. package/lib/__experimental__/components/select-async/select-async.component.js +53 -37
  12. package/lib/__experimental__/components/textbox/textbox.component.js +6 -4
  13. package/lib/__spec_helper__/index.js +1 -1
  14. package/lib/components/action-toolbar/action-toolbar.js +43 -37
  15. package/lib/components/alert/alert.js +35 -29
  16. package/lib/components/alert/alert.stories.js +4 -4
  17. package/lib/components/animated-menu-button/animated-menu-button.js +36 -32
  18. package/lib/components/animated-menu-button/animated-menu-button.stories.js +16 -24
  19. package/lib/components/app-wrapper/app-wrapper.js +29 -25
  20. package/lib/components/app-wrapper/app-wrapper.stories.js +1 -1
  21. package/lib/components/button/button.js +30 -26
  22. package/lib/components/button/button.stories.js +1 -1
  23. package/lib/components/button-toggle/button-toggle.js +52 -46
  24. package/lib/components/button-toggle/button-toggle.stories.js +23 -15
  25. package/lib/components/button-toggle-group/button-toggle-group.js +54 -48
  26. package/lib/components/button-toggle-group/button-toggle-group.stories.js +4 -4
  27. package/lib/components/carousel/carousel.js +48 -42
  28. package/lib/components/carousel/slide/slide.js +4 -4
  29. package/lib/components/checkbox/checkbox.js +68 -72
  30. package/lib/components/configurable-items/configurable-item-row/configurable-item-row.js +37 -33
  31. package/lib/components/configurable-items/configurable-items.js +38 -34
  32. package/lib/components/confirm/confirm.js +60 -54
  33. package/lib/components/content/content.js +31 -25
  34. package/lib/components/create/create.js +32 -24
  35. package/lib/components/date/date.js +216 -194
  36. package/lib/components/date/navbar/navbar.js +5 -5
  37. package/lib/components/date-range/date-range.js +97 -93
  38. package/lib/components/decimal/decimal.js +62 -56
  39. package/lib/components/detail/detail.js +51 -47
  40. package/lib/components/dialog/dialog.js +80 -72
  41. package/lib/components/dialog-full-screen/dialog-full-screen.js +53 -47
  42. package/lib/components/dialog-full-screen/full-screen-heading/full-screen-heading.js +9 -7
  43. package/lib/components/drag-and-drop/custom-drag-layer/custom-drag-layer.js +28 -24
  44. package/lib/components/drag-and-drop/drag-and-drop.js +6 -6
  45. package/lib/components/drag-and-drop/draggable-context/draggable-context.js +40 -37
  46. package/lib/components/drag-and-drop/with-drag/with-drag.js +26 -22
  47. package/lib/components/drag-and-drop/with-drop/with-drop.js +26 -20
  48. package/lib/components/dropdown/dropdown.js +146 -143
  49. package/lib/components/dropdown-filter/dropdown-filter.js +94 -88
  50. package/lib/components/dropdown-filter-ajax/dropdown-filter-ajax.js +54 -50
  51. package/lib/components/fieldset/fieldset.js +50 -42
  52. package/lib/components/filter/filter.js +43 -46
  53. package/lib/components/flash/flash.js +72 -64
  54. package/lib/components/form/cancel-button/cancel-button.js +11 -11
  55. package/lib/components/form/form-summary/form-summary.js +7 -7
  56. package/lib/components/form/form.js +68 -69
  57. package/lib/components/form/save-button/save-button.js +11 -11
  58. package/lib/components/grouped-character/grouped-character.js +49 -43
  59. package/lib/components/heading/heading.js +65 -59
  60. package/lib/components/help/help.js +46 -40
  61. package/lib/components/i18n/i18n.js +30 -22
  62. package/lib/components/icon/icon.js +55 -51
  63. package/lib/components/inline-inputs/inline-inputs.js +6 -6
  64. package/lib/components/link/link.js +45 -37
  65. package/lib/components/menu/menu-item/menu-item.js +55 -49
  66. package/lib/components/menu/menu.js +47 -41
  67. package/lib/components/menu/submenu-block/submenu-block.js +43 -37
  68. package/lib/components/menu-list/menu-list-item/menu-list-item.js +29 -25
  69. package/lib/components/menu-list/menu-list.js +49 -43
  70. package/lib/components/message/message.js +47 -41
  71. package/lib/components/modal/modal.js +77 -71
  72. package/lib/components/mount-in-app/mount-in-app.js +32 -26
  73. package/lib/components/multi-action-button/multi-action-button.js +52 -46
  74. package/lib/components/multi-step-wizard/multi-step-wizard.js +60 -54
  75. package/lib/components/multi-step-wizard/step/step.js +68 -69
  76. package/lib/components/navigation-bar/navigation-bar.js +44 -38
  77. package/lib/components/number/number.js +58 -52
  78. package/lib/components/pager/pager.js +75 -71
  79. package/lib/components/pages/page/page.js +6 -6
  80. package/lib/components/pages/pages.js +4 -4
  81. package/lib/components/pill/pill.js +33 -27
  82. package/lib/components/pod/pod.js +84 -80
  83. package/lib/components/portal/portal.js +34 -26
  84. package/lib/components/portrait/portrait.js +52 -48
  85. package/lib/components/preview/preview.js +4 -4
  86. package/lib/components/profile/profile.js +51 -45
  87. package/lib/components/radio-button/radio-button.js +51 -45
  88. package/lib/components/rainbow/rainbow.js +44 -38
  89. package/lib/components/row/column/column.js +1 -1
  90. package/lib/components/row/row.js +47 -41
  91. package/lib/components/scrollable-list/as-scrollable-list-item.wrapper.js +8 -8
  92. package/lib/components/scrollable-list/scrollable-list-item.component.js +27 -35
  93. package/lib/components/scrollable-list/scrollable-list.component.js +53 -37
  94. package/lib/components/scrollable-list/scrollable-list.style.js +5 -13
  95. package/lib/components/scrollable-list/test-utils.js +38 -28
  96. package/lib/components/settings-row/settings-row.js +49 -43
  97. package/lib/components/show-edit-pod/show-edit-pod.js +67 -63
  98. package/lib/components/sidebar/sidebar-header/sidebar-header.js +43 -37
  99. package/lib/components/sidebar/sidebar.js +54 -48
  100. package/lib/components/simple-color-picker/color-option/color-option.js +47 -41
  101. package/lib/components/simple-color-picker/simple-color-picker.js +53 -47
  102. package/lib/components/spinner/spinner.js +43 -37
  103. package/lib/components/split-button/split-button.js +69 -69
  104. package/lib/components/step-sequence/step-sequence-item/step-sequence-item.js +15 -13
  105. package/lib/components/step-sequence/step-sequence.js +4 -4
  106. package/lib/components/switch/switch.js +23 -21
  107. package/lib/components/table/draggable-table-cell/draggable-table-cell.js +4 -4
  108. package/lib/components/table/table-cell/table-cell.js +45 -39
  109. package/lib/components/table/table-header/table-header.js +107 -110
  110. package/lib/components/table/table-row/table-row.js +62 -58
  111. package/lib/components/table/table-subheader/table-subheader.js +32 -26
  112. package/lib/components/table/table.js +166 -169
  113. package/lib/components/table-ajax/table-ajax.js +67 -70
  114. package/lib/components/tabs/tab/tab.js +48 -44
  115. package/lib/components/tabs/tabs.js +73 -67
  116. package/lib/components/textarea/textarea.js +52 -49
  117. package/lib/components/textbox/textbox.js +49 -43
  118. package/lib/components/toast/toast.js +56 -50
  119. package/lib/components/tooltip/tooltip.js +47 -41
  120. package/lib/patterns/configurable-items/configurable-items-content/configurable-items-content.js +35 -29
  121. package/lib/patterns/configurable-items/configurable-items.js +55 -51
  122. package/lib/patterns/configurable-items/store/store.js +35 -27
  123. package/lib/style/index.js +1 -1
  124. package/lib/style/palette/index.js +4 -2
  125. package/lib/style/themes/base/index.js +7 -7
  126. package/lib/style/themes/test-utils.js +19 -21
  127. package/lib/style/utils/add-hex-symbols.js +4 -2
  128. package/lib/style/utils/at-opacity.js +10 -8
  129. package/lib/style/utils/merge-deep.js +15 -15
  130. package/lib/style/utils/mix.js +32 -20
  131. package/lib/utils/decorators/input/input.js +46 -42
  132. package/lib/utils/decorators/input-icon/input-icon.js +37 -33
  133. package/lib/utils/decorators/input-label/input-label.js +37 -31
  134. package/lib/utils/decorators/input-validation/input-validation.js +40 -36
  135. package/lib/utils/decorators/should-component-update/should-component-update.js +29 -23
  136. package/lib/utils/decorators/tooltip-decorator/tooltip-decorator.js +38 -34
  137. package/lib/utils/ether/ether.js +16 -14
  138. package/lib/utils/filter-children/filter-children.util.js +10 -8
  139. package/lib/utils/handlers/base-registry/base-registry.js +12 -13
  140. package/lib/utils/helpers/browser/browser.js +15 -13
  141. package/lib/utils/helpers/date/date.js +4 -2
  142. package/lib/utils/helpers/element-resize/element-resize.js +6 -4
  143. package/lib/utils/helpers/events/events.js +2 -2
  144. package/lib/utils/helpers/guid/guid.js +6 -6
  145. package/lib/utils/helpers/i18n/i18n.js +11 -9
  146. package/lib/utils/helpers/immutable/immutable.js +13 -13
  147. package/lib/utils/helpers/options-helper/options-helper.js +2 -1
  148. package/lib/utils/helpers/prop-types/prop-types.js +2 -2
  149. package/lib/utils/helpers/scrollable-parent/scrollable-parent.js +2 -0
  150. package/lib/utils/helpers/serialize/serialize.js +12 -12
  151. package/lib/utils/helpers/tags/tags-specs/tags-specs.js +6 -4
  152. package/lib/utils/helpers/to-array/to-array.js +8 -6
  153. package/lib/utils/router/router.js +2 -2
  154. package/lib/utils/service/service.js +34 -34
  155. package/lib/utils/validations/blank/blank.js +6 -2
  156. package/lib/utils/validations/date/date.js +6 -2
  157. package/lib/utils/validations/date-range/date-range.js +6 -2
  158. package/lib/utils/validations/date-within-range/date-within-range.js +6 -2
  159. package/lib/utils/validations/email/email.js +6 -2
  160. package/lib/utils/validations/exclusion/exclusion.js +6 -2
  161. package/lib/utils/validations/inclusion/inclusion.js +6 -2
  162. package/lib/utils/validations/length/length.js +6 -2
  163. package/lib/utils/validations/numeral/numeral-type/numeral-type.js +8 -2
  164. package/lib/utils/validations/numeral/numeral.js +6 -2
  165. package/lib/utils/validations/presence/presence.js +12 -4
  166. package/lib/utils/validations/regex/regex.js +8 -2
  167. package/lib/utils/validations/validator/validator.js +14 -14
  168. package/package.json +13 -13
  169. package/release_notes/v8_1_4.html.md +5 -0
  170. package/release_notes/v8_1_5.html.md +5 -0
@@ -1,28 +1,32 @@
1
1
  "use strict";
2
2
 
3
- require("core-js/modules/es.symbol");
3
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
4
 
5
- require("core-js/modules/es.symbol.description");
5
+ require("core-js/modules/es.object.get-prototype-of.js");
6
6
 
7
- require("core-js/modules/es.symbol.iterator");
7
+ require("core-js/modules/es.object.to-string.js");
8
8
 
9
- require("core-js/modules/es.array.iterator");
9
+ require("core-js/modules/es.reflect.construct.js");
10
10
 
11
- require("core-js/modules/es.object.assign");
11
+ require("core-js/modules/es.symbol.js");
12
12
 
13
- require("core-js/modules/es.object.get-prototype-of");
13
+ require("core-js/modules/es.symbol.description.js");
14
14
 
15
- require("core-js/modules/es.object.to-string");
15
+ require("core-js/modules/es.symbol.iterator.js");
16
16
 
17
- require("core-js/modules/es.string.iterator");
17
+ require("core-js/modules/es.array.iterator.js");
18
18
 
19
- require("core-js/modules/web.dom-collections.iterator");
19
+ require("core-js/modules/es.string.iterator.js");
20
+
21
+ require("core-js/modules/web.dom-collections.iterator.js");
20
22
 
21
23
  Object.defineProperty(exports, "__esModule", {
22
24
  value: true
23
25
  });
24
26
  exports.default = void 0;
25
27
 
28
+ require("core-js/modules/es.object.assign.js");
29
+
26
30
  var _react = _interopRequireDefault(require("react"));
27
31
 
28
32
  var _i18nJs = _interopRequireDefault(require("i18n-js"));
@@ -37,6 +41,8 @@ require("react-day-picker/lib/style.css");
37
41
 
38
42
  require("./date.scss");
39
43
 
44
+ var _optionsHelper = _interopRequireDefault(require("../../utils/helpers/options-helper"));
45
+
40
46
  var _navbar = _interopRequireDefault(require("./navbar"));
41
47
 
42
48
  var _portal = _interopRequireDefault(require("../portal"));
@@ -63,29 +69,31 @@ var _ether = require("../../utils/ether");
63
69
 
64
70
  var _tags = _interopRequireDefault(require("../../utils/helpers/tags"));
65
71
 
66
- var _class, _temp;
72
+ var _class;
67
73
 
68
74
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
69
75
 
70
- function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
71
-
72
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
76
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
73
77
 
74
78
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
75
79
 
76
80
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
77
81
 
78
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
82
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
83
+
84
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
79
85
 
80
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
86
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
81
87
 
82
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
88
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
89
+
90
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
83
91
 
84
92
  function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
85
93
 
86
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
94
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
87
95
 
88
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
96
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
89
97
 
90
98
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
91
99
 
@@ -116,18 +124,26 @@ var today = _date2.default.todayFormatted('YYYY-MM-DD');
116
124
  */
117
125
 
118
126
 
119
- var Date = (0, _input.default)((0, _inputIcon.default)((0, _inputLabel.default)((0, _inputValidation.default)((_temp = _class =
120
- /*#__PURE__*/
121
- function (_React$Component) {
127
+ var Date = (0, _input.default)((0, _inputIcon.default)((0, _inputLabel.default)((0, _inputValidation.default)((_class = /*#__PURE__*/function (_React$Component) {
122
128
  _inherits(Date, _React$Component);
123
129
 
130
+ var _super = _createSuper(Date);
131
+
124
132
  // Required for validProps function
133
+
134
+ /**
135
+ * Stores the document - allows us to override it different contexts, such as
136
+ * when running tests.
137
+ *
138
+ * @property _document
139
+ * @type {document}
140
+ */
125
141
  function Date(args) {
126
142
  var _this;
127
143
 
128
144
  _classCallCheck(this, Date);
129
145
 
130
- _this = _possibleConstructorReturn(this, _getPrototypeOf(Date).call(this, args));
146
+ _this = _super.call(this, args);
131
147
 
132
148
  _defineProperty(_assertThisInitialized(_this), "_document", document);
133
149
 
@@ -353,154 +369,9 @@ function (_React$Component) {
353
369
  * @return {Boolean}
354
370
  */
355
371
 
356
- }, {
357
- key: "disabledDays",
358
-
359
- /**
360
- * Returns the disabled array of days specified by props maxDate and minDate
361
- *
362
- * @method disabledDays
363
- * @return {Array}
364
- */
365
- value: function disabledDays() {
366
- if (!this.props.minDate && !this.props.maxDate) {
367
- return null;
368
- }
369
-
370
- var days = [];
371
-
372
- if (this.props.minDate) {
373
- days.push({
374
- before: _date2.default.stringToDate(this.props.minDate)
375
- });
376
- }
377
-
378
- if (this.props.maxDate) {
379
- days.push({
380
- after: _date2.default.stringToDate(this.props.maxDate)
381
- });
382
- }
383
-
384
- return days;
385
- }
386
- /**
387
- * A getter that returns datepicker specific props
388
- *
389
- * @method datePickerProps
390
- * @return {Object}
391
- */
392
-
393
- }, {
394
- key: "getInputBoundingRect",
395
-
396
- /**
397
- * Returns the bounding rect for the input
398
- *
399
- * @method getInputBoundingRect
400
- * @return {Object}
401
- */
402
- value: function getInputBoundingRect() {
403
- return this._input.getBoundingClientRect();
404
- }
405
- /**
406
- * Returns the style for the DayPicker container
407
- *
408
- * @method containerStyle
409
- * @return {Object}
410
- */
411
-
412
- }, {
413
- key: "renderDatePicker",
414
-
415
- /**
416
- * Returns the DayPicker component
417
- *
418
- * @method renderDatePicker
419
- * @return {Object} JSX
420
- */
421
- value: function renderDatePicker() {
422
- return this.state.open && _react.default.createElement(_portal.default, {
423
- onReposition: this.updateDatePickerPosition
424
- }, _react.default.createElement(_reactDayPicker.default, _extends({}, this.datePickerProps, {
425
- containerProps: this.containerProps
426
- })));
427
- }
428
- }, {
429
- key: "renderHiddenInput",
430
- value: function renderHiddenInput() {
431
- var _this2 = this;
432
-
433
- return _react.default.createElement("input", _extends({}, this.hiddenInputProps, {
434
- ref: function ref(node) {
435
- _this2.hidden = node;
436
- }
437
- }));
438
- }
439
- /**
440
- * Renders the component.
441
- *
442
- * @method render
443
- * @return {Object} JSX
444
- */
445
-
446
- }, {
447
- key: "render",
448
- value: function render() {
449
- return _react.default.createElement("div", _extends({
450
- className: this.mainClasses,
451
- onClick: this.handleWidgetClick
452
- }, (0, _tags.default)('date', this.props)), this.labelHTML, this.inputHTML, this.renderHiddenInput(), this.renderDatePicker(), this.fieldHelpHTML);
453
- }
454
- /**
455
- * Formats the visible date using i18n
456
- *
457
- * @method visibleFormat
458
- * @return {String} formatted date string
459
- */
460
-
461
- }, {
462
- key: "visibleFormat",
463
- value: function visibleFormat() {
464
- return _i18nJs.default.t('date.formats.javascript', {
465
- defaultValue: 'DD/MM/YYYY'
466
- }).toUpperCase();
467
- }
468
- /**
469
- * Sets the hidden format
470
- *
471
- * @method hiddenFormat
472
- * @return {String} formatted date string
473
- */
474
-
475
- }, {
476
- key: "hiddenFormat",
477
- value: function hiddenFormat() {
478
- return 'YYYY-MM-DD';
479
- }
480
- /**
481
- * Adds delimiters to the value
482
- *
483
- * @method formatVisibleValue
484
- * @param {String} value Unformatted Value
485
- * @return {String} formatted visible value
486
- */
487
-
488
- }, {
489
- key: "formatVisibleValue",
490
- value: function formatVisibleValue(value) {
491
- if (this.props.allowEmptyValue && !value.length) {
492
- return '';
493
- } // Don't sanitize so it accepts the hidden format (with dash separators)
494
-
495
-
496
- return _date2.default.formatValue(value || today, this.visibleFormat(), {
497
- formats: this.hiddenFormat(),
498
- sanitize: false
499
- });
500
- }
501
372
  }, {
502
373
  key: "inputProps",
503
-
374
+ get:
504
375
  /**
505
376
  * A getter that combines props passed down from the input decorator with
506
377
  * date specific props.
@@ -508,7 +379,7 @@ function (_React$Component) {
508
379
  * @method inputProps
509
380
  * @return {Object} props for the visible input
510
381
  */
511
- get: function get() {
382
+ function get() {
512
383
  var _validProps = (0, _ether.validProps)(this),
513
384
  props = Object.assign({}, _validProps);
514
385
 
@@ -595,10 +466,47 @@ function (_React$Component) {
595
466
 
596
467
  return this.inputIconHTML('calendar');
597
468
  }
469
+ /**
470
+ * Returns the disabled array of days specified by props maxDate and minDate
471
+ *
472
+ * @method disabledDays
473
+ * @return {Array}
474
+ */
475
+
476
+ }, {
477
+ key: "disabledDays",
478
+ value: function disabledDays() {
479
+ if (!this.props.minDate && !this.props.maxDate) {
480
+ return null;
481
+ }
482
+
483
+ var days = [];
484
+
485
+ if (this.props.minDate) {
486
+ days.push({
487
+ before: _date2.default.stringToDate(this.props.minDate)
488
+ });
489
+ }
490
+
491
+ if (this.props.maxDate) {
492
+ days.push({
493
+ after: _date2.default.stringToDate(this.props.maxDate)
494
+ });
495
+ }
496
+
497
+ return days;
498
+ }
499
+ /**
500
+ * A getter that returns datepicker specific props
501
+ *
502
+ * @method datePickerProps
503
+ * @return {Object}
504
+ */
505
+
598
506
  }, {
599
507
  key: "datePickerProps",
600
508
  get: function get() {
601
- var _this3 = this;
509
+ var _this2 = this;
602
510
 
603
511
  var date = this.state.datePickerValue;
604
512
 
@@ -614,10 +522,10 @@ function (_React$Component) {
614
522
  inline: true,
615
523
  locale: _i18nJs.default.locale,
616
524
  localeUtils: _moment.default,
617
- navbarElement: _react.default.createElement(_navbar.default, null),
525
+ navbarElement: /*#__PURE__*/_react.default.createElement(_navbar.default, null),
618
526
  onDayClick: this.handleDateSelect,
619
527
  ref: function ref(input) {
620
- _this3.datepicker = input;
528
+ _this2.datepicker = input;
621
529
  },
622
530
  selectedDays: [this.state.datePickerValue]
623
531
  };
@@ -629,23 +537,56 @@ function (_React$Component) {
629
537
  * @return {Void}
630
538
  */
631
539
 
540
+ }, {
541
+ key: "getInputBoundingRect",
542
+ value:
543
+ /**
544
+ * Returns the bounding rect for the input
545
+ *
546
+ * @method getInputBoundingRect
547
+ * @return {Object}
548
+ */
549
+ function getInputBoundingRect() {
550
+ return this._input.getBoundingClientRect();
551
+ }
552
+ /**
553
+ * Returns the style for the DayPicker container
554
+ *
555
+ * @method containerStyle
556
+ * @return {Object}
557
+ */
558
+
632
559
  }, {
633
560
  key: "containerStyle",
634
561
  get: function get() {
635
562
  var inputRect = this.getInputBoundingRect();
636
563
  var offsetY = window.pageYOffset;
637
564
 
638
- if (this.props.showPickerOnTop) {
639
- return {
640
- left: inputRect.left,
641
- bottom: 2 - (offsetY + inputRect.top)
642
- };
565
+ switch (this.props.positionDatePicker) {
566
+ case 'top-left':
567
+ return {
568
+ right: -inputRect.right,
569
+ bottom: 2 - (offsetY + inputRect.top)
570
+ };
571
+
572
+ case 'top-right':
573
+ return {
574
+ left: inputRect.left,
575
+ bottom: 2 - (offsetY + inputRect.top)
576
+ };
577
+
578
+ case 'bottom-left':
579
+ return {
580
+ right: -inputRect.right,
581
+ top: inputRect.bottom + offsetY
582
+ };
583
+
584
+ default:
585
+ return {
586
+ left: inputRect.left,
587
+ top: inputRect.bottom + offsetY
588
+ };
643
589
  }
644
-
645
- return {
646
- left: inputRect.left,
647
- top: inputRect.bottom + offsetY
648
- };
649
590
  }
650
591
  /**
651
592
  * Returns the props for the DayPicker container
@@ -662,6 +603,95 @@ function (_React$Component) {
662
603
  onClick: this.handleWidgetClick
663
604
  };
664
605
  }
606
+ /**
607
+ * Returns the DayPicker component
608
+ *
609
+ * @method renderDatePicker
610
+ * @return {Object} JSX
611
+ */
612
+
613
+ }, {
614
+ key: "renderDatePicker",
615
+ value: function renderDatePicker() {
616
+ return this.state.open && /*#__PURE__*/_react.default.createElement(_portal.default, {
617
+ onReposition: this.updateDatePickerPosition
618
+ }, /*#__PURE__*/_react.default.createElement(_reactDayPicker.default, _extends({}, this.datePickerProps, {
619
+ containerProps: this.containerProps
620
+ })));
621
+ }
622
+ }, {
623
+ key: "renderHiddenInput",
624
+ value: function renderHiddenInput() {
625
+ var _this3 = this;
626
+
627
+ return /*#__PURE__*/_react.default.createElement("input", _extends({}, this.hiddenInputProps, {
628
+ ref: function ref(node) {
629
+ _this3.hidden = node;
630
+ }
631
+ }));
632
+ }
633
+ /**
634
+ * Renders the component.
635
+ *
636
+ * @method render
637
+ * @return {Object} JSX
638
+ */
639
+
640
+ }, {
641
+ key: "render",
642
+ value: function render() {
643
+ return /*#__PURE__*/_react.default.createElement("div", _extends({
644
+ className: this.mainClasses,
645
+ onClick: this.handleWidgetClick
646
+ }, (0, _tags.default)('date', this.props)), this.labelHTML, this.inputHTML, this.renderHiddenInput(), this.renderDatePicker(), this.fieldHelpHTML);
647
+ }
648
+ /**
649
+ * Formats the visible date using i18n
650
+ *
651
+ * @method visibleFormat
652
+ * @return {String} formatted date string
653
+ */
654
+
655
+ }, {
656
+ key: "visibleFormat",
657
+ value: function visibleFormat() {
658
+ return _i18nJs.default.t('date.formats.javascript', {
659
+ defaultValue: 'DD/MM/YYYY'
660
+ }).toUpperCase();
661
+ }
662
+ /**
663
+ * Sets the hidden format
664
+ *
665
+ * @method hiddenFormat
666
+ * @return {String} formatted date string
667
+ */
668
+
669
+ }, {
670
+ key: "hiddenFormat",
671
+ value: function hiddenFormat() {
672
+ return 'YYYY-MM-DD';
673
+ }
674
+ /**
675
+ * Adds delimiters to the value
676
+ *
677
+ * @method formatVisibleValue
678
+ * @param {String} value Unformatted Value
679
+ * @return {String} formatted visible value
680
+ */
681
+
682
+ }, {
683
+ key: "formatVisibleValue",
684
+ value: function formatVisibleValue(value) {
685
+ if (this.props.allowEmptyValue && !value.length) {
686
+ return '';
687
+ } // Don't sanitize so it accepts the hidden format (with dash separators)
688
+
689
+
690
+ return _date2.default.formatValue(value || today, this.visibleFormat(), {
691
+ formats: this.hiddenFormat(),
692
+ sanitize: false
693
+ });
694
+ }
665
695
  }]);
666
696
 
667
697
  return Date;
@@ -739,12 +769,12 @@ function (_React$Component) {
739
769
  allowEmptyValue: _propTypes.default.bool,
740
770
 
741
771
  /**
742
- * Display the date picker component on top of the input
772
+ * Choose where displayed the date picker
743
773
  *
744
- * @property showPickerOnTop
774
+ * @property positionDatePicker
745
775
  * @type {Boolean}
746
776
  */
747
- showPickerOnTop: _propTypes.default.bool
777
+ positionDatePicker: _propTypes.default.oneOf(_optionsHelper.default.positionDatePicker)
748
778
  }), _defineProperty(_class, "defaultProps", {
749
779
  /**
750
780
  * Sets the default value of the date field
@@ -763,14 +793,6 @@ function (_React$Component) {
763
793
  * @default DateValidator
764
794
  */
765
795
  internalValidations: [new _date3.default()]
766
- /**
767
- * Stores the document - allows us to override it different contexts, such as
768
- * when running tests.
769
- *
770
- * @property _document
771
- * @type {document}
772
- */
773
-
774
- }), _temp)))));
796
+ }), _class)))));
775
797
  var _default = Date;
776
798
  exports.default = _default;
@@ -17,23 +17,23 @@ var Navbar = function Navbar(_ref) {
17
17
  var onPreviousClick = _ref.onPreviousClick,
18
18
  onNextClick = _ref.onNextClick,
19
19
  className = _ref.className;
20
- return _react.default.createElement("div", {
20
+ return /*#__PURE__*/_react.default.createElement("div", {
21
21
  className: className
22
- }, _react.default.createElement("button", {
22
+ }, /*#__PURE__*/_react.default.createElement("button", {
23
23
  type: "button",
24
24
  className: "DayPicker-NavButton DayPicker-NavButton--prev",
25
25
  onClick: function onClick() {
26
26
  return onPreviousClick();
27
27
  }
28
- }, _react.default.createElement("span", {
28
+ }, /*#__PURE__*/_react.default.createElement("span", {
29
29
  className: "DayPicker-NavButton__arrow"
30
- }, "\u2039")), _react.default.createElement("button", {
30
+ }, "\u2039")), /*#__PURE__*/_react.default.createElement("button", {
31
31
  type: "button",
32
32
  className: "DayPicker-NavButton DayPicker-NavButton--next",
33
33
  onClick: function onClick() {
34
34
  return onNextClick();
35
35
  }
36
- }, _react.default.createElement("span", {
36
+ }, /*#__PURE__*/_react.default.createElement("span", {
37
37
  className: "DayPicker-NavButton__arrow"
38
38
  }, "\u203A")));
39
39
  };