@councilbox/councilbox-ui 2.0.55 → 2.0.56

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 (48) hide show
  1. package/ScrollbarOld.js +3 -0
  2. package/dist/HOCs/usePopoverPosition.js +2 -0
  3. package/dist/build-index.js +3 -3
  4. package/dist/components/1.Introduction.stories.mdx +1 -1
  5. package/dist/components/2.Changelog.stories.mdx +12 -1
  6. package/dist/components/Button/Button.js +15 -0
  7. package/dist/components/ButtonBasic/ButtonBasic.js +15 -0
  8. package/dist/components/Checkbox/Checkbox.js +2 -2
  9. package/dist/components/DatePicker/DatePicker.js +105 -24
  10. package/dist/components/DatePicker/dateUtils.js +62 -15
  11. package/dist/components/DateRangePicker/DateRangePicker.js +134 -39
  12. package/dist/components/DateTimePicker/DateTimePicker.js +99 -39
  13. package/dist/components/DragDrop/DragDrop.js +17 -4
  14. package/dist/components/Header/Header.js +104 -17
  15. package/dist/components/InputAutocomplete/InputAutocomplete.js +15 -0
  16. package/dist/components/InputPassword/InputPassword.js +14 -1
  17. package/dist/components/InputTextArea/InputTextArea.js +14 -0
  18. package/dist/components/LoadingSection/LoadingSection.js +16 -4
  19. package/dist/components/MenuItem/MenuItem.js +13 -0
  20. package/dist/components/MenuLateralLeft/MenuLateralLeft.js +16 -2
  21. package/dist/components/MenuLateralRight/MenuLateralRight.js +16 -2
  22. package/dist/components/Modal/Modal.js +13 -0
  23. package/dist/components/RadioButton/Radio.js +15 -0
  24. package/dist/components/RichTextInput/DesignRichTextInput.stories.js +2 -2
  25. package/dist/components/RichTextInput/RichTextInput.css +55 -12
  26. package/dist/components/RichTextInput/RichTextInput.js +223 -17
  27. package/dist/components/Scrollbar/Scrollbar.css +60 -19
  28. package/dist/components/Scrollbar/Scrollbar.js +384 -62
  29. package/dist/components/{ScrollbarNew/DesignScrollbarNew.js → ScrollbarOld/DesignScrollbarOld.js} +5 -5
  30. package/dist/components/ScrollbarOld/ScrollbarOld.css +38 -0
  31. package/dist/components/ScrollbarOld/ScrollbarOld.js +104 -0
  32. package/dist/components/{ScrollbarNew/ScrollbarNew.stories.js → ScrollbarOld/ScrollbarOld.stories.js} +13 -13
  33. package/dist/components/SelectInput/SelectInput.js +27 -8
  34. package/dist/components/Slider/Slider.js +15 -0
  35. package/dist/components/Stars/Stars.js +13 -0
  36. package/dist/components/Stepper/Stepper.js +15 -2
  37. package/dist/components/Table/TableSortLabel.js +11 -0
  38. package/dist/components/Tabs/Tabs.js +13 -1
  39. package/dist/components/Tag/Tag.js +16 -0
  40. package/dist/components/TextInput/TextInput.js +13 -0
  41. package/dist/components/TimePicker/TimePicker.js +97 -15
  42. package/dist/components/Toast/Toast.js +15 -2
  43. package/dist/components/Toast/toastStore.js +13 -2
  44. package/dist/components/Tooltip/Tooltip.js +17 -0
  45. package/package.json +2 -2
  46. package/ScrollbarNew.js +0 -3
  47. package/dist/components/ScrollbarNew/ScrollbarNew.css +0 -79
  48. package/dist/components/ScrollbarNew/ScrollbarNew.js +0 -426
@@ -0,0 +1,3 @@
1
+ 'use strict';
2
+
3
+ module.exports = require('./dist/components/ScrollbarOld/ScrollbarOld');
@@ -212,8 +212,10 @@ var usePopoverPosition = function usePopoverPosition(_ref2) {
212
212
  if (!isOpen) return undefined;
213
213
  scheduleAdjustPosition();
214
214
  window.addEventListener('resize', scheduleAdjustPosition);
215
+ window.addEventListener('scroll', scheduleAdjustPosition, true);
215
216
  return function () {
216
217
  window.removeEventListener('resize', scheduleAdjustPosition);
218
+ window.removeEventListener('scroll', scheduleAdjustPosition, true);
217
219
  if (debounceRef.current) {
218
220
  clearTimeout(debounceRef.current);
219
221
  }
@@ -201,10 +201,10 @@ Object.defineProperty(exports, "Scrollbar", {
201
201
  return _Scrollbar["default"];
202
202
  }
203
203
  });
204
- Object.defineProperty(exports, "ScrollbarNew", {
204
+ Object.defineProperty(exports, "ScrollbarOld", {
205
205
  enumerable: true,
206
206
  get: function get() {
207
- return _ScrollbarNew["default"];
207
+ return _ScrollbarOld["default"];
208
208
  }
209
209
  });
210
210
  Object.defineProperty(exports, "SelectInput", {
@@ -411,7 +411,7 @@ var _DateTimePicker = _interopRequireDefault(require("./components/DateTimePicke
411
411
  var _DateRangePicker = _interopRequireDefault(require("./components/DateRangePicker/DateRangePicker"));
412
412
  var _TimePicker = _interopRequireDefault(require("./components/TimePicker/TimePicker"));
413
413
  var _Scrollbar = _interopRequireDefault(require("./components/Scrollbar/Scrollbar"));
414
- var _ScrollbarNew = _interopRequireDefault(require("./components/ScrollbarNew/ScrollbarNew"));
414
+ var _ScrollbarOld = _interopRequireDefault(require("./components/ScrollbarOld/ScrollbarOld"));
415
415
  var _RichTextInput = _interopRequireDefault(require("./components/RichTextInput/RichTextInput"));
416
416
  var _ToastProvider = _interopRequireDefault(require("./components/Toast/ToastProvider"));
417
417
  var _useToast = require("./components/Toast/useToast");
@@ -16,7 +16,7 @@ a.noStyles:hover{
16
16
  `}</style>
17
17
 
18
18
 
19
- # Librería de componentes ui-councilbox NEW v2.0.55 &#127881;
19
+ # Librería de componentes ui-councilbox NEW v2.0.56 &#127881;
20
20
 
21
21
  <h2>Componentes:</h2>
22
22
  <div><a class='noStyles' href='/story/components-accordion--default'>Accordion</a></div>
@@ -25,8 +25,19 @@ a.noStyles:hover{
25
25
  <div>Fix zIndex label InputText y SelectInput</div>
26
26
  </div>
27
27
 
28
+ <h2>v2.0.56</h2>
29
+ <div>Fix Pickers errors</div>
30
+ <div>Fix RichTextInput errors</div>
31
+ <div>Fix Toast errors</div>
32
+ <div>Fix Inputs labels</div>
33
+ <div>Change Scrollbar Old to New</div>
34
+ <div>Add arial labels in Header</div>
35
+ <div>Add requireAccessibleText all components</div>
36
+ <div>Fix erros Checkbox</div>
37
+ <div>Fix erro position Tooltip</div>
38
+
28
39
  <h2>v2.0.55</h2>
29
- <div>Updated Accordion component to comply with WCAG 2.1 AA</div>
40
+ <div>Updated Accordion component to comply with WCAG 2.1 AA</div>
30
41
  <div>Updated Alert component to comply with WCAG 2.1 AA</div>
31
42
  <div>Updated Avatar component to comply with WCAG 2.1 AA</div>
32
43
  <div>Updated Block component to comply with WCAG 2.1 AA</div>
@@ -13,6 +13,7 @@ require("./button.css");
13
13
  var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
14
14
  var _styled = _interopRequireDefault(require("@mui/material/styles/styled"));
15
15
  var _Typography = _interopRequireDefault(require("../Typography/Typography"));
16
+ var _useA11yGuard2 = require("../../HOCs/useA11yGuard");
16
17
  var _excluded = ["id", "text", "onClick", "disabled", "loading", "variant", "fullWidth", "icon", "endIcon", "variantText", "stylesButton", "stylesText", "darkMode"];
17
18
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
18
19
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) { ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } } return n; }, _extends.apply(null, arguments); }
@@ -67,6 +68,20 @@ var Button = function Button(_ref) {
67
68
  stylesText = _ref.stylesText,
68
69
  darkMode = _ref.darkMode,
69
70
  props = _objectWithoutProperties(_ref, _excluded);
71
+ var _useA11yGuard = (0, _useA11yGuard2.useA11yGuard)(),
72
+ requireAccessibleText = _useA11yGuard.requireAccessibleText;
73
+ requireAccessibleText(text || props['aria-label'], {
74
+ component: 'Button',
75
+ prop: '"text" o "aria-label"',
76
+ hint: 'Un botón sin texto visible (por ejemplo, uno que solo muestra un icono) debe llevar un "aria-label" para que los lectores de pantalla puedan anunciarlo.',
77
+ receivedProps: {
78
+ text: text,
79
+ icon: icon,
80
+ endIcon: endIcon,
81
+ disabled: disabled,
82
+ id: id
83
+ }
84
+ });
70
85
  var buttonVariant;
71
86
  var buttonColor;
72
87
  var background;
@@ -13,6 +13,7 @@ var _LoadingSection = _interopRequireDefault(require("../LoadingSection/LoadingS
13
13
  var _Typography = _interopRequireDefault(require("../Typography/Typography"));
14
14
  var _useDynamicStyles2 = _interopRequireDefault(require("../../HOCs/useDynamicStyles"));
15
15
  var _useRipple3 = _interopRequireDefault(require("../../HOCs/useRipple"));
16
+ var _useA11yGuard2 = require("../../HOCs/useA11yGuard");
16
17
  var _excluded = ["id", "text", "onClick", "disabled", "loading", "variant", "fullWidth", "icon", "variantText", "stylesButton", "sx", "badge", "resetDelay", "reset", "error", "success", "startIcon", "endIcon", "className", "style", "prefixClass", "component", "badgeAriaLabel", "loadingAriaLabel"];
17
18
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
18
19
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) { ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } } return n; }, _extends.apply(null, arguments); }
@@ -61,6 +62,20 @@ var ButtonBasic = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref)
61
62
  stylesInLine = _useDynamicStyles.stylesInLine,
62
63
  dynamicPrefixClass = _useDynamicStyles.prefixClass;
63
64
  var prefixClass = propPrefixClass || dynamicPrefixClass;
65
+ var _useA11yGuard = (0, _useA11yGuard2.useA11yGuard)(),
66
+ requireAccessibleText = _useA11yGuard.requireAccessibleText;
67
+ requireAccessibleText(text || props['aria-label'], {
68
+ component: 'ButtonBasic',
69
+ prop: '"text" o "aria-label"',
70
+ hint: 'Un botón sin texto visible (por ejemplo, uno que solo muestra un icono) debe llevar un "aria-label" para que los lectores de pantalla puedan anunciarlo.',
71
+ receivedProps: {
72
+ text: text,
73
+ icon: icon,
74
+ endIcon: endIcon,
75
+ disabled: disabled,
76
+ id: id
77
+ }
78
+ });
64
79
  var variantRipples = function variantRipples() {
65
80
  if (variant === 'primary') {
66
81
  return '#ffffff47';
@@ -101,9 +101,9 @@ var Checkbox = function Checkbox(_ref) {
101
101
  type: "checkbox",
102
102
  checked: checked,
103
103
  onChange: handleChange,
104
- onClick: function onClick(e) {
104
+ onClick: onChange ? function (e) {
105
105
  return e.stopPropagation();
106
- },
106
+ } : undefined,
107
107
  "aria-label": !label && !ariaLabelledby ? ariaLabel || 'Checkbox' : undefined,
108
108
  "aria-labelledby": ariaLabelledby || undefined
109
109
  }), !disabled && ripples, checked ? indeterminate ? /*#__PURE__*/_react["default"].createElement("svg", {
@@ -12,12 +12,14 @@ require("../../styles/main.css");
12
12
  require("./DatePicker.css");
13
13
  var _InputText = _interopRequireDefault(require("../InputText/InputText"));
14
14
  var _IconButton = _interopRequireDefault(require("../IconButton/IconButton"));
15
+ var _Modal = _interopRequireDefault(require("../Modal/Modal"));
15
16
  var _Calendar = _interopRequireDefault(require("./Calendar"));
16
17
  var _useDynamicStyles2 = _interopRequireDefault(require("../../HOCs/useDynamicStyles"));
17
18
  var _usePopoverPosition2 = _interopRequireDefault(require("../../HOCs/usePopoverPosition"));
18
19
  var _useFallbackId = _interopRequireDefault(require("../../utils/useFallbackId"));
20
+ var _useA11yGuard2 = require("../../HOCs/useA11yGuard");
19
21
  var _dateUtils = require("./dateUtils");
20
- var _excluded = ["value", "defaultValue", "onChange", "format", "locale", "months", "monthsShort", "weekDays", "localeText", "label", "helper", "helperText", "error", "required", "disabled", "readOnly", "fullWidth", "variant", "id", "name", "className", "sx", "style", "minDate", "maxDate", "disablePast", "disableFuture", "shouldDisableDate", "views", "openTo", "open", "onOpen", "onClose", "clearable", "closeOnSelect", "placeholder", "autoFocus", "InputProps", "prefixClass", "aria-label"];
22
+ var _excluded = ["value", "defaultValue", "onChange", "format", "locale", "months", "monthsShort", "weekDays", "localeText", "label", "helper", "helperText", "error", "required", "disabled", "readOnly", "fullWidth", "variant", "id", "name", "className", "sx", "style", "minDate", "maxDate", "disablePast", "disableFuture", "shouldDisableDate", "views", "openTo", "open", "onOpen", "onClose", "clearable", "closeOnSelect", "placeholder", "autoFocus", "isMobile", "showInModal", "cancelButtonText", "saveButtonText", "InputProps", "prefixClass", "aria-label"];
21
23
  /* eslint-disable no-tabs */
22
24
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
23
25
  function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) { ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } } return n; }, _extends.apply(null, arguments); }
@@ -80,6 +82,14 @@ var DatePicker = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref)
80
82
  closeOnSelect = _ref$closeOnSelect === void 0 ? true : _ref$closeOnSelect,
81
83
  placeholder = _ref.placeholder,
82
84
  autoFocus = _ref.autoFocus,
85
+ _ref$isMobile = _ref.isMobile,
86
+ isMobile = _ref$isMobile === void 0 ? false : _ref$isMobile,
87
+ _ref$showInModal = _ref.showInModal,
88
+ showInModal = _ref$showInModal === void 0 ? false : _ref$showInModal,
89
+ _ref$cancelButtonText = _ref.cancelButtonText,
90
+ cancelButtonText = _ref$cancelButtonText === void 0 ? 'Cancel' : _ref$cancelButtonText,
91
+ _ref$saveButtonText = _ref.saveButtonText,
92
+ saveButtonText = _ref$saveButtonText === void 0 ? 'Save' : _ref$saveButtonText,
83
93
  _ref$InputProps = _ref.InputProps,
84
94
  InputProps = _ref$InputProps === void 0 ? {} : _ref$InputProps,
85
95
  propPrefixClass = _ref.prefixClass,
@@ -89,6 +99,23 @@ var DatePicker = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref)
89
99
  stylesInLine = _useDynamicStyles.stylesInLine,
90
100
  dynamicPrefixClass = _useDynamicStyles.prefixClass;
91
101
  var prefixClass = propPrefixClass || dynamicPrefixClass;
102
+ // isMobile forces a real phone-sized modal; showInModal lets a desktop consumer
103
+ // opt into the same Modal presentation (e.g. a compact dialog) without the mobile styling.
104
+ var isModalMode = isMobile || showInModal;
105
+ var _useA11yGuard = (0, _useA11yGuard2.useA11yGuard)(),
106
+ requireAccessibleText = _useA11yGuard.requireAccessibleText;
107
+ requireAccessibleText(label || ariaLabel, {
108
+ component: 'DatePicker',
109
+ prop: '"label" o "aria-label"',
110
+ hint: 'Un selector de fecha debe contar con una etiqueta visible (label) o un "aria-label" para ser identificado por los lectores de pantalla.',
111
+ receivedProps: {
112
+ label: label,
113
+ ariaLabel: ariaLabel,
114
+ placeholder: placeholder,
115
+ id: id,
116
+ disabled: disabled
117
+ }
118
+ });
92
119
  var resolvedFormat = format || _react["default"].useMemo(function () {
93
120
  return (0, _dateUtils.getLocaleDateFormat)(locale);
94
121
  }, [locale]);
@@ -129,6 +156,11 @@ var DatePicker = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref)
129
156
  _React$useState8 = _slicedToArray(_React$useState7, 2),
130
157
  viewDate = _React$useState8[0],
131
158
  setViewDate = _React$useState8[1];
159
+ // Modal mode defers commit until "Save" is pressed, so selection is staged here first.
160
+ var _React$useState9 = _react["default"].useState(selectedValue),
161
+ _React$useState0 = _slicedToArray(_React$useState9, 2),
162
+ mobileDraftValue = _React$useState0[0],
163
+ setMobileDraftValue = _React$useState0[1];
132
164
  var containerRef = _react["default"].useRef(null);
133
165
  var popoverRef = _react["default"].useRef(null);
134
166
  var portalRef = _react["default"].useRef(null);
@@ -170,12 +202,22 @@ var DatePicker = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref)
170
202
  var openPicker = function openPicker() {
171
203
  if (disabled || readOnly) return;
172
204
  setViewDate((0, _dateUtils.isValidDate)(selectedValue) ? selectedValue : new Date());
205
+ setMobileDraftValue((0, _dateUtils.isValidDate)(selectedValue) ? selectedValue : null);
173
206
  updateOpen(true);
174
207
  setTimeout(adjustPosition, 0);
175
208
  };
176
209
  var closePicker = function closePicker() {
177
210
  return updateOpen(false);
178
211
  };
212
+ var handleMobileSave = function handleMobileSave() {
213
+ updateValue(mobileDraftValue);
214
+ setInputText((0, _dateUtils.isValidDate)(mobileDraftValue) ? (0, _dateUtils.formatDate)(mobileDraftValue, resolvedFormat, locale) : '');
215
+ closePicker();
216
+ };
217
+ var handleMobileCancel = function handleMobileCancel() {
218
+ setMobileDraftValue((0, _dateUtils.isValidDate)(selectedValue) ? selectedValue : null);
219
+ closePicker();
220
+ };
179
221
  _react["default"].useEffect(function () {
180
222
  if (!isOpen) return undefined;
181
223
  var handleEscape = function handleEscape(event) {
@@ -191,6 +233,11 @@ var DatePicker = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref)
191
233
  openPicker();
192
234
  };
193
235
  var handleDaySelect = function handleDaySelect(date) {
236
+ if (isModalMode) {
237
+ setMobileDraftValue(date);
238
+ setViewDate(date);
239
+ return;
240
+ }
194
241
  updateValue(date);
195
242
  setInputText((0, _dateUtils.formatDate)(date, resolvedFormat, locale));
196
243
  if (closeOnSelect) closePicker();
@@ -241,6 +288,30 @@ var DatePicker = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref)
241
288
  inputRef.current = node;
242
289
  if (typeof ref === 'function') ref(node);else if (ref) ref.current = node;
243
290
  };
291
+
292
+ // Shared between the anchored popover and the Modal below -
293
+ // same calendar, just a different container (and draft-vs-committed value) depending on isModalMode.
294
+ var calendarValue = isModalMode ? mobileDraftValue : selectedValue;
295
+ var calendarElement = /*#__PURE__*/_react["default"].createElement(_Calendar["default"], {
296
+ viewDate: viewDate,
297
+ onViewDateChange: setViewDate,
298
+ value: (0, _dateUtils.isValidDate)(calendarValue) ? calendarValue : null,
299
+ onSelect: handleDaySelect,
300
+ minDate: minDateJs,
301
+ maxDate: maxDateJs,
302
+ disablePast: disablePast,
303
+ disableFuture: disableFuture,
304
+ shouldDisableDate: shouldDisableDate,
305
+ views: views,
306
+ openTo: openTo,
307
+ locale: locale,
308
+ months: months,
309
+ monthsShort: monthsShort,
310
+ weekDays: weekDays,
311
+ localeText: localeText,
312
+ prefixClass: prefixClass,
313
+ id: "".concat(pickerId, "-calendar")
314
+ });
244
315
  return (
245
316
  /*#__PURE__*/
246
317
  // eslint-disable-next-line jsx-a11y/click-events-have-key-events, jsx-a11y/no-static-element-interactions
@@ -297,7 +368,28 @@ var DatePicker = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref)
297
368
  "aria-label": texts.openCalendarText
298
369
  }))
299
370
  }, InputProps)
300
- }, props)), isOpen && /*#__PURE__*/(0, _reactDom.createPortal)(/*#__PURE__*/_react["default"].createElement("div", {
371
+ }, props)), isOpen && (isModalMode ? /*#__PURE__*/_react["default"].createElement(_Modal["default"], {
372
+ id: "".concat(pickerId, "-modal"),
373
+ open: isOpen,
374
+ requestClose: handleMobileCancel,
375
+ title: label || texts.pickerLabel,
376
+ bodyText: calendarElement,
377
+ buttonCancel: cancelButtonText,
378
+ cancelAction: handleMobileCancel,
379
+ buttonAccept: saveButtonText,
380
+ acceptAction: handleMobileSave,
381
+ fullWidth: isMobile,
382
+ sx: isMobile ? undefined : {
383
+ '.cbx-Modal-body': {
384
+ maxWidth: '21rem !important',
385
+ minWidth: '21rem !important'
386
+ },
387
+ '.cbx-Modal-content': {
388
+ maxWidth: '22.5rem !important',
389
+ minWidth: '22.5rem !important'
390
+ }
391
+ }
392
+ }) : /*#__PURE__*/(0, _reactDom.createPortal)(/*#__PURE__*/_react["default"].createElement("div", {
301
393
  className: prefixClass('cbx-datePicker-presentation'),
302
394
  role: "presentation",
303
395
  ref: portalRef
@@ -312,26 +404,7 @@ var DatePicker = /*#__PURE__*/_react["default"].forwardRef(function (_ref, ref)
312
404
  role: "dialog",
313
405
  "aria-modal": "true",
314
406
  "aria-label": label || texts.pickerLabel
315
- }, /*#__PURE__*/_react["default"].createElement(_Calendar["default"], {
316
- viewDate: viewDate,
317
- onViewDateChange: setViewDate,
318
- value: (0, _dateUtils.isValidDate)(selectedValue) ? selectedValue : null,
319
- onSelect: handleDaySelect,
320
- minDate: minDateJs,
321
- maxDate: maxDateJs,
322
- disablePast: disablePast,
323
- disableFuture: disableFuture,
324
- shouldDisableDate: shouldDisableDate,
325
- views: views,
326
- openTo: openTo,
327
- locale: locale,
328
- months: months,
329
- monthsShort: monthsShort,
330
- weekDays: weekDays,
331
- localeText: localeText,
332
- prefixClass: prefixClass,
333
- id: "".concat(pickerId, "-calendar")
334
- }))), document.body))
407
+ }, calendarElement)), document.body)))
335
408
  );
336
409
  });
337
410
  DatePicker.propTypes = {
@@ -369,7 +442,11 @@ DatePicker.propTypes = {
369
442
  clearable: _propTypes["default"].bool,
370
443
  closeOnSelect: _propTypes["default"].bool,
371
444
  placeholder: _propTypes["default"].string,
372
- autoFocus: _propTypes["default"].bool
445
+ autoFocus: _propTypes["default"].bool,
446
+ isMobile: _propTypes["default"].bool,
447
+ showInModal: _propTypes["default"].bool,
448
+ cancelButtonText: _propTypes["default"].string,
449
+ saveButtonText: _propTypes["default"].string
373
450
  };
374
451
  DatePicker.defaultProps = {
375
452
  locale: _dateUtils.DEFAULT_LOCALE,
@@ -378,7 +455,11 @@ DatePicker.defaultProps = {
378
455
  fullWidth: false,
379
456
  variant: 'outlined',
380
457
  clearable: true,
381
- closeOnSelect: true
458
+ closeOnSelect: true,
459
+ isMobile: false,
460
+ showInModal: false,
461
+ cancelButtonText: 'Cancel',
462
+ saveButtonText: 'Save'
382
463
  };
383
464
  var _default = DatePicker;
384
465
  exports["default"] = _default;
@@ -376,22 +376,48 @@ var isTimeDisabled = function isTimeDisabled(date) {
376
376
  if (max && isValidDate(max) && date > max) return true;
377
377
  return false;
378
378
  };
379
+
380
+ // Token set covers both this library's own date-fns-style tokens (yyyy, MM,
381
+ // dd, ...) and moment's equivalents (YYYY, MM, DD, ...) so a consumer coming
382
+ // from either library can pass their existing format string unchanged.
383
+ // Deliberately NOT supported: moment's lowercase `d`/`dd`/`ddd`/`dddd`, which
384
+ // mean day-OF-WEEK in moment — adding them as day-of-month aliases would
385
+ // silently misinterpret any format string that actually meant weekday.
386
+ // Order matters: alternatives that are a prefix of another (MMM of MMMM, MM
387
+ // of MMM, YY of YYYY, D of DD, ...) must list the longer one first, since
388
+ // regex alternation takes the first match, not the longest.
379
389
  exports.isTimeDisabled = isTimeDisabled;
380
- var FORMAT_TOKEN_REGEX = /yyyy|yy|MM|dd|HH|hh|mm|ss|a/g;
390
+ var FORMAT_TOKEN_REGEX = /MMMM|MMM|yyyy|YYYY|yy|YY|MM|M|dd|DD|D|HH|hh|mm|ss|A|a/g;
381
391
 
382
392
  // Intl.DateTimeFormat dateStyle presets, for a locale-appropriate long-form
383
393
  // display (e.g. moment's 'LL' -> "11 de septiembre de 2026" / "September 11, 2026")
384
394
  // without hand-maintaining per-locale strings ourselves. Only usable for
385
395
  // display: parseDate can't reliably reverse-parse free-form localized text,
386
- // so a field using one of these stays calendar/clock-driven rather than typable.
396
+ // so a field using one of these (or a token format containing MMM/MMMM,
397
+ // which has the same problem) stays calendar/clock-driven rather than typable.
387
398
  var DATE_STYLE_KEYWORDS = ['full', 'long', 'medium', 'short'];
399
+ var NAME_BASED_TOKEN_REGEX = /MMMM|MMM/;
400
+
401
+ // A few of moment's "localized format" macros, resolved against the locale
402
+ // before the token engine runs: 'L'/'l' become the locale's own numeric
403
+ // day/month/year order (the same thing getLocaleDateFormat already computes),
404
+ // while 'LL'/'ll' fall through to the Intl dateStyle keywords above.
405
+ var LOCALIZED_FORMAT_MACROS = {
406
+ LL: 'long',
407
+ ll: 'medium'
408
+ };
409
+ var resolveFormat = function resolveFormat(format, locale) {
410
+ if (format === 'L' || format === 'l') return getLocaleDateFormat(locale);
411
+ return LOCALIZED_FORMAT_MACROS[format] || format;
412
+ };
388
413
  var formatDate = function formatDate(date, format) {
389
414
  var locale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_LOCALE;
390
415
  if (!isValidDate(date) || !format) return '';
391
- if (DATE_STYLE_KEYWORDS.includes(format)) {
416
+ var resolvedFormat = resolveFormat(format, locale);
417
+ if (DATE_STYLE_KEYWORDS.includes(resolvedFormat)) {
392
418
  try {
393
419
  return new Intl.DateTimeFormat(locale, {
394
- dateStyle: format
420
+ dateStyle: resolvedFormat
395
421
  }).format(date);
396
422
  } catch (e) {
397
423
  // fall through to token formatting below
@@ -400,18 +426,27 @@ var formatDate = function formatDate(date, format) {
400
426
  var hours24 = date.getHours();
401
427
  var hours12raw = hours24 % 12;
402
428
  var hours12 = hours12raw === 0 ? 12 : hours12raw;
429
+ var meridiem = getMeridiemText(locale, hours24);
403
430
  var replacements = {
404
431
  yyyy: date.getFullYear(),
432
+ YYYY: date.getFullYear(),
405
433
  yy: pad2(date.getFullYear() % 100),
434
+ YY: pad2(date.getFullYear() % 100),
435
+ MMMM: getMonthNames(locale, 'long')[date.getMonth()],
436
+ MMM: getMonthNames(locale, 'short')[date.getMonth()],
406
437
  MM: pad2(date.getMonth() + 1),
438
+ M: String(date.getMonth() + 1),
407
439
  dd: pad2(date.getDate()),
440
+ DD: pad2(date.getDate()),
441
+ D: String(date.getDate()),
408
442
  HH: pad2(hours24),
409
443
  hh: pad2(hours12),
410
444
  mm: pad2(date.getMinutes()),
411
445
  ss: pad2(date.getSeconds()),
412
- a: getMeridiemText(locale, hours24)
446
+ a: meridiem.toLowerCase(),
447
+ A: meridiem.toUpperCase()
413
448
  };
414
- return format.replace(FORMAT_TOKEN_REGEX, function (token) {
449
+ return resolvedFormat.replace(FORMAT_TOKEN_REGEX, function (token) {
415
450
  return String(replacements[token]);
416
451
  });
417
452
  };
@@ -421,9 +456,14 @@ var escapeRegExp = function escapeRegExp(str) {
421
456
  };
422
457
  var BASE_TOKEN_PATTERNS = {
423
458
  yyyy: '(\\d{4})',
459
+ YYYY: '(\\d{4})',
424
460
  yy: '(\\d{2})',
461
+ YY: '(\\d{2})',
425
462
  MM: '(\\d{1,2})',
463
+ M: '(\\d{1,2})',
426
464
  dd: '(\\d{1,2})',
465
+ DD: '(\\d{1,2})',
466
+ D: '(\\d{1,2})',
427
467
  HH: '(\\d{1,2})',
428
468
  hh: '(\\d{1,2})',
429
469
  mm: '(\\d{1,2})',
@@ -432,41 +472,48 @@ var BASE_TOKEN_PATTERNS = {
432
472
  var parseDate = function parseDate(value, format) {
433
473
  var locale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : DEFAULT_LOCALE;
434
474
  if (!value || !format) return null;
435
- if (DATE_STYLE_KEYWORDS.includes(format)) return null;
475
+ var resolvedFormat = resolveFormat(format, locale);
476
+ if (DATE_STYLE_KEYWORDS.includes(resolvedFormat) || NAME_BASED_TOKEN_REGEX.test(resolvedFormat)) return null;
436
477
  var amText = getMeridiemText(locale, 9);
437
478
  var pmText = getMeridiemText(locale, 21);
438
479
  var tokenPatterns = _objectSpread(_objectSpread({}, BASE_TOKEN_PATTERNS), {}, {
439
480
  // Accept the locale's real AM/PM strings, plus the plain "AM"/"PM"
440
481
  // fallback so a formatted value always round-trips through parseDate.
441
- a: "(".concat(escapeRegExp(amText), "|").concat(escapeRegExp(pmText), "|AM|PM)")
482
+ a: "(".concat(escapeRegExp(amText), "|").concat(escapeRegExp(pmText), "|AM|PM)"),
483
+ A: "(".concat(escapeRegExp(amText), "|").concat(escapeRegExp(pmText), "|AM|PM)")
442
484
  });
443
485
  var tokens = [];
444
486
  var regexStr = '';
445
487
  var lastIndex = 0;
446
- var matches = format.matchAll(new RegExp(FORMAT_TOKEN_REGEX.source, 'g'));
488
+ var matches = resolvedFormat.matchAll(new RegExp(FORMAT_TOKEN_REGEX.source, 'g'));
447
489
  Array.from(matches).forEach(function (match) {
448
- regexStr += escapeRegExp(format.slice(lastIndex, match.index));
490
+ regexStr += escapeRegExp(resolvedFormat.slice(lastIndex, match.index));
449
491
  regexStr += tokenPatterns[match[0]];
450
492
  tokens.push(match[0]);
451
493
  lastIndex = match.index + match[0].length;
452
494
  });
453
- regexStr += escapeRegExp(format.slice(lastIndex));
495
+ regexStr += escapeRegExp(resolvedFormat.slice(lastIndex));
454
496
  var matched = value.trim().match(new RegExp("^".concat(regexStr, "$"), 'i'));
455
497
  if (!matched) return null;
456
498
  var parts = {};
457
499
  tokens.forEach(function (token, index) {
458
500
  parts[token] = matched[index + 1];
459
501
  });
502
+ var yearStr = parts.yyyy || parts.YYYY;
503
+ var shortYearStr = parts.yy || parts.YY;
504
+ var monthStr = parts.MM || parts.M;
505
+ var dayStr = parts.dd || parts.DD || parts.D;
506
+ var meridiemPart = parts.a || parts.A;
460
507
  var now = new Date();
461
- var year = parts.yyyy ? parseInt(parts.yyyy, 10) : parts.yy ? 2000 + parseInt(parts.yy, 10) : now.getFullYear();
462
- var month = parts.MM ? parseInt(parts.MM, 10) - 1 : 0;
463
- var day = parts.dd ? parseInt(parts.dd, 10) : 1;
508
+ var year = yearStr ? parseInt(yearStr, 10) : shortYearStr ? 2000 + parseInt(shortYearStr, 10) : now.getFullYear();
509
+ var month = monthStr ? parseInt(monthStr, 10) - 1 : 0;
510
+ var day = dayStr ? parseInt(dayStr, 10) : 1;
464
511
  var hours = 0;
465
512
  if (parts.HH !== undefined) {
466
513
  hours = parseInt(parts.HH, 10);
467
514
  } else if (parts.hh !== undefined) {
468
515
  hours = parseInt(parts.hh, 10) % 12;
469
- if (parts.a && parts.a.toLowerCase() === pmText.toLowerCase()) hours += 12;else if (parts.a && /^p/i.test(parts.a)) hours += 12;
516
+ if (meridiemPart && meridiemPart.toLowerCase() === pmText.toLowerCase()) hours += 12;else if (meridiemPart && /^p/i.test(meridiemPart)) hours += 12;
470
517
  }
471
518
  var minutes = parts.mm ? parseInt(parts.mm, 10) : 0;
472
519
  var seconds = parts.ss ? parseInt(parts.ss, 10) : 0;