@semcore/date-picker 4.57.0 → 4.57.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/lib/cjs/components/Calendar.js +24 -22
  3. package/lib/cjs/components/Calendar.js.map +1 -1
  4. package/lib/cjs/components/DateRangeComparatorAbstract.js +32 -30
  5. package/lib/cjs/components/DateRangeComparatorAbstract.js.map +1 -1
  6. package/lib/cjs/components/InputTrigger.js +32 -30
  7. package/lib/cjs/components/InputTrigger.js.map +1 -1
  8. package/lib/cjs/components/PickerAbstract.js +32 -30
  9. package/lib/cjs/components/PickerAbstract.js.map +1 -1
  10. package/lib/cjs/components/RangePickerAbstract.js +32 -30
  11. package/lib/cjs/components/RangePickerAbstract.js.map +1 -1
  12. package/lib/es6/components/Calendar.js +24 -22
  13. package/lib/es6/components/Calendar.js.map +1 -1
  14. package/lib/es6/components/DateRangeComparatorAbstract.js +32 -30
  15. package/lib/es6/components/DateRangeComparatorAbstract.js.map +1 -1
  16. package/lib/es6/components/InputTrigger.js +32 -30
  17. package/lib/es6/components/InputTrigger.js.map +1 -1
  18. package/lib/es6/components/PickerAbstract.js +32 -30
  19. package/lib/es6/components/PickerAbstract.js.map +1 -1
  20. package/lib/es6/components/RangePickerAbstract.js +32 -30
  21. package/lib/es6/components/RangePickerAbstract.js.map +1 -1
  22. package/lib/esm/DatePicker.mjs +114 -103
  23. package/lib/esm/DateRangeComparator.mjs +166 -149
  24. package/lib/esm/DateRangePicker.mjs +85 -77
  25. package/lib/esm/MonthDateRangeComparator.mjs +187 -169
  26. package/lib/esm/MonthPicker.mjs +78 -71
  27. package/lib/esm/MonthRangePicker.mjs +94 -85
  28. package/lib/esm/components/ButtonTrigger.mjs +16 -15
  29. package/lib/esm/components/Calendar.mjs +409 -287
  30. package/lib/esm/components/DateRangeComparatorAbstract.mjs +458 -330
  31. package/lib/esm/components/InputTrigger.mjs +762 -519
  32. package/lib/esm/components/PickerAbstract.mjs +196 -149
  33. package/lib/esm/components/RangePickerAbstract.mjs +310 -221
  34. package/lib/esm/components/index.mjs +127 -109
  35. package/lib/esm/index.mjs +13 -13
  36. package/lib/esm/style/calendar.shadow.css +259 -0
  37. package/lib/esm/style/date-picker.shadow.css +179 -0
  38. package/lib/esm/translations/__intergalactic-dynamic-locales.mjs +32 -32
  39. package/lib/esm/translations/de.json.mjs +83 -56
  40. package/lib/esm/translations/en.json.mjs +95 -64
  41. package/lib/esm/translations/es.json.mjs +83 -56
  42. package/lib/esm/translations/fr.json.mjs +83 -56
  43. package/lib/esm/translations/it.json.mjs +83 -56
  44. package/lib/esm/translations/ja.json.mjs +83 -56
  45. package/lib/esm/translations/ko.json.mjs +83 -56
  46. package/lib/esm/translations/nl.json.mjs +83 -56
  47. package/lib/esm/translations/pl.json.mjs +83 -56
  48. package/lib/esm/translations/pt.json.mjs +83 -56
  49. package/lib/esm/translations/ru.json.mjs +35 -24
  50. package/lib/esm/translations/sv.json.mjs +83 -56
  51. package/lib/esm/translations/tr.json.mjs +83 -56
  52. package/lib/esm/translations/vi.json.mjs +83 -56
  53. package/lib/esm/translations/zh.json.mjs +83 -56
  54. package/lib/esm/utils/cronTabScheduler.mjs +58 -52
  55. package/lib/esm/utils/datesIntersects.mjs +15 -11
  56. package/lib/esm/utils/formatDate.mjs +25 -18
  57. package/lib/esm/utils/includesDate.mjs +13 -9
  58. package/lib/esm/utils/shortDateRangeFormat.mjs +53 -31
  59. package/package.json +15 -15
@@ -1,650 +1,893 @@
1
- import pa from "@babel/runtime/helpers/esm/extends";
2
- import G from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
3
- import ne from "@babel/runtime/helpers/esm/slicedToArray";
4
- import q from "@babel/runtime/helpers/esm/assertThisInitialized";
5
- import E from "@babel/runtime/helpers/esm/objectSpread2";
6
- import W from "@babel/runtime/helpers/esm/objectWithoutProperties";
7
- import Se from "@babel/runtime/helpers/esm/classCallCheck";
8
- import Pe from "@babel/runtime/helpers/esm/createClass";
9
- import Ie from "@babel/runtime/helpers/esm/inherits";
10
- import De from "@babel/runtime/helpers/esm/createSuper";
11
- import p from "@babel/runtime/helpers/esm/defineProperty";
12
- import { sstyled as ca } from "@semcore/utils/lib/core/index";
13
- import je, { sstyled as A, assignProps as N, Component as be } from "@semcore/core";
14
- import i from "react";
15
- import ga from "@semcore/base-trigger";
16
- import Q from "@semcore/input-mask";
17
- import Oe from "@semcore/tooltip";
18
- import { Flex as fa, Box as ha } from "@semcore/flex-box";
19
- import va from "@semcore/icon/Calendar/m";
20
- import ma from "@semcore/neighbor-location";
21
- import { datesIntersects as ya } from "../utils/datesIntersects.mjs";
22
- import { includesDate as ve } from "../utils/includesDate.mjs";
23
- import me from "dayjs";
24
- import ze from "@semcore/utils/lib/use/useEnhancedEffect";
25
- import Ne from "@semcore/utils/lib/assignProps";
26
- var Sa = ["children", "id", "role", "aria-haspopup", "aria-label", "style"], Pa = ["children", "id", "role", "aria-haspopup", "aria-label", "style"], Ia = ["value", "onChange", "onDisplayedPeriodChange", "locale", "w", "ariaHasPopup", "showError"], Da = ["value", "locale", "onDisplayedPeriodChange", "ariaHasPopup", "showError"], ja = ["value", "locale", "onDisplayedPeriodChange", "ariaHasPopup", "inputId", "showError"], ba = ["date", "onDateChange", "onDisplayedPeriodChange", "locale", "styles", "parts", "disabledDates", "forwardRef", "placeholders", "labelPrefix", "onMaskPipeBlock", "containerFocused", "animationsDisabled", "getI18nText", "inputId", "inputRole", "__excludeProps", "Root"], Re = (
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _createForOfIteratorHelper from "@babel/runtime/helpers/esm/createForOfIteratorHelper";
3
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
+ import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
5
+ import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
6
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
7
+ import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
8
+ import _createClass from "@babel/runtime/helpers/esm/createClass";
9
+ import _inherits from "@babel/runtime/helpers/esm/inherits";
10
+ import _createSuper from "@babel/runtime/helpers/esm/createSuper";
11
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
12
+ import { sstyled } from "@semcore/utils/lib/core/index";
13
+ import createComponent, { sstyled as sstyled$1, assignProps, Component } from "@semcore/core";
14
+ import React from "react";
15
+ import BaseTrigger from "@semcore/base-trigger";
16
+ import InputMask from "@semcore/input-mask";
17
+ import Tooltip from "@semcore/tooltip";
18
+ import { Flex, Box } from "@semcore/flex-box";
19
+ import Calendar from "@semcore/icon/Calendar/m";
20
+ import NeighborLocation from "@semcore/neighbor-location";
21
+ import { datesIntersects } from "../utils/datesIntersects.mjs";
22
+ import { includesDate } from "../utils/includesDate.mjs";
23
+ import dayjs from "dayjs";
24
+ import useEnhancedEffect from "@semcore/utils/lib/use/useEnhancedEffect";
25
+ import assignProps$1 from "@semcore/utils/lib/assignProps";
26
+ var _excluded = ["children", "id", "role", "aria-haspopup", "aria-label", "style"], _excluded2 = ["children", "id", "role", "aria-haspopup", "aria-label", "style"], _excluded3 = ["value", "onChange", "onDisplayedPeriodChange", "locale", "w", "ariaHasPopup", "showError"], _excluded4 = ["value", "locale", "onDisplayedPeriodChange", "ariaHasPopup", "showError"], _excluded5 = ["value", "locale", "onDisplayedPeriodChange", "ariaHasPopup", "inputId", "showError"], _excluded6 = ["date", "onDateChange", "onDisplayedPeriodChange", "locale", "styles", "parts", "disabledDates", "forwardRef", "placeholders", "labelPrefix", "onMaskPipeBlock", "containerFocused", "animationsDisabled", "getI18nText", "inputId", "inputRole", "__excludeProps", "Root"];
27
+ /*!__reshadow-styles__:"../style/date-picker.shadow.css"*/
28
+ var style = (
27
29
  /*__reshadow_css_start__*/
28
- (ca.insert(
30
+ (sstyled.insert(
29
31
  /*__inner_css_start__*/
30
- ".___SPopper_182qj_gg_{padding:var(--intergalactic-spacing-4x, 16px);outline:0}.___SPopper_182qj_gg_::-moz-focus-inner{border:0;padding:0}.___SPopper_182qj_gg_:active,.___SPopper_182qj_gg_:focus{outline:0;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SPopper_182qj_gg_:hover{outline:0;-webkit-text-decoration:none;text-decoration:none}}.___SPopper_182qj_gg_:focus{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5))}.___SHeader_182qj_gg_,.___STitle_182qj_gg_{display:flex;align-items:center}.___STitle_182qj_gg_{font-size:var(--intergalactic-fs-200, 14px);color:var(--intergalactic-text-primary, #191b23);height:32px;width:100%;justify-content:center}.___SToday_182qj_gg_{display:flex;margin-top:var(--intergalactic-spacing-3x, 12px);justify-content:center}.___SPeriod_182qj_gg_{display:flex;flex-direction:column;margin-bottom:var(--intergalactic-spacing-2x, 8px)}.___SButton_182qj_gg_ .___SInner_182qj_gg_{justify-content:flex-start}.___SInputMask_182qj_gg_{color:var(--intergalactic-text-primary, #191b23);line-height:normal;padding-right:var(--intergalactic-spacing-2x, 8px);transition:width calc(var(--intergalactic-duration-medium, 300)*1ms) ease,min-width calc(var(--intergalactic-duration-medium, 300)*1ms) ease}.___SInputMask_182qj_gg_.__animationsDisabled_182qj_gg_{transition:none}.___SInputMask_182qj_gg_ .___SValue_182qj_gg_{letter-spacing:0}.___SIndicator_182qj_gg_{color:var(--intergalactic-text-secondary, #6c6e79)}.___SRangeIndicator_182qj_gg_{border-radius:50%;flex-shrink:0}.___SRangeIndicator_182qj_gg_._range_value_182qj_gg_{background-color:var(--intergalactic-date-picker-cell-active, #2bb3ff)}.___SRangeIndicator_182qj_gg_._range_compare_182qj_gg_{background-color:var(--intergalactic-date-picker-cell-comparison-active, #8649e1)}.___SRangeIndicator_182qj_gg_.__disabled_182qj_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3)}.___SHumanizedDate_182qj_gg_{position:absolute;pointer-events:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%}.___SMask_182qj_gg_{letter-spacing:0;white-space:nowrap;overflow:hidden}.___SDateRange_182qj_gg_ .___SMask_182qj_gg_,.___SDateRange_182qj_gg_ .___SValue_182qj_gg_,.___SSingleDateInput_182qj_gg_ .___SMask_182qj_gg_,.___SSingleDateInput_182qj_gg_ .___SValue_182qj_gg_{opacity:0}.___SSingleDateInput_182qj_gg_:focus-within .___SHumanizedDate_182qj_gg_{opacity:0;z-index:var(--intergalactic-z-index-deep, -999)}.___SSingleDateInput_182qj_gg_:focus-within .___SMask_182qj_gg_,.___SSingleDateInput_182qj_gg_:focus-within .___SValue_182qj_gg_{opacity:1}.___SDateRange_182qj_gg_:focus-within .___SHumanizedDate_182qj_gg_{opacity:0;z-index:var(--intergalactic-z-index-deep, -999)}.___SDateRange_182qj_gg_:focus-within .___SMask_182qj_gg_,.___SDateRange_182qj_gg_:focus-within .___SValue_182qj_gg_{opacity:1}.___SInputMask_182qj_gg_.__noHumanizedDate_182qj_gg_ .___SMask_182qj_gg_,.___SInputMask_182qj_gg_.__noHumanizedDate_182qj_gg_ .___SValue_182qj_gg_{opacity:1}.___SDateRange_182qj_gg_ .___SInputMask_182qj_gg_:focus-within .___SMask_182qj_gg_{background-color:var(--intergalactic-bg-highlight-focus, rgba(0, 143, 248, 0.2))}.___SDateRange_182qj_gg_:focus-within .___SRangeSep_182qj_gg_,.___SRangeSep_182qj_gg_.__fulfilled_182qj_gg_{color:var(--intergalactic-text-primary, #191b23)}.___SRangeComparatorHeader_182qj_gg_{border-bottom:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___SRangeCalendar_182qj_gg_,.___SRangeComparatorHeader_182qj_gg_{padding:var(--intergalactic-spacing-4x, 16px)}.___SFooter_182qj_gg_{border-top:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___SFooter_182qj_gg_,.___SPeriodsList_182qj_gg_{padding:var(--intergalactic-spacing-4x, 16px)}.___STooltip_182qj_gg_{padding:var(--intergalactic-spacing-3x, 12px)}.___SCompareToggle_182qj_gg_{white-space:nowrap}@media (prefers-reduced-motion){.___SInputMask_182qj_gg_{transition:none}}",
31
- "182qj_gg_"
32
- ), {
33
- __SHeader: "___SHeader_182qj_gg_",
34
- __STitle: "___STitle_182qj_gg_",
35
- __SToday: "___SToday_182qj_gg_",
36
- __SPeriod: "___SPeriod_182qj_gg_",
37
- __SButton: "___SButton_182qj_gg_",
38
- __SInner: "___SInner_182qj_gg_",
39
- __SInputMask: "___SInputMask_182qj_gg_",
40
- _animationsDisabled: "__animationsDisabled_182qj_gg_",
41
- __SValue: "___SValue_182qj_gg_",
42
- __SIndicator: "___SIndicator_182qj_gg_",
43
- __SRangeIndicator: "___SRangeIndicator_182qj_gg_",
44
- _range_value: "_range_value_182qj_gg_",
45
- _range_compare: "_range_compare_182qj_gg_",
46
- _disabled: "__disabled_182qj_gg_",
47
- __SHumanizedDate: "___SHumanizedDate_182qj_gg_",
48
- __SMask: "___SMask_182qj_gg_",
49
- __SSingleDateInput: "___SSingleDateInput_182qj_gg_",
50
- __SDateRange: "___SDateRange_182qj_gg_",
51
- _noHumanizedDate: "__noHumanizedDate_182qj_gg_",
52
- __SRangeSep: "___SRangeSep_182qj_gg_",
53
- _fulfilled: "__fulfilled_182qj_gg_",
54
- __SRangeComparatorHeader: "___SRangeComparatorHeader_182qj_gg_",
55
- __SRangeCalendar: "___SRangeCalendar_182qj_gg_",
56
- __SFooter: "___SFooter_182qj_gg_",
57
- __SPeriodsList: "___SPeriodsList_182qj_gg_",
58
- __STooltip: "___STooltip_182qj_gg_",
59
- __SCompareToggle: "___SCompareToggle_182qj_gg_",
60
- __SPopper: "___SPopper_182qj_gg_"
32
+ ".___SPopper_svfjr_gg_{padding:var(--intergalactic-spacing-4x, 16px);outline:0}.___SPopper_svfjr_gg_::-moz-focus-inner{border:0;padding:0}.___SPopper_svfjr_gg_:active,.___SPopper_svfjr_gg_:focus{outline:0;-webkit-text-decoration:none;text-decoration:none}@media (hover:hover){.___SPopper_svfjr_gg_:hover{outline:0;-webkit-text-decoration:none;text-decoration:none}}.___SPopper_svfjr_gg_:focus{box-shadow:var(--intergalactic-keyboard-focus, 0px 0px 0px 3px rgba(0, 143, 248, 0.5))}.___SHeader_svfjr_gg_,.___STitle_svfjr_gg_{display:flex;align-items:center}.___STitle_svfjr_gg_{font-size:var(--intergalactic-fs-200, 14px);color:var(--intergalactic-text-primary, #191b23);height:32px;width:100%;justify-content:center}.___SToday_svfjr_gg_{display:flex;margin-top:var(--intergalactic-spacing-3x, 12px);justify-content:center}.___SPeriod_svfjr_gg_{display:flex;flex-direction:column;margin-bottom:var(--intergalactic-spacing-2x, 8px)}.___SButton_svfjr_gg_ .___SInner_svfjr_gg_{justify-content:flex-start}.___SInputMask_svfjr_gg_{color:var(--intergalactic-text-primary, #191b23);line-height:normal;padding-right:var(--intergalactic-spacing-2x, 8px);transition:width calc(var(--intergalactic-duration-medium, 300)*1ms) ease,min-width calc(var(--intergalactic-duration-medium, 300)*1ms) ease}.___SInputMask_svfjr_gg_.__animationsDisabled_svfjr_gg_{transition:none}.___SInputMask_svfjr_gg_ .___SValue_svfjr_gg_{letter-spacing:0}.___SIndicator_svfjr_gg_{color:var(--intergalactic-text-secondary, #6c6e79)}.___SRangeIndicator_svfjr_gg_{border-radius:50%;flex-shrink:0}.___SRangeIndicator_svfjr_gg_._range_value_svfjr_gg_{background-color:var(--intergalactic-date-picker-cell-active, #2bb3ff)}.___SRangeIndicator_svfjr_gg_._range_compare_svfjr_gg_{background-color:var(--intergalactic-date-picker-cell-comparison-active, #8649e1)}.___SRangeIndicator_svfjr_gg_.__disabled_svfjr_gg_{opacity:var(--intergalactic-disabled-opacity, 0.3)}.___SHumanizedDate_svfjr_gg_{position:absolute;pointer-events:none;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;width:100%}.___SMask_svfjr_gg_{letter-spacing:0;white-space:nowrap;overflow:hidden}.___SDateRange_svfjr_gg_ .___SMask_svfjr_gg_,.___SDateRange_svfjr_gg_ .___SValue_svfjr_gg_,.___SSingleDateInput_svfjr_gg_ .___SMask_svfjr_gg_,.___SSingleDateInput_svfjr_gg_ .___SValue_svfjr_gg_{opacity:0}.___SSingleDateInput_svfjr_gg_:focus-within .___SHumanizedDate_svfjr_gg_{opacity:0;z-index:var(--intergalactic-z-index-deep, -999)}.___SSingleDateInput_svfjr_gg_:focus-within .___SMask_svfjr_gg_,.___SSingleDateInput_svfjr_gg_:focus-within .___SValue_svfjr_gg_{opacity:1}.___SDateRange_svfjr_gg_:focus-within .___SHumanizedDate_svfjr_gg_{opacity:0;z-index:var(--intergalactic-z-index-deep, -999)}.___SDateRange_svfjr_gg_:focus-within .___SMask_svfjr_gg_,.___SDateRange_svfjr_gg_:focus-within .___SValue_svfjr_gg_{opacity:1}.___SInputMask_svfjr_gg_.__noHumanizedDate_svfjr_gg_ .___SMask_svfjr_gg_,.___SInputMask_svfjr_gg_.__noHumanizedDate_svfjr_gg_ .___SValue_svfjr_gg_{opacity:1}.___SDateRange_svfjr_gg_ .___SInputMask_svfjr_gg_:focus-within .___SMask_svfjr_gg_{background-color:var(--intergalactic-bg-highlight-focus, rgba(0, 143, 248, 0.2))}.___SDateRange_svfjr_gg_:focus-within .___SRangeSep_svfjr_gg_,.___SRangeSep_svfjr_gg_.__fulfilled_svfjr_gg_{color:var(--intergalactic-text-primary, #191b23)}.___SRangeComparatorHeader_svfjr_gg_{border-bottom:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___SRangeCalendar_svfjr_gg_,.___SRangeComparatorHeader_svfjr_gg_{padding:var(--intergalactic-spacing-4x, 16px)}.___SFooter_svfjr_gg_{border-top:1px solid var(--intergalactic-border-primary, #c4c7cf)}.___SFooter_svfjr_gg_,.___SPeriodsList_svfjr_gg_{padding:var(--intergalactic-spacing-4x, 16px)}.___STooltip_svfjr_gg_{padding:var(--intergalactic-spacing-3x, 12px)}.___SCompareToggle_svfjr_gg_{white-space:nowrap}@media (prefers-reduced-motion){.___SInputMask_svfjr_gg_{transition:none}}",
33
+ /*__inner_css_end__*/
34
+ "svfjr_gg_"
35
+ ), /*__reshadow_css_end__*/
36
+ {
37
+ "__SHeader": "___SHeader_svfjr_gg_",
38
+ "__STitle": "___STitle_svfjr_gg_",
39
+ "__SToday": "___SToday_svfjr_gg_",
40
+ "__SPeriod": "___SPeriod_svfjr_gg_",
41
+ "__SButton": "___SButton_svfjr_gg_",
42
+ "__SInner": "___SInner_svfjr_gg_",
43
+ "__SInputMask": "___SInputMask_svfjr_gg_",
44
+ "_animationsDisabled": "__animationsDisabled_svfjr_gg_",
45
+ "__SValue": "___SValue_svfjr_gg_",
46
+ "__SIndicator": "___SIndicator_svfjr_gg_",
47
+ "__SRangeIndicator": "___SRangeIndicator_svfjr_gg_",
48
+ "_range_value": "_range_value_svfjr_gg_",
49
+ "_range_compare": "_range_compare_svfjr_gg_",
50
+ "_disabled": "__disabled_svfjr_gg_",
51
+ "__SHumanizedDate": "___SHumanizedDate_svfjr_gg_",
52
+ "__SMask": "___SMask_svfjr_gg_",
53
+ "__SSingleDateInput": "___SSingleDateInput_svfjr_gg_",
54
+ "__SDateRange": "___SDateRange_svfjr_gg_",
55
+ "_noHumanizedDate": "__noHumanizedDate_svfjr_gg_",
56
+ "__SRangeSep": "___SRangeSep_svfjr_gg_",
57
+ "_fulfilled": "__fulfilled_svfjr_gg_",
58
+ "__SRangeComparatorHeader": "___SRangeComparatorHeader_svfjr_gg_",
59
+ "__SRangeCalendar": "___SRangeCalendar_svfjr_gg_",
60
+ "__SFooter": "___SFooter_svfjr_gg_",
61
+ "__SPeriodsList": "___SPeriodsList_svfjr_gg_",
62
+ "__STooltip": "___STooltip_svfjr_gg_",
63
+ "__SCompareToggle": "___SCompareToggle_svfjr_gg_",
64
+ "__SPopper": "___SPopper_svfjr_gg_"
61
65
  })
62
- ), Ra = {
63
- year: !0,
64
- month: !0,
65
- day: !0
66
- }, xa = new Date(2e3, 4, 29), oe = /* @__PURE__ */ function(T) {
67
- Ie(g, T);
68
- var u = De(g);
69
- function g() {
70
- return Se(this, g), u.apply(this, arguments);
66
+ );
67
+ var defaultAllowedParts = {
68
+ year: true,
69
+ month: true,
70
+ day: true
71
+ };
72
+ var exampleDate = new Date(2e3, 4, 29);
73
+ var InputTriggerRoot = /* @__PURE__ */ function(_Component) {
74
+ _inherits(InputTriggerRoot2, _Component);
75
+ var _super = _createSuper(InputTriggerRoot2);
76
+ function InputTriggerRoot2() {
77
+ _classCallCheck(this, InputTriggerRoot2);
78
+ return _super.apply(this, arguments);
71
79
  }
72
- return Pe(g, [{
80
+ _createClass(InputTriggerRoot2, [{
73
81
  key: "getSingleDateInputProps",
74
- value: function() {
75
- var a = this.asProps;
76
- a.children;
77
- var s = a.id;
78
- a.role;
79
- var o = a["aria-haspopup"];
80
- a["aria-label"], a.style;
81
- var r = W(a, Sa);
82
- return E(E({}, r), {}, {
83
- ariaHasPopup: o,
84
- inputId: s
82
+ value: function getSingleDateInputProps() {
83
+ var _this$asProps = this.asProps;
84
+ _this$asProps.children;
85
+ var id = _this$asProps.id;
86
+ _this$asProps.role;
87
+ var ariaHasPopup = _this$asProps["aria-haspopup"];
88
+ _this$asProps["aria-label"];
89
+ _this$asProps.style;
90
+ var otherProps = _objectWithoutProperties(_this$asProps, _excluded);
91
+ return _objectSpread(_objectSpread({}, otherProps), {}, {
92
+ ariaHasPopup,
93
+ inputId: id
85
94
  });
86
95
  }
87
96
  }, {
88
97
  key: "getDateRangeProps",
89
- value: function() {
90
- var a = this.asProps;
91
- a.children;
92
- var s = a.id;
93
- a.role;
94
- var o = a["aria-haspopup"];
95
- a["aria-label"], a.style;
96
- var r = W(a, Pa);
97
- return E(E({}, r), {}, {
98
- ariaHasPopup: o,
99
- inputId: s
98
+ value: function getDateRangeProps() {
99
+ var _this$asProps2 = this.asProps;
100
+ _this$asProps2.children;
101
+ var id = _this$asProps2.id;
102
+ _this$asProps2.role;
103
+ var ariaHasPopup = _this$asProps2["aria-haspopup"];
104
+ _this$asProps2["aria-label"];
105
+ _this$asProps2.style;
106
+ var otherProps = _objectWithoutProperties(_this$asProps2, _excluded2);
107
+ return _objectSpread(_objectSpread({}, otherProps), {}, {
108
+ ariaHasPopup,
109
+ inputId: id
100
110
  });
101
111
  }
102
112
  }, {
103
113
  key: "render",
104
- value: function() {
105
- var a = this.asProps, s, o = ha, r = this.asProps, d = r.Children, n = r.style, f = r.getI18nText;
106
- return s = A(n), /* @__PURE__ */ i.createElement(o, s.cn("SInputTrigger", E({}, N({
107
- "aria-label": f("input"),
108
- __excludeProps: ["onChange", "value", "role", "id"]
109
- }, a))), /* @__PURE__ */ i.createElement(d, s.cn("Children", {})));
110
- }
111
- }]), g;
112
- }(be);
113
- p(oe, "displayName", "InputTrigger");
114
- p(oe, "style", Re);
115
- p(oe, "defaultProps", {
114
+ value: function render() {
115
+ var _ref = this.asProps, _ref8;
116
+ var SInputTrigger = Box;
117
+ var _this$asProps3 = this.asProps, Children = _this$asProps3.Children, style2 = _this$asProps3.style, getI18nText = _this$asProps3.getI18nText;
118
+ return _ref8 = sstyled$1(style2), /* @__PURE__ */ React.createElement(SInputTrigger, _ref8.cn("SInputTrigger", _objectSpread({}, assignProps({
119
+ "aria-label": getI18nText("input"),
120
+ "__excludeProps": ["onChange", "value", "role", "id"]
121
+ }, _ref))), /* @__PURE__ */ React.createElement(Children, _ref8.cn("Children", {})));
122
+ }
123
+ }]);
124
+ return InputTriggerRoot2;
125
+ }(Component);
126
+ _defineProperty(InputTriggerRoot, "displayName", "InputTrigger");
127
+ _defineProperty(InputTriggerRoot, "style", style);
128
+ _defineProperty(InputTriggerRoot, "defaultProps", {
116
129
  duration: 300,
117
- popoverVisible: !0
130
+ popoverVisible: true
118
131
  });
119
- var ie = /* @__PURE__ */ function(T) {
120
- Ie(g, T);
121
- var u = De(g);
122
- function g() {
123
- var e;
124
- Se(this, g);
125
- for (var a = arguments.length, s = new Array(a), o = 0; o < a; o++)
126
- s[o] = arguments[o];
127
- return e = u.call.apply(u, [this].concat(s)), p(q(e), "state", {
132
+ var SingleDateInputRoot = /* @__PURE__ */ function(_Component2) {
133
+ _inherits(SingleDateInputRoot2, _Component2);
134
+ var _super2 = _createSuper(SingleDateInputRoot2);
135
+ function SingleDateInputRoot2() {
136
+ var _this;
137
+ _classCallCheck(this, SingleDateInputRoot2);
138
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
139
+ args[_key] = arguments[_key];
140
+ }
141
+ _this = _super2.call.apply(_super2, [this].concat(args));
142
+ _defineProperty(_assertThisInitialized(_this), "state", {
128
143
  errorText: null,
129
- showError: !1,
130
- focused: !1
131
- }), p(q(e), "handleFocus", function() {
132
- e.setState({
133
- focused: !0
144
+ showError: false,
145
+ focused: false
146
+ });
147
+ _defineProperty(_assertThisInitialized(_this), "handleFocus", function() {
148
+ _this.setState({
149
+ focused: true
134
150
  });
135
- }), p(q(e), "handleBlur", function() {
136
- e.setState({
137
- focused: !1
151
+ });
152
+ _defineProperty(_assertThisInitialized(_this), "handleBlur", function() {
153
+ _this.setState({
154
+ focused: false
138
155
  });
139
- }), p(q(e), "handleInputMaskPipeBlock", function(r) {
140
- r !== e.asProps.disabledDateInputAttempt && e.handlers.disabledDateInputAttempt(r);
141
- }), e;
156
+ });
157
+ _defineProperty(_assertThisInitialized(_this), "handleInputMaskPipeBlock", function(value) {
158
+ if (value === _this.asProps.disabledDateInputAttempt) return;
159
+ _this.handlers.disabledDateInputAttempt(value);
160
+ });
161
+ return _this;
142
162
  }
143
- return Pe(g, [{
163
+ _createClass(SingleDateInputRoot2, [{
144
164
  key: "uncontrolledProps",
145
- value: function() {
146
- var a = this;
165
+ value: function uncontrolledProps() {
166
+ var _this2 = this;
147
167
  return {
148
- disabledDateInputAttempt: [null, function(s) {
149
- var o = a.state.errorText, r = !1;
150
- if (s !== null) {
151
- if (o = a.asProps.disabledErrorText, o === void 0) {
152
- var d = "unavailableDate";
153
- a.asProps.parts && !a.asProps.parts.day && (d = "unavailableMonth"), o = a.asProps.getI18nText(d);
168
+ disabledDateInputAttempt: [null, function(date) {
169
+ var errorText = _this2.state.errorText;
170
+ var showError = false;
171
+ if (date !== null) {
172
+ errorText = _this2.asProps.disabledErrorText;
173
+ if (errorText === void 0) {
174
+ var key = "unavailableDate";
175
+ if (_this2.asProps.parts && !_this2.asProps.parts.day) {
176
+ key = "unavailableMonth";
177
+ }
178
+ errorText = _this2.asProps.getI18nText(key);
179
+ }
180
+ if (typeof errorText === "function") {
181
+ errorText = errorText(date);
154
182
  }
155
- typeof o == "function" && (o = o(s)), r = a.asProps.disabledErrorText !== null;
183
+ showError = _this2.asProps.disabledErrorText !== null;
156
184
  }
157
- a.setState({
158
- errorText: o,
159
- showError: r
185
+ _this2.setState({
186
+ errorText,
187
+ showError
160
188
  });
161
189
  }]
162
190
  };
163
191
  }
164
192
  }, {
165
193
  key: "getMaskedInputProps",
166
- value: function() {
167
- var a = this.asProps, s = a.value, o = a.onChange, r = a.onDisplayedPeriodChange, d = a.locale;
168
- a.w, a.ariaHasPopup, a.showError;
169
- var n = W(a, Ia);
170
- return E({
171
- date: s,
172
- onDateChange: o,
173
- onDisplayedPeriodChange: r,
174
- locale: d,
194
+ value: function getMaskedInputProps() {
195
+ var _this$asProps4 = this.asProps, value = _this$asProps4.value, onChange = _this$asProps4.onChange, onDisplayedPeriodChange = _this$asProps4.onDisplayedPeriodChange, locale = _this$asProps4.locale;
196
+ _this$asProps4.w;
197
+ _this$asProps4.ariaHasPopup;
198
+ _this$asProps4.showError;
199
+ var otherProps = _objectWithoutProperties(_this$asProps4, _excluded3);
200
+ return _objectSpread({
201
+ date: value,
202
+ onDateChange: onChange,
203
+ onDisplayedPeriodChange,
204
+ locale,
175
205
  "aria-haspopup": "true",
176
206
  onMaskPipeBlock: this.handleInputMaskPipeBlock
177
- }, n);
207
+ }, otherProps);
178
208
  }
179
209
  }, {
180
210
  key: "render",
181
- value: function() {
182
- var a = this.asProps, s, o = this.asProps, r = o.Children, d = o.forwardRef, n = o.styles, f = o.state, j = o.showError, b = o.popoverVisible, C = this.state, M = C.errorText, P = C.showError, V = C.focused, O = P && j, B = Q;
183
- return s = A(n), /* @__PURE__ */ i.createElement(B, s.cn("SSingleDateInput", E({}, N({
184
- tag: Oe,
185
- placement: "top-start",
186
- title: M,
187
- theme: "warning",
188
- visible: O && (b || V),
189
- state: O ? "invalid" : f,
190
- ref: d,
191
- onFocus: this.handleFocus,
192
- onBlur: this.handleBlur,
193
- __excludeProps: ["onChange", "style", "aria-expanded"]
194
- }, a))), /* @__PURE__ */ i.createElement(ma, s.cn("NeighborLocation", {}), /* @__PURE__ */ i.createElement(r, s.cn("Children", {}))));
195
- }
196
- }]), g;
197
- }(be);
198
- p(ie, "displayName", "SingleDateInput");
199
- p(ie, "style", Re);
200
- p(ie, "defaultProps", {
201
- children: function() {
202
- return /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement(ye.Indicator, null), /* @__PURE__ */ i.createElement(ye.MaskedInput, null));
211
+ value: function render() {
212
+ var _ref2 = this.asProps, _ref9;
213
+ var _this$asProps5 = this.asProps, Children = _this$asProps5.Children, forwardRef = _this$asProps5.forwardRef, styles = _this$asProps5.styles, state = _this$asProps5.state, showErrorProps = _this$asProps5.showError, popoverVisible = _this$asProps5.popoverVisible;
214
+ var _this$state = this.state, errorText = _this$state.errorText, showErrorState = _this$state.showError, focused = _this$state.focused;
215
+ var showError = showErrorState && showErrorProps;
216
+ var SSingleDateInput = InputMask;
217
+ return _ref9 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SSingleDateInput, _ref9.cn("SSingleDateInput", _objectSpread({}, assignProps({
218
+ "tag": Tooltip,
219
+ "placement": "top-start",
220
+ "title": errorText,
221
+ "theme": "warning",
222
+ "visible": showError && (popoverVisible || focused),
223
+ "state": showError ? "invalid" : state,
224
+ "ref": forwardRef,
225
+ "onFocus": this.handleFocus,
226
+ "onBlur": this.handleBlur,
227
+ "__excludeProps": ["onChange", "style", "aria-expanded"]
228
+ }, _ref2))), /* @__PURE__ */ React.createElement(NeighborLocation, _ref9.cn("NeighborLocation", {}), /* @__PURE__ */ React.createElement(Children, _ref9.cn("Children", {}))));
229
+ }
230
+ }]);
231
+ return SingleDateInputRoot2;
232
+ }(Component);
233
+ _defineProperty(SingleDateInputRoot, "displayName", "SingleDateInput");
234
+ _defineProperty(SingleDateInputRoot, "style", style);
235
+ _defineProperty(SingleDateInputRoot, "defaultProps", {
236
+ children: function children() {
237
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(SingleDateInput.Indicator, null), /* @__PURE__ */ React.createElement(SingleDateInput.MaskedInput, null));
203
238
  },
204
- defaultDisabledDateInputAttempt: !1,
205
- showError: !0
239
+ defaultDisabledDateInputAttempt: false,
240
+ showError: true
206
241
  });
207
- var se = /* @__PURE__ */ function(T) {
208
- Ie(g, T);
209
- var u = De(g);
210
- function g() {
211
- var e;
212
- Se(this, g);
213
- for (var a = arguments.length, s = new Array(a), o = 0; o < a; o++)
214
- s[o] = arguments[o];
215
- return e = u.call.apply(u, [this].concat(s)), p(q(e), "state", {
216
- containerFocused: !1,
242
+ var DateRangeRoot = /* @__PURE__ */ function(_Component3) {
243
+ _inherits(DateRangeRoot2, _Component3);
244
+ var _super3 = _createSuper(DateRangeRoot2);
245
+ function DateRangeRoot2() {
246
+ var _this3;
247
+ _classCallCheck(this, DateRangeRoot2);
248
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
249
+ args[_key2] = arguments[_key2];
250
+ }
251
+ _this3 = _super3.call.apply(_super3, [this].concat(args));
252
+ _defineProperty(_assertThisInitialized(_this3), "state", {
253
+ containerFocused: false,
217
254
  errorText: null,
218
- showError: !1,
255
+ showError: false,
219
256
  lastChangedInput: "from"
220
- }), p(q(e), "fromRef", /* @__PURE__ */ i.createRef()), p(q(e), "toRef", /* @__PURE__ */ i.createRef()), p(q(e), "handleFromChange", function(r, d) {
221
- var n, f, j, b, C = e.asProps.onChange, M = [(n = (f = e.asProps.value) === null || f === void 0 ? void 0 : f[0]) !== null && n !== void 0 ? n : null, (j = (b = e.asProps.value) === null || b === void 0 ? void 0 : b[1]) !== null && j !== void 0 ? j : null];
222
- if (C([r, M[1]], d), r) {
223
- if (!e.toRef.current) return;
224
- e.toRef.current.focus(), setTimeout(function() {
225
- e.toRef.current && e.toRef.current.setSelectionRange(0, 0);
257
+ });
258
+ _defineProperty(_assertThisInitialized(_this3), "fromRef", /* @__PURE__ */ React.createRef());
259
+ _defineProperty(_assertThisInitialized(_this3), "toRef", /* @__PURE__ */ React.createRef());
260
+ _defineProperty(_assertThisInitialized(_this3), "handleFromChange", function(value, event) {
261
+ var _this3$asProps$value$, _this3$asProps$value, _this3$asProps$value$2, _this3$asProps$value2;
262
+ var onChange = _this3.asProps.onChange;
263
+ var prevValue = [(_this3$asProps$value$ = (_this3$asProps$value = _this3.asProps.value) === null || _this3$asProps$value === void 0 ? void 0 : _this3$asProps$value[0]) !== null && _this3$asProps$value$ !== void 0 ? _this3$asProps$value$ : null, (_this3$asProps$value$2 = (_this3$asProps$value2 = _this3.asProps.value) === null || _this3$asProps$value2 === void 0 ? void 0 : _this3$asProps$value2[1]) !== null && _this3$asProps$value$2 !== void 0 ? _this3$asProps$value$2 : null];
264
+ onChange([value, prevValue[1]], event);
265
+ if (value) {
266
+ if (!_this3.toRef.current) return;
267
+ _this3.toRef.current.focus();
268
+ setTimeout(function() {
269
+ if (!_this3.toRef.current) return;
270
+ _this3.toRef.current.setSelectionRange(0, 0);
226
271
  }, 0);
227
272
  }
228
- }), p(q(e), "handleToChange", function(r, d) {
229
- var n, f, j, b, C = e.asProps.onChange, M = [(n = (f = e.asProps.value) === null || f === void 0 ? void 0 : f[0]) !== null && n !== void 0 ? n : null, (j = (b = e.asProps.value) === null || b === void 0 ? void 0 : b[1]) !== null && j !== void 0 ? j : null];
230
- C([M[0], r], d);
231
- }), p(q(e), "handleFromKeydown", function(r) {
232
- e.toRef.current && e.fromRef.current && (e.setState({
273
+ });
274
+ _defineProperty(_assertThisInitialized(_this3), "handleToChange", function(value, event) {
275
+ var _this3$asProps$value$3, _this3$asProps$value3, _this3$asProps$value$4, _this3$asProps$value4;
276
+ var onChange = _this3.asProps.onChange;
277
+ var prevValue = [(_this3$asProps$value$3 = (_this3$asProps$value3 = _this3.asProps.value) === null || _this3$asProps$value3 === void 0 ? void 0 : _this3$asProps$value3[0]) !== null && _this3$asProps$value$3 !== void 0 ? _this3$asProps$value$3 : null, (_this3$asProps$value$4 = (_this3$asProps$value4 = _this3.asProps.value) === null || _this3$asProps$value4 === void 0 ? void 0 : _this3$asProps$value4[1]) !== null && _this3$asProps$value$4 !== void 0 ? _this3$asProps$value$4 : null];
278
+ onChange([prevValue[0], value], event);
279
+ });
280
+ _defineProperty(_assertThisInitialized(_this3), "handleFromKeydown", function(event) {
281
+ if (!_this3.toRef.current) return;
282
+ if (!_this3.fromRef.current) return;
283
+ _this3.setState({
233
284
  lastChangedInput: "from"
234
- }), r.key === "ArrowRight" && e.fromRef.current.selectionStart === e.fromRef.current.value.length && e.fromRef.current.selectionEnd === e.fromRef.current.value.length && (e.toRef.current.focus(), setTimeout(function() {
235
- e.toRef.current.setSelectionRange(0, 0);
236
- }, 0)));
237
- }), p(q(e), "handleToKeydown", function(r) {
238
- if (e.toRef.current && e.fromRef.current) {
239
- if (e.setState({
240
- lastChangedInput: "to"
241
- }), r.key === "Backspace" && !e.toRef.current.value) {
242
- var d = e.fromRef.current.value;
243
- e.fromRef.current.focus(), setTimeout(function() {
244
- e.fromRef.current.setSelectionRange(d.length, d.length);
245
- }, 0);
246
- }
247
- if (r.key === "ArrowLeft" && e.toRef.current.selectionStart === 0 && e.toRef.current.selectionEnd === 0) {
248
- var n = e.fromRef.current.value;
249
- e.fromRef.current.focus(), setTimeout(function() {
250
- e.fromRef.current.setSelectionRange(n.length, n.length);
251
- }, 0);
252
- }
285
+ });
286
+ if (event.key === "ArrowRight" && _this3.fromRef.current.selectionStart === _this3.fromRef.current.value.length && _this3.fromRef.current.selectionEnd === _this3.fromRef.current.value.length) {
287
+ _this3.toRef.current.focus();
288
+ setTimeout(function() {
289
+ _this3.toRef.current.setSelectionRange(0, 0);
290
+ }, 0);
253
291
  }
254
- }), p(q(e), "handleInputMaskPipeBlock", function(r) {
255
- r !== e.asProps.disabledDateInputAttempt && e.handlers.disabledDateInputAttempt(r);
256
- }), p(q(e), "handleFocus", function() {
257
- e.setState({
258
- containerFocused: !0
292
+ });
293
+ _defineProperty(_assertThisInitialized(_this3), "handleToKeydown", function(event) {
294
+ if (!_this3.toRef.current) return;
295
+ if (!_this3.fromRef.current) return;
296
+ _this3.setState({
297
+ lastChangedInput: "to"
259
298
  });
260
- }), p(q(e), "handleBlur", function() {
261
- e.setState({
262
- containerFocused: !1
299
+ if (event.key === "Backspace" && !_this3.toRef.current.value) {
300
+ var value = _this3.fromRef.current.value;
301
+ _this3.fromRef.current.focus();
302
+ setTimeout(function() {
303
+ _this3.fromRef.current.setSelectionRange(value.length, value.length);
304
+ }, 0);
305
+ }
306
+ if (event.key === "ArrowLeft" && _this3.toRef.current.selectionStart === 0 && _this3.toRef.current.selectionEnd === 0) {
307
+ var _value = _this3.fromRef.current.value;
308
+ _this3.fromRef.current.focus();
309
+ setTimeout(function() {
310
+ _this3.fromRef.current.setSelectionRange(_value.length, _value.length);
311
+ }, 0);
312
+ }
313
+ });
314
+ _defineProperty(_assertThisInitialized(_this3), "handleInputMaskPipeBlock", function(value) {
315
+ if (value === _this3.asProps.disabledDateInputAttempt) return;
316
+ _this3.handlers.disabledDateInputAttempt(value);
317
+ });
318
+ _defineProperty(_assertThisInitialized(_this3), "handleFocus", function() {
319
+ _this3.setState({
320
+ containerFocused: true
321
+ });
322
+ });
323
+ _defineProperty(_assertThisInitialized(_this3), "handleBlur", function() {
324
+ _this3.setState({
325
+ containerFocused: false
263
326
  });
264
- }), p(q(e), "updateDisabledDateInputAttempt", function(r) {
265
- var d = e.asProps.disabledDates, n = !1;
266
- if (r && (r[0] && r[1] ? n = d.some(ya([r[0], r[1]], e.asProps.unit)) : r[0] ? n = d.some(ve(me(r[0]), e.asProps.unit)) : r[1] && (n = d.some(ve(me(r[1]), e.asProps.unit)))), n) {
267
- var f = e.state.lastChangedInput === "to" ? r[1] : r[0];
327
+ });
328
+ _defineProperty(_assertThisInitialized(_this3), "updateDisabledDateInputAttempt", function(value) {
329
+ var disabledDates = _this3.asProps.disabledDates;
330
+ var invalid = false;
331
+ if (value) {
332
+ if (value[0] && value[1]) invalid = disabledDates.some(datesIntersects([value[0], value[1]], _this3.asProps.unit));
333
+ else if (value[0]) invalid = disabledDates.some(includesDate(dayjs(value[0]), _this3.asProps.unit));
334
+ else if (value[1]) invalid = disabledDates.some(includesDate(dayjs(value[1]), _this3.asProps.unit));
335
+ }
336
+ if (invalid) {
337
+ var invalidValue = _this3.state.lastChangedInput === "to" ? value[1] : value[0];
268
338
  setTimeout(function() {
269
- r !== e.asProps.disabledDateInputAttempt && e.handlers.disabledDateInputAttempt(f);
339
+ if (value === _this3.asProps.disabledDateInputAttempt) return;
340
+ _this3.handlers.disabledDateInputAttempt(invalidValue);
270
341
  }, 0);
271
342
  }
272
- }), e;
343
+ });
344
+ return _this3;
273
345
  }
274
- return Pe(g, [{
346
+ _createClass(DateRangeRoot2, [{
275
347
  key: "uncontrolledProps",
276
- value: function() {
277
- var a = this;
348
+ value: function uncontrolledProps() {
349
+ var _this4 = this;
278
350
  return {
279
- disabledDateInputAttempt: [null, function(s) {
280
- var o = a.state.errorText, r = !1;
281
- if (s !== null) {
282
- if (o = a.asProps.disabledErrorText, o === void 0) {
283
- var d = "unavailableDate";
284
- a.asProps.parts && !a.asProps.parts.day && (d = "unavailableMonth"), a.state.lastChangedInput === "to" && (d = "unavailableEndDate", a.asProps.parts && !a.asProps.parts.day && (d = "unavailableEndMonth")), o = a.asProps.getI18nText(d);
351
+ disabledDateInputAttempt: [null, function(date) {
352
+ var errorText = _this4.state.errorText;
353
+ var showError = false;
354
+ if (date !== null) {
355
+ errorText = _this4.asProps.disabledErrorText;
356
+ if (errorText === void 0) {
357
+ var key = "unavailableDate";
358
+ if (_this4.asProps.parts && !_this4.asProps.parts.day) {
359
+ key = "unavailableMonth";
360
+ }
361
+ if (_this4.state.lastChangedInput === "to") {
362
+ key = "unavailableEndDate";
363
+ if (_this4.asProps.parts && !_this4.asProps.parts.day) {
364
+ key = "unavailableEndMonth";
365
+ }
366
+ }
367
+ errorText = _this4.asProps.getI18nText(key);
285
368
  }
286
- typeof o == "function" && (o = o(s)), r = a.asProps.disabledErrorText !== null;
369
+ if (typeof errorText === "function") {
370
+ errorText = errorText(date);
371
+ }
372
+ showError = _this4.asProps.disabledErrorText !== null;
287
373
  }
288
- a.setState({
289
- errorText: o,
290
- showError: r
374
+ _this4.setState({
375
+ errorText,
376
+ showError
291
377
  });
292
378
  }]
293
379
  };
294
380
  }
295
381
  }, {
296
382
  key: "getFromMaskedInputProps",
297
- value: function() {
298
- var a = this.asProps, s = a.value, o = a.locale, r = a.onDisplayedPeriodChange, d = a.ariaHasPopup;
299
- a.showError;
300
- var n = W(a, Da);
301
- return Ne({
383
+ value: function getFromMaskedInputProps() {
384
+ var _this$asProps6 = this.asProps, value = _this$asProps6.value, locale = _this$asProps6.locale, onDisplayedPeriodChange = _this$asProps6.onDisplayedPeriodChange, ariaHasPopup = _this$asProps6.ariaHasPopup;
385
+ _this$asProps6.showError;
386
+ var otherProps = _objectWithoutProperties(_this$asProps6, _excluded4);
387
+ return assignProps$1({
302
388
  ref: this.fromRef,
303
- date: s == null ? void 0 : s[0],
389
+ date: value === null || value === void 0 ? void 0 : value[0],
304
390
  onDateChange: this.handleFromChange,
305
391
  onKeyDown: this.handleFromKeydown,
306
- locale: o,
392
+ locale,
307
393
  flex: 1,
308
- onDisplayedPeriodChange: r,
309
- "aria-haspopup": d,
394
+ onDisplayedPeriodChange,
395
+ "aria-haspopup": ariaHasPopup,
310
396
  onMaskPipeBlock: this.handleInputMaskPipeBlock,
311
397
  containerFocused: this.state.containerFocused
312
- }, n);
398
+ }, otherProps);
313
399
  }
314
400
  }, {
315
401
  key: "getToMaskedInputProps",
316
- value: function() {
317
- var a = this.asProps, s = a.value, o = a.locale, r = a.onDisplayedPeriodChange, d = a.ariaHasPopup;
318
- a.inputId, a.showError;
319
- var n = W(a, ja), f = this.asProps.getI18nText("toDate", {
402
+ value: function getToMaskedInputProps() {
403
+ var _this$asProps7 = this.asProps, value = _this$asProps7.value, locale = _this$asProps7.locale, onDisplayedPeriodChange = _this$asProps7.onDisplayedPeriodChange, ariaHasPopup = _this$asProps7.ariaHasPopup;
404
+ _this$asProps7.inputId;
405
+ _this$asProps7.showError;
406
+ var otherProps = _objectWithoutProperties(_this$asProps7, _excluded5);
407
+ var ariaLabel = this.asProps.getI18nText("toDate", {
320
408
  date: this.asProps.getI18nText("input")
321
409
  });
322
- return Ne({
410
+ return assignProps$1({
323
411
  ref: this.toRef,
324
- date: s == null ? void 0 : s[1],
412
+ date: value === null || value === void 0 ? void 0 : value[1],
325
413
  onDateChange: this.handleToChange,
326
414
  onKeyDown: this.handleToKeydown,
327
- locale: o,
415
+ locale,
328
416
  flex: 1,
329
- onDisplayedPeriodChange: r,
330
- "aria-label": f,
331
- "aria-haspopup": d,
417
+ onDisplayedPeriodChange,
418
+ "aria-label": ariaLabel,
419
+ "aria-haspopup": ariaHasPopup,
332
420
  onMaskPipeBlock: this.handleInputMaskPipeBlock,
333
421
  containerFocused: this.state.containerFocused
334
- }, n);
422
+ }, otherProps);
335
423
  }
336
424
  }, {
337
425
  key: "getRangeSepProps",
338
- value: function() {
339
- var a = this.asProps.value;
426
+ value: function getRangeSepProps() {
427
+ var value = this.asProps.value;
340
428
  return {
341
- fulfilled: !!(a && (a[0] || a[1]))
429
+ fulfilled: !!(value && (value[0] || value[1]))
342
430
  };
343
431
  }
344
432
  }, {
345
433
  key: "componentDidUpdate",
346
- value: function(a) {
347
- a.value !== this.asProps.value && this.updateDisabledDateInputAttempt(this.asProps.value);
434
+ value: function componentDidUpdate(prevProps) {
435
+ if (prevProps.value !== this.asProps.value) {
436
+ this.updateDisabledDateInputAttempt(this.asProps.value);
437
+ }
348
438
  }
349
439
  }, {
350
440
  key: "componentDidMount",
351
- value: function() {
441
+ value: function componentDidMount() {
352
442
  this.updateDisabledDateInputAttempt(this.asProps.value);
353
443
  }
354
444
  }, {
355
445
  key: "render",
356
- value: function() {
357
- var a = this.asProps, s, o = Q, r = this.asProps, d = r.Children, n = r.styles, f = r.w, j = r.state, b = r.showError, C = r.popoverVisible, M = this.state, P = M.errorText, V = M.lastChangedInput, O = M.showError, B = M.containerFocused, X = O && b;
358
- return s = A(n), /* @__PURE__ */ i.createElement(o, s.cn("SDateRange", E({}, N({
359
- tag: Oe,
360
- ignorePortalsStacking: !0,
361
- placement: V === "to" ? "top-end" : "top-start",
362
- title: P,
363
- theme: "warning",
364
- visible: X && (C || B),
365
- state: X ? "invalid" : j,
366
- __excludeProps: ["onChange", "value", "aria-expanded"],
367
- w: f,
368
- onFocus: this.handleFocus,
369
- onBlur: this.handleBlur
370
- }, a))), /* @__PURE__ */ i.createElement(d, s.cn("Children", {})));
371
- }
372
- }]), g;
373
- }(be);
374
- p(se, "displayName", "DateRange");
375
- p(se, "style", Re);
376
- p(se, "defaultProps", {
377
- children: function() {
378
- return /* @__PURE__ */ i.createElement(i.Fragment, null, /* @__PURE__ */ i.createElement(J.Indicator, null), /* @__PURE__ */ i.createElement(J.FromMaskedInput, null), /* @__PURE__ */ i.createElement(J.RangeSep, null), /* @__PURE__ */ i.createElement(J.ToMaskedInput, null));
446
+ value: function render() {
447
+ var _ref3 = this.asProps, _ref10;
448
+ var SDateRange = InputMask;
449
+ var _this$asProps8 = this.asProps, Children = _this$asProps8.Children, styles = _this$asProps8.styles, w = _this$asProps8.w, state = _this$asProps8.state, showErrorProps = _this$asProps8.showError, popoverVisible = _this$asProps8.popoverVisible;
450
+ var _this$state2 = this.state, errorText = _this$state2.errorText, lastChangedInput = _this$state2.lastChangedInput, showErrorState = _this$state2.showError, containerFocused = _this$state2.containerFocused;
451
+ var showError = showErrorState && showErrorProps;
452
+ return _ref10 = sstyled$1(styles), /* @__PURE__ */ React.createElement(SDateRange, _ref10.cn("SDateRange", _objectSpread({}, assignProps({
453
+ "tag": Tooltip,
454
+ "ignorePortalsStacking": true,
455
+ "placement": lastChangedInput === "to" ? "top-end" : "top-start",
456
+ "title": errorText,
457
+ "theme": "warning",
458
+ "visible": showError && (popoverVisible || containerFocused),
459
+ "state": showError ? "invalid" : state,
460
+ "__excludeProps": ["onChange", "value", "aria-expanded"],
461
+ "w": w,
462
+ "onFocus": this.handleFocus,
463
+ "onBlur": this.handleBlur
464
+ }, _ref3))), /* @__PURE__ */ React.createElement(Children, _ref10.cn("Children", {})));
465
+ }
466
+ }]);
467
+ return DateRangeRoot2;
468
+ }(Component);
469
+ _defineProperty(DateRangeRoot, "displayName", "DateRange");
470
+ _defineProperty(DateRangeRoot, "style", style);
471
+ _defineProperty(DateRangeRoot, "defaultProps", {
472
+ children: function children2() {
473
+ return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(DateRange.Indicator, null), /* @__PURE__ */ React.createElement(DateRange.FromMaskedInput, null), /* @__PURE__ */ React.createElement(DateRange.RangeSep, null), /* @__PURE__ */ React.createElement(DateRange.ToMaskedInput, null));
379
474
  },
380
- defaultDisabledDateInputAttempt: !1,
381
- showError: !0
475
+ defaultDisabledDateInputAttempt: false,
476
+ showError: true
382
477
  });
383
- var qa = function(u) {
384
- var g = arguments[0], e, a = xe, s = u.getI18nText;
385
- return e = A(u.styles), /* @__PURE__ */ i.createElement(a, e.cn("SFromMaskedInput", E({}, N({
386
- labelPrefix: s("fromDatePlaceholder")
387
- }, g))));
388
- }, wa = function(u) {
389
- var g = arguments[0], e, a = xe, s = u.getI18nText;
390
- return e = A(u.styles), /* @__PURE__ */ i.createElement(a, e.cn("SToMaskedInput", E({}, N({
391
- labelPrefix: s("toDatePlaceholder")
392
- }, g))));
393
- }, Ke = function(u) {
394
- var g = arguments[0], e, a = Q.Addon;
395
- return e = A(u.styles), /* @__PURE__ */ i.createElement(a, e.cn("SIndicator", E({}, N({
396
- tag: va,
478
+ var FromMaskedInput = function FromMaskedInput2(props) {
479
+ var _ref4 = arguments[0], _ref11;
480
+ var SFromMaskedInput = MaskedInput;
481
+ var getI18nText = props.getI18nText;
482
+ return _ref11 = sstyled$1(props.styles), /* @__PURE__ */ React.createElement(SFromMaskedInput, _ref11.cn("SFromMaskedInput", _objectSpread({}, assignProps({
483
+ "labelPrefix": getI18nText("fromDatePlaceholder")
484
+ }, _ref4))));
485
+ };
486
+ var ToMaskedInput = function ToMaskedInput2(props) {
487
+ var _ref5 = arguments[0], _ref12;
488
+ var SToMaskedInput = MaskedInput;
489
+ var getI18nText = props.getI18nText;
490
+ return _ref12 = sstyled$1(props.styles), /* @__PURE__ */ React.createElement(SToMaskedInput, _ref12.cn("SToMaskedInput", _objectSpread({}, assignProps({
491
+ "labelPrefix": getI18nText("toDatePlaceholder")
492
+ }, _ref5))));
493
+ };
494
+ var Indicator = function Indicator2(props) {
495
+ var _ref6 = arguments[0], _ref13;
496
+ var SIndicator = InputMask.Addon;
497
+ return _ref13 = sstyled$1(props.styles), /* @__PURE__ */ React.createElement(SIndicator, _ref13.cn("SIndicator", _objectSpread({}, assignProps({
498
+ "tag": Calendar,
397
499
  "aria-hidden": "true",
398
- tabIndex: -1
399
- }, g))));
400
- }, ka = function(u) {
401
- var g = arguments[0], e, a = Q.Addon;
402
- return e = A(u.styles), /* @__PURE__ */ i.createElement(a, e.cn("SRangeSep", E({}, N({
403
- tag: fa,
404
- alignItems: "center",
405
- justifyContent: "center",
406
- pl: 0,
407
- flex: "0"
408
- }, g))), "–");
409
- }, xe = function(u) {
410
- var g, e = u.date, a = u.onDateChange, s = u.onDisplayedPeriodChange, o = u.locale, r = u.styles, d = u.parts, n = d === void 0 ? Ra : d, f = u.disabledDates, j = u.forwardRef, b = u.placeholders, C = u.labelPrefix, M = C === void 0 ? "Date" : C, P = u.onMaskPipeBlock, V = u.containerFocused, O = u.animationsDisabled, B = u.getI18nText, X = u.inputId, qe = u.inputRole, Le = qe === void 0 ? "combobox" : qe;
411
- u.__excludeProps, u.Root;
412
- var Y = W(u, ba), le = i.useRef(), We = i.useState(void 0), we = ne(We, 2), _e = we[0], Ye = we[1], _ = i.useMemo(function() {
413
- return b || {
414
- year: B("placeholder-years"),
415
- month: B("placeholder-months"),
416
- day: B("placeholder-days")
500
+ "tabIndex": -1
501
+ }, _ref6))));
502
+ };
503
+ var RangeSep = function RangeSep2(props) {
504
+ var _ref7 = arguments[0], _ref14;
505
+ var SRangeSep = InputMask.Addon;
506
+ return _ref14 = sstyled$1(props.styles), /* @__PURE__ */ React.createElement(SRangeSep, _ref14.cn("SRangeSep", _objectSpread({}, assignProps({
507
+ "tag": Flex,
508
+ "alignItems": "center",
509
+ "justifyContent": "center",
510
+ "pl": 0,
511
+ "flex": "0"
512
+ }, _ref7))), "");
513
+ };
514
+ var MaskedInput = function MaskedInput2(_ref16) {
515
+ var _ref15;
516
+ var outerValue = _ref16.date, onDateChange = _ref16.onDateChange, onDisplayedPeriodChange = _ref16.onDisplayedPeriodChange, locale = _ref16.locale, styles = _ref16.styles, _ref16$parts = _ref16.parts, allowedParts = _ref16$parts === void 0 ? defaultAllowedParts : _ref16$parts, disabledDates = _ref16.disabledDates, forwardRef = _ref16.forwardRef, providedPlaceholders = _ref16.placeholders, _ref16$labelPrefix = _ref16.labelPrefix, labelPrefix = _ref16$labelPrefix === void 0 ? "Date" : _ref16$labelPrefix, onMaskPipeBlock = _ref16.onMaskPipeBlock, containerFocused = _ref16.containerFocused, animationsDisabled = _ref16.animationsDisabled, getI18nText = _ref16.getI18nText, inputId = _ref16.inputId, _ref16$inputRole = _ref16.inputRole, inputRole = _ref16$inputRole === void 0 ? "combobox" : _ref16$inputRole;
517
+ _ref16.__excludeProps;
518
+ _ref16.Root;
519
+ var otherProps = _objectWithoutProperties(_ref16, _excluded6);
520
+ var ref = React.useRef();
521
+ var _React$useState = React.useState(void 0), _React$useState2 = _slicedToArray(_React$useState, 2), width = _React$useState2[0], setWidth = _React$useState2[1];
522
+ var placeholders = React.useMemo(function() {
523
+ if (providedPlaceholders) return providedPlaceholders;
524
+ return {
525
+ year: getI18nText("placeholder-years"),
526
+ month: getI18nText("placeholder-months"),
527
+ day: getI18nText("placeholder-days")
417
528
  };
418
- }, [b, B]);
419
- if (_.year.length !== 1 || _.month.length !== 1 || _.day.length !== 1)
420
- throw console.error({
421
- placeholders: _
422
- }), new Error("InputTrigger placeholder prop should contain fields year, month and day each one with string value of single character length. [see above what was received] (".concat(_, ")"), _);
423
- var ke = i.useMemo(function() {
424
- var t, l = {
529
+ }, [providedPlaceholders, getI18nText]);
530
+ if (placeholders.year.length !== 1 || placeholders.month.length !== 1 || placeholders.day.length !== 1) {
531
+ console.error({
532
+ placeholders
533
+ });
534
+ throw new Error("InputTrigger placeholder prop should contain fields year, month and day each one with string value of single character length. [see above what was received] (".concat(placeholders, ")"), placeholders);
535
+ }
536
+ var _React$useMemo = React.useMemo(function() {
537
+ var _sep;
538
+ var options = {
425
539
  year: "numeric",
426
540
  month: "numeric",
427
541
  day: "numeric"
428
- }, c = new Intl.DateTimeFormat(o, l), S = void 0, h = [], v = c.formatToParts(xa), I = G(v), R;
542
+ };
543
+ var dateTimeFormat = new Intl.DateTimeFormat(locale, options);
544
+ var sep2 = void 0;
545
+ var order2 = [];
546
+ var parts = dateTimeFormat.formatToParts(exampleDate);
547
+ var _iterator = _createForOfIteratorHelper(parts), _step;
429
548
  try {
430
- for (I.s(); !(R = I.n()).done; ) {
431
- var D = R.value;
432
- !S && D.type === "literal" && (S = D.value), h.length < 3 && ["day", "month", "year"].includes(D.type) && n[D.type] && h.push(D.type);
549
+ for (_iterator.s(); !(_step = _iterator.n()).done; ) {
550
+ var part = _step.value;
551
+ if (!sep2 && part.type === "literal") {
552
+ sep2 = part.value;
553
+ }
554
+ if (order2.length < 3 && ["day", "month", "year"].includes(part.type) && allowedParts[part.type]) {
555
+ order2.push(part.type);
556
+ }
433
557
  }
434
- } catch (x) {
435
- I.e(x);
558
+ } catch (err) {
559
+ _iterator.e(err);
436
560
  } finally {
437
- I.f();
561
+ _iterator.f();
562
+ }
563
+ sep2 = (_sep = sep2) !== null && _sep !== void 0 ? _sep : " ";
564
+ return {
565
+ sep: sep2,
566
+ order: order2
567
+ };
568
+ }, [locale, allowedParts]), sep = _React$useMemo.sep, order = _React$useMemo.order;
569
+ var outer = React.useMemo(function() {
570
+ var outerDate = outerValue;
571
+ if (typeof outerValue === "number" || typeof outerValue === "string") {
572
+ outerDate = new Date(outerValue);
438
573
  }
439
- return S = (t = S) !== null && t !== void 0 ? t : " ", {
440
- sep: S,
441
- order: h
574
+ var validDate = outerDate && outerDate instanceof Date && !Number.isNaN(outerDate.getTime());
575
+ if (!validDate) return null;
576
+ return {
577
+ year: outerDate.getFullYear().toString().padStart(4, "0"),
578
+ month: (outerDate.getMonth() + 1).toString().padStart(2, "0"),
579
+ day: outerDate.getDate().toString().padStart(2, "0")
442
580
  };
443
- }, [o, n]), F = ke.sep, k = ke.order, w = i.useMemo(function() {
444
- var t = e;
445
- (typeof e == "number" || typeof e == "string") && (t = new Date(e));
446
- var l = t && t instanceof Date && !Number.isNaN(t.getTime());
447
- return l ? {
448
- year: t.getFullYear().toString().padStart(4, "0"),
449
- month: (t.getMonth() + 1).toString().padStart(2, "0"),
450
- day: t.getDate().toString().padStart(2, "0")
451
- } : null;
452
- }, [e]), Te = i.useCallback(function(t) {
453
- if (!t || !t.year && !t.month && !t.day) return null;
454
- var l = [], c = G(k), S;
581
+ }, [outerValue]);
582
+ var stringifyValue = React.useCallback(function(value2) {
583
+ if (!value2) return null;
584
+ if (!value2.year && !value2.month && !value2.day) return null;
585
+ var result = [];
586
+ var _iterator2 = _createForOfIteratorHelper(order), _step2;
455
587
  try {
456
- for (c.s(); !(S = c.n()).done; ) {
457
- var h = S.value;
458
- n[h] && (h === "year" && t.year && l.push(t.year), h === "month" && t.month && l.push(t.month), h === "day" && t.day && l.push(t.day));
588
+ for (_iterator2.s(); !(_step2 = _iterator2.n()).done; ) {
589
+ var part = _step2.value;
590
+ if (!allowedParts[part]) continue;
591
+ if (part === "year" && value2.year) result.push(value2.year);
592
+ if (part === "month" && value2.month) result.push(value2.month);
593
+ if (part === "day" && value2.day) result.push(value2.day);
459
594
  }
460
- } catch (v) {
461
- c.e(v);
595
+ } catch (err) {
596
+ _iterator2.e(err);
462
597
  } finally {
463
- c.f();
464
- }
465
- return l.join(F);
466
- }, [k, n]), Ue = i.useState(w), Ce = ne(Ue, 2), Me = Ce[0], Z = Ce[1], ue = i.useMemo(function() {
467
- return Te(Me);
468
- }, [Te, Me]), z = i.useRef(w);
469
- i.useEffect(function() {
470
- var t, l, c;
471
- (((t = z.current) === null || t === void 0 ? void 0 : t.day) !== (w == null ? void 0 : w.day) || ((l = z.current) === null || l === void 0 ? void 0 : l.month) !== (w == null ? void 0 : w.month) || ((c = z.current) === null || c === void 0 ? void 0 : c.year) !== (w == null ? void 0 : w.year)) && Z(w), z.current = w;
472
- }, [w, Z]);
473
- var Ge = i.useCallback(function(t) {
474
- for (var l = !0, c = 0; c < t.length; c++)
475
- if (t[c] !== "_" && t[c] !== F) {
476
- l = !1;
598
+ _iterator2.f();
599
+ }
600
+ return result.join(sep);
601
+ }, [order, allowedParts]);
602
+ var _React$useState3 = React.useState(outer), _React$useState4 = _slicedToArray(_React$useState3, 2), internalValue = _React$useState4[0], setInternalValue = _React$useState4[1];
603
+ var value = React.useMemo(function() {
604
+ return stringifyValue(internalValue);
605
+ }, [stringifyValue, internalValue]);
606
+ var lastKnownOuterValue = React.useRef(outer);
607
+ React.useEffect(function() {
608
+ var _lastKnownOuterValue$, _lastKnownOuterValue$2, _lastKnownOuterValue$3;
609
+ if (((_lastKnownOuterValue$ = lastKnownOuterValue.current) === null || _lastKnownOuterValue$ === void 0 ? void 0 : _lastKnownOuterValue$.day) !== (outer === null || outer === void 0 ? void 0 : outer.day) || ((_lastKnownOuterValue$2 = lastKnownOuterValue.current) === null || _lastKnownOuterValue$2 === void 0 ? void 0 : _lastKnownOuterValue$2.month) !== (outer === null || outer === void 0 ? void 0 : outer.month) || ((_lastKnownOuterValue$3 = lastKnownOuterValue.current) === null || _lastKnownOuterValue$3 === void 0 ? void 0 : _lastKnownOuterValue$3.year) !== (outer === null || outer === void 0 ? void 0 : outer.year)) {
610
+ setInternalValue(outer);
611
+ }
612
+ lastKnownOuterValue.current = outer;
613
+ }, [outer, setInternalValue]);
614
+ var pipeMask = React.useCallback(function(value2) {
615
+ var placeholdersOnly = true;
616
+ for (var i = 0; i < value2.length; i++) {
617
+ if (value2[i] !== "_" && value2[i] !== sep) {
618
+ placeholdersOnly = false;
477
619
  break;
478
620
  }
479
- if (l)
480
- return P == null || P(null), "";
481
- var S = function(ua) {
482
- var Ae = k.slice(0, k.indexOf(ua)), U = 0, re = G(Ae), Ve;
621
+ }
622
+ if (placeholdersOnly) {
623
+ onMaskPipeBlock === null || onMaskPipeBlock === void 0 ? void 0 : onMaskPipeBlock(null);
624
+ return "";
625
+ }
626
+ var getOffsetTo = function getOffsetTo2(partName2) {
627
+ var partsBefore = order.slice(0, order.indexOf(partName2));
628
+ var offset = 0;
629
+ var _iterator3 = _createForOfIteratorHelper(partsBefore), _step3;
483
630
  try {
484
- for (re.s(); !(Ve = re.n()).done; ) {
485
- var he = Ve.value;
486
- he === "year" && n.year && (U += 4), he === "month" && n.month && (U += 2), he === "day" && n.day && (U += 2);
631
+ for (_iterator3.s(); !(_step3 = _iterator3.n()).done; ) {
632
+ var part2 = _step3.value;
633
+ if (part2 === "year" && allowedParts.year) offset += 4;
634
+ if (part2 === "month" && allowedParts.month) offset += 2;
635
+ if (part2 === "day" && allowedParts.day) offset += 2;
487
636
  }
488
- } catch (da) {
489
- re.e(da);
637
+ } catch (err) {
638
+ _iterator3.e(err);
490
639
  } finally {
491
- re.f();
640
+ _iterator3.f();
492
641
  }
493
- return U += Ae.length * F.length, U;
494
- }, h = [], v = {}, I = t.split(F);
495
- for (var R in _)
496
- v[R] = _[R];
497
- for (var D = 0; D < k.length; D++)
498
- v[k[D]] = I[D];
499
- var x = v.year, y = v.month, m = v.day;
500
- if (n.month && (y[0] !== "_" && parseInt(y[0], 10) > 1 && (y = "0".concat(y[0]), h.push(S("month"))), y === "00" && (y = "01"), y[0] !== "_" && y[1] !== "_" && parseInt(y, 10) > 12) || n.day && (m[0] !== "_" && parseInt(m[0], 10) > 3 && (m = "0".concat(m[0]), h.push(S("day"))), m === "00" && (m = "01"), m[0] !== "_" && m[1] !== "_" && parseInt(m, 10) > 31))
501
- return !1;
502
- x = x.split("").map(function($) {
503
- return $ === "_" ? _.year : $;
504
- }).join(""), y = y.split("").map(function($) {
505
- return $ === "_" ? _.month : $;
506
- }).join(""), m = m.split("").map(function($) {
507
- return $ === "_" ? _.day : $;
642
+ offset += partsBefore.length * sep.length;
643
+ return offset;
644
+ };
645
+ var indexesOfPipedChars = [];
646
+ var parsed = {};
647
+ var parts = value2.split(sep);
648
+ for (var partName in placeholders) {
649
+ parsed[partName] = placeholders[partName];
650
+ }
651
+ for (var _i = 0; _i < order.length; _i++) {
652
+ parsed[order[_i]] = parts[_i];
653
+ }
654
+ var year = parsed.year, month = parsed.month, day = parsed.day;
655
+ if (allowedParts.month) {
656
+ if (month[0] !== "_" && parseInt(month[0], 10) > 1) {
657
+ month = "0".concat(month[0]);
658
+ indexesOfPipedChars.push(getOffsetTo("month"));
659
+ }
660
+ if (month === "00") month = "01";
661
+ if (month[0] !== "_" && month[1] !== "_" && parseInt(month, 10) > 12) return false;
662
+ }
663
+ if (allowedParts.day) {
664
+ if (day[0] !== "_" && parseInt(day[0], 10) > 3) {
665
+ day = "0".concat(day[0]);
666
+ indexesOfPipedChars.push(getOffsetTo("day"));
667
+ }
668
+ if (day === "00") day = "01";
669
+ if (day[0] !== "_" && day[1] !== "_" && parseInt(day, 10) > 31) return false;
670
+ }
671
+ year = year.split("").map(function(_char) {
672
+ return _char === "_" ? placeholders.year : _char;
508
673
  }).join("");
509
- var ee = !n.year || x && x.length >= 4 && !x.includes(_.year), pe = !n.month || y && y.length === 2 && !y.includes(_.month), ce = !n.day || m && m.length === 2 && !m.includes(_.day), ge = ee && pe && ce;
510
- if (ge) {
511
- var H = new Date(0, 0, 0, 0, 0, 0, 0), sa = n.year ? parseInt(x, 10) : 0, la = n.month ? parseInt(y, 10) - 1 : 0, _a = n.day ? parseInt(m, 10) : 1;
512
- if (H.setFullYear(sa, la, _a), f != null && f.some(ve(me(H), "date")) || n.day && H.getDate() !== parseInt(m, 10))
513
- return P == null || P(H), !1;
674
+ month = month.split("").map(function(_char2) {
675
+ return _char2 === "_" ? placeholders.month : _char2;
676
+ }).join("");
677
+ day = day.split("").map(function(_char3) {
678
+ return _char3 === "_" ? placeholders.day : _char3;
679
+ }).join("");
680
+ var yearFulfilled = !allowedParts.year || year && year.length >= 4 && !year.includes(placeholders.year);
681
+ var monthFulfilled = !allowedParts.month || month && month.length === 2 && !month.includes(placeholders.month);
682
+ var dayFulfilled = !allowedParts.day || day && day.length === 2 && !day.includes(placeholders.day);
683
+ var fulfilled = yearFulfilled && monthFulfilled && dayFulfilled;
684
+ if (fulfilled) {
685
+ var date = new Date(0, 0, 0, 0, 0, 0, 0);
686
+ var yearParsed = allowedParts.year ? parseInt(year, 10) : 0;
687
+ var monthParsed = allowedParts.month ? parseInt(month, 10) - 1 : 0;
688
+ var dayParsed = allowedParts.day ? parseInt(day, 10) : 1;
689
+ date.setFullYear(yearParsed, monthParsed, dayParsed);
690
+ if (disabledDates !== null && disabledDates !== void 0 && disabledDates.some(includesDate(dayjs(date), "date"))) {
691
+ onMaskPipeBlock === null || onMaskPipeBlock === void 0 ? void 0 : onMaskPipeBlock(date);
692
+ return false;
693
+ }
694
+ if (allowedParts.day) {
695
+ if (date.getDate() !== parseInt(day, 10)) {
696
+ onMaskPipeBlock === null || onMaskPipeBlock === void 0 ? void 0 : onMaskPipeBlock(date);
697
+ return false;
698
+ }
699
+ }
514
700
  }
515
- var ae = [], te = G(k), Be;
701
+ var result = [];
702
+ var _iterator4 = _createForOfIteratorHelper(order), _step4;
516
703
  try {
517
- for (te.s(); !(Be = te.n()).done; ) {
518
- var fe = Be.value;
519
- fe === "year" && ae.push(x), fe === "month" && ae.push(y), fe === "day" && ae.push(m);
704
+ for (_iterator4.s(); !(_step4 = _iterator4.n()).done; ) {
705
+ var part = _step4.value;
706
+ if (part === "year") result.push(year);
707
+ if (part === "month") result.push(month);
708
+ if (part === "day") result.push(day);
520
709
  }
521
- } catch ($) {
522
- te.e($);
710
+ } catch (err) {
711
+ _iterator4.e(err);
523
712
  } finally {
524
- te.f();
713
+ _iterator4.f();
525
714
  }
526
- return P == null || P(null), {
527
- value: ae.join(F),
528
- indexesOfPipedChars: h
715
+ onMaskPipeBlock === null || onMaskPipeBlock === void 0 ? void 0 : onMaskPipeBlock(null);
716
+ return {
717
+ value: result.join(sep),
718
+ indexesOfPipedChars
529
719
  };
530
- }, [_, F, k, n, f, P]), Je = i.useCallback(function(t) {
531
- var l = {};
532
- for (var c in _)
533
- l[c] = _[c];
534
- for (var S = t.split(F), h = 0; h < k.length; h++)
535
- l[k[h]] = S[h];
536
- var v = l.year, I = l.month, R = l.day;
537
- Z({
538
- year: v,
539
- month: I,
540
- day: R
720
+ }, [placeholders, sep, order, allowedParts, disabledDates, onMaskPipeBlock]);
721
+ var handleChange = React.useCallback(function(value2) {
722
+ var parsed = {};
723
+ for (var partName in placeholders) {
724
+ parsed[partName] = placeholders[partName];
725
+ }
726
+ var parts = value2.split(sep);
727
+ for (var i = 0; i < order.length; i++) {
728
+ parsed[order[i]] = parts[i];
729
+ }
730
+ var year = parsed.year, month = parsed.month, day = parsed.day;
731
+ setInternalValue({
732
+ year,
733
+ month,
734
+ day
541
735
  });
542
- var D = !n.year || v && v.length >= 4 && !v.includes(_.year), x = !n.month || I && I.length === 2 && !I.includes(_.month), y = !n.day || R && R.length === 2 && !R.includes(_.day), m = D && x && y;
543
- if (m) {
544
- var ee = new Date(0, 0, 0, 0, 0, 0, 0), pe = n.year ? parseInt(v, 10) : 0, ce = n.month ? parseInt(I, 10) - 1 : 0, ge = n.day ? parseInt(R, 10) : 1;
545
- ee.setFullYear(pe, ce, ge), a(ee), z.current = {
546
- year: v,
547
- month: I,
548
- day: R
736
+ var yearFulfilled = !allowedParts.year || year && year.length >= 4 && !year.includes(placeholders.year);
737
+ var monthFulfilled = !allowedParts.month || month && month.length === 2 && !month.includes(placeholders.month);
738
+ var dayFulfilled = !allowedParts.day || day && day.length === 2 && !day.includes(placeholders.day);
739
+ var fulfilled = yearFulfilled && monthFulfilled && dayFulfilled;
740
+ if (fulfilled) {
741
+ var date = new Date(0, 0, 0, 0, 0, 0, 0);
742
+ var yearParsed = allowedParts.year ? parseInt(year, 10) : 0;
743
+ var monthParsed = allowedParts.month ? parseInt(month, 10) - 1 : 0;
744
+ var dayParsed = allowedParts.day ? parseInt(day, 10) : 1;
745
+ date.setFullYear(yearParsed, monthParsed, dayParsed);
746
+ onDateChange(date);
747
+ lastKnownOuterValue.current = {
748
+ year,
749
+ month,
750
+ day
549
751
  };
550
752
  return;
551
753
  }
552
- if (z.current !== null && (a(null), z.current = null), D && n.year) {
553
- var H = new Date(0, 0, 0, 0, 0, 0, 0);
554
- H.setFullYear(parseInt(v, 10)), x && n.month && H.setMonth(parseInt(I, 10) - 1), s(H);
754
+ if (lastKnownOuterValue.current !== null) {
755
+ onDateChange(null);
756
+ lastKnownOuterValue.current = null;
555
757
  }
556
- }, [a, Z, _, s, k, n]), K = i.useMemo(function() {
557
- var t = [], l = G(k), c;
758
+ if (yearFulfilled && allowedParts.year) {
759
+ var _date = new Date(0, 0, 0, 0, 0, 0, 0);
760
+ _date.setFullYear(parseInt(year, 10));
761
+ if (monthFulfilled && allowedParts.month) {
762
+ _date.setMonth(parseInt(month, 10) - 1);
763
+ }
764
+ onDisplayedPeriodChange(_date);
765
+ }
766
+ }, [onDateChange, setInternalValue, placeholders, onDisplayedPeriodChange, order, allowedParts]);
767
+ var mask = React.useMemo(function() {
768
+ var result = [];
769
+ var _iterator5 = _createForOfIteratorHelper(order), _step5;
558
770
  try {
559
- for (l.s(); !(c = l.n()).done; ) {
560
- var S = c.value;
561
- S === "year" && t.push(_.year + _.year + _.year + _.year), S === "month" && t.push(_.month + _.month), S === "day" && t.push(_.day + _.day);
771
+ for (_iterator5.s(); !(_step5 = _iterator5.n()).done; ) {
772
+ var part = _step5.value;
773
+ if (part === "year") result.push(placeholders.year + placeholders.year + placeholders.year + placeholders.year);
774
+ if (part === "month") result.push(placeholders.month + placeholders.month);
775
+ if (part === "day") result.push(placeholders.day + placeholders.day);
562
776
  }
563
- } catch (h) {
564
- l.e(h);
777
+ } catch (err) {
778
+ _iterator5.e(err);
565
779
  } finally {
566
- l.f();
567
- }
568
- return t.join(F);
569
- }, [F, k, _]), Qe = i.useMemo(function() {
570
- var t;
571
- return t = {}, p(t, _.year, /\d/), p(t, _.month, /\d/), p(t, _.day, /\d/), t;
572
- }, [_]), Xe = i.useMemo(function() {
573
- var t;
574
- return t = {}, p(t, _.year, !0), p(t, _.month, !0), p(t, _.day, !0), p(t, F, !0), t;
575
- }, [F, _]), L = i.useMemo(function() {
576
- var t = e;
577
- (typeof e == "number" || typeof e == "string") && (t = new Date(e));
578
- var l = t && t instanceof Date && !Number.isNaN(t.getTime());
579
- return l ? new Intl.DateTimeFormat(o, {
580
- year: n.year ? "numeric" : void 0,
581
- month: n.month ? "short" : void 0,
582
- day: n.day ? "numeric" : void 0
583
- }).format(t) : null;
584
- }, [e, o, n]);
585
- ze(function() {
586
- if (le.current) {
587
- for (var t = L ? [L, K] : [K], l = [], c = document.createElement("span"), S = window.getComputedStyle(le.current), h = ["height", "font-size", "font-family", "font-weight", "font-style", "line-height", "letter-spacing", "text-transform", "word-spacing"], v = 0, I = h; v < I.length; v++) {
588
- var R = I[v];
589
- c.style[R] = S[R];
590
- }
591
- c.style.position = "absolute", c.style.visibility = "hidden", document.body.appendChild(c);
592
- for (var D = 0, x = t; D < x.length; D++) {
593
- var y = x[D];
594
- c.innerHTML = y, l.push(c.offsetWidth);
595
- }
596
- c.remove();
597
- var m = Math.max.apply(Math, l);
598
- Ye(m);
599
- }
600
- }, [o, L, n, K]);
601
- var Ze = "div", ea = i.useCallback(function(t) {
602
- le.current = t, !(!t || t.tagName !== "INPUT") && (typeof j == "function" ? j(t) : j.current = t);
603
- }, [j]), aa = i.useState(_e), Ee = ne(aa, 2), Fe = Ee[0], ta = Ee[1], ra = i.useState(!1), $e = ne(ra, 2), na = $e[0], He = $e[1], de = V ?? na, oa = i.useCallback(function(t) {
604
- var l;
605
- (l = Y.onFocus) === null || l === void 0 || l.call(Y, t), He(!0);
606
- }, []), ia = i.useCallback(function(t) {
607
- var l;
608
- (l = Y.onBlur) === null || l === void 0 || l.call(Y, t), He(!1);
780
+ _iterator5.f();
781
+ }
782
+ return result.join(sep);
783
+ }, [sep, order, placeholders]);
784
+ var aliases = React.useMemo(function() {
785
+ var _ref17;
786
+ return _ref17 = {}, _defineProperty(_ref17, placeholders.year, /\d/), _defineProperty(_ref17, placeholders.month, /\d/), _defineProperty(_ref17, placeholders.day, /\d/), _ref17;
787
+ }, [placeholders]);
788
+ var maskOnlySymbols = React.useMemo(function() {
789
+ var _ref18;
790
+ return _ref18 = {}, _defineProperty(_ref18, placeholders.year, true), _defineProperty(_ref18, placeholders.month, true), _defineProperty(_ref18, placeholders.day, true), _defineProperty(_ref18, sep, true), _ref18;
791
+ }, [sep, placeholders]);
792
+ var humanizedDate = React.useMemo(function() {
793
+ var outerDate = outerValue;
794
+ if (typeof outerValue === "number" || typeof outerValue === "string") {
795
+ outerDate = new Date(outerValue);
796
+ }
797
+ var validDate = outerDate && outerDate instanceof Date && !Number.isNaN(outerDate.getTime());
798
+ if (!validDate) return null;
799
+ return new Intl.DateTimeFormat(locale, {
800
+ year: allowedParts.year ? "numeric" : void 0,
801
+ month: allowedParts.month ? "short" : void 0,
802
+ day: allowedParts.day ? "numeric" : void 0
803
+ }).format(outerDate);
804
+ }, [outerValue, locale, allowedParts]);
805
+ useEnhancedEffect(function() {
806
+ if (!ref.current) return;
807
+ var stringsToMeasure = humanizedDate ? [humanizedDate, mask] : [mask];
808
+ var widths = [];
809
+ var measureSpan = document.createElement("span");
810
+ var computedStyle = window.getComputedStyle(ref.current);
811
+ var typographyRelatedStyles = ["height", "font-size", "font-family", "font-weight", "font-style", "line-height", "letter-spacing", "text-transform", "word-spacing"];
812
+ for (var _i2 = 0, _typographyRelatedSty = typographyRelatedStyles; _i2 < _typographyRelatedSty.length; _i2++) {
813
+ var _style = _typographyRelatedSty[_i2];
814
+ measureSpan.style[_style] = computedStyle[_style];
815
+ }
816
+ measureSpan.style.position = "absolute";
817
+ measureSpan.style.visibility = "hidden";
818
+ document.body.appendChild(measureSpan);
819
+ for (var _i3 = 0, _stringsToMeasure = stringsToMeasure; _i3 < _stringsToMeasure.length; _i3++) {
820
+ var string = _stringsToMeasure[_i3];
821
+ measureSpan.innerHTML = string;
822
+ widths.push(measureSpan.offsetWidth);
823
+ }
824
+ measureSpan.remove();
825
+ var maxWidth = Math.max.apply(Math, widths);
826
+ setWidth(maxWidth);
827
+ }, [locale, humanizedDate, allowedParts, mask]);
828
+ var SHumanizedDate = "div";
829
+ var handleInputRef = React.useCallback(function(node) {
830
+ ref.current = node;
831
+ if (!node || node.tagName !== "INPUT") return;
832
+ if (typeof forwardRef === "function") forwardRef(node);
833
+ else forwardRef.current = node;
834
+ }, [forwardRef]);
835
+ var _React$useState5 = React.useState(width), _React$useState6 = _slicedToArray(_React$useState5, 2), appliedWidth = _React$useState6[0], setAppliedWidth = _React$useState6[1];
836
+ var _React$useState7 = React.useState(false), _React$useState8 = _slicedToArray(_React$useState7, 2), innerFocused = _React$useState8[0], setInnerFocused = _React$useState8[1];
837
+ var focused = containerFocused !== null && containerFocused !== void 0 ? containerFocused : innerFocused;
838
+ var handleFocus = React.useCallback(function(event) {
839
+ var _otherProps$onFocus;
840
+ (_otherProps$onFocus = otherProps.onFocus) === null || _otherProps$onFocus === void 0 ? void 0 : _otherProps$onFocus.call(otherProps, event);
841
+ setInnerFocused(true);
609
842
  }, []);
610
- return ze(function() {
611
- de || ta(_e);
612
- }, [_e, de]), g = A(r), /* @__PURE__ */ i.createElement(Q.Value, pa({
613
- "aria-label": M,
614
- title: K,
615
- mask: K,
616
- aliases: Qe,
617
- maskOnlySymbols: Xe,
618
- placeholder: K,
619
- inputW: Fe,
620
- wMin: Fe,
621
- id: X
622
- }, Y, {
623
- onFocus: oa,
624
- onBlur: ia,
625
- focused: de,
626
- ref: ea,
627
- pipe: Ge,
628
- value: ue ?? "",
629
- onChange: Je,
630
- noHumanizedDate: !L,
631
- animationsDisabled: O,
632
- inputRole: Le,
843
+ var handleBlur = React.useCallback(function(event) {
844
+ var _otherProps$onBlur;
845
+ (_otherProps$onBlur = otherProps.onBlur) === null || _otherProps$onBlur === void 0 ? void 0 : _otherProps$onBlur.call(otherProps, event);
846
+ setInnerFocused(false);
847
+ }, []);
848
+ useEnhancedEffect(function() {
849
+ if (focused) return;
850
+ setAppliedWidth(width);
851
+ }, [width, focused]);
852
+ return _ref15 = sstyled$1(styles), /* @__PURE__ */ React.createElement(InputMask.Value, _extends({
853
+ "aria-label": labelPrefix,
854
+ title: mask,
855
+ mask,
856
+ aliases,
857
+ maskOnlySymbols,
858
+ placeholder: mask,
859
+ inputW: appliedWidth,
860
+ wMin: appliedWidth,
861
+ id: inputId
862
+ }, otherProps, {
863
+ onFocus: handleFocus,
864
+ onBlur: handleBlur,
865
+ focused,
866
+ ref: handleInputRef,
867
+ pipe: pipeMask,
868
+ value: value !== null && value !== void 0 ? value : "",
869
+ onChange: handleChange,
870
+ noHumanizedDate: !humanizedDate,
871
+ animationsDisabled,
872
+ inputRole,
633
873
  inputMode: "numeric"
634
- }), L && /* @__PURE__ */ i.createElement(Ze, g.cn("SHumanizedDate", {}), L));
635
- }, ye = je(ie, {
636
- Indicator: Ke,
637
- MaskedInput: xe
638
- }), J = je(se, {
639
- Indicator: Ke,
640
- RangeSep: ka,
641
- FromMaskedInput: qa,
642
- ToMaskedInput: wa
643
- }), tt = je(oe, {
644
- Addon: ga.Addon,
645
- SingleDateInput: ye,
646
- DateRange: J
874
+ }), humanizedDate && /* @__PURE__ */ React.createElement(SHumanizedDate, _ref15.cn("SHumanizedDate", {}), humanizedDate));
875
+ };
876
+ var SingleDateInput = createComponent(SingleDateInputRoot, {
877
+ Indicator,
878
+ MaskedInput
879
+ });
880
+ var DateRange = createComponent(DateRangeRoot, {
881
+ Indicator,
882
+ RangeSep,
883
+ FromMaskedInput,
884
+ ToMaskedInput
885
+ });
886
+ var InputTrigger = createComponent(InputTriggerRoot, {
887
+ Addon: BaseTrigger.Addon,
888
+ SingleDateInput,
889
+ DateRange
647
890
  });
648
891
  export {
649
- tt as default
892
+ InputTrigger as default
650
893
  };