@semcore/date-picker 4.42.0 → 4.43.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/lib/cjs/DatePicker.js +2 -2
  3. package/lib/cjs/DatePicker.js.map +1 -1
  4. package/lib/cjs/DateRangeComparator.js +17 -9
  5. package/lib/cjs/DateRangeComparator.js.map +1 -1
  6. package/lib/cjs/MonthDateRangeComparator.js +21 -14
  7. package/lib/cjs/MonthDateRangeComparator.js.map +1 -1
  8. package/lib/cjs/components/Calendar.js +23 -23
  9. package/lib/cjs/components/Calendar.js.map +1 -1
  10. package/lib/cjs/components/DateRangeComparatorAbstract.js +57 -40
  11. package/lib/cjs/components/DateRangeComparatorAbstract.js.map +1 -1
  12. package/lib/cjs/components/InputTrigger.js +74 -44
  13. package/lib/cjs/components/InputTrigger.js.map +1 -1
  14. package/lib/cjs/components/PickerAbstract.js +31 -31
  15. package/lib/cjs/components/PickerAbstract.js.map +1 -1
  16. package/lib/cjs/components/RangePickerAbstract.js +31 -31
  17. package/lib/cjs/components/RangePickerAbstract.js.map +1 -1
  18. package/lib/cjs/index.d.js.map +1 -1
  19. package/lib/cjs/utils/datesIntersects.js +30 -0
  20. package/lib/cjs/utils/datesIntersects.js.map +1 -0
  21. package/lib/cjs/utils/includesDate.js +3 -3
  22. package/lib/cjs/utils/includesDate.js.map +1 -1
  23. package/lib/es6/DatePicker.js +1 -1
  24. package/lib/es6/DatePicker.js.map +1 -1
  25. package/lib/es6/DateRangeComparator.js +17 -9
  26. package/lib/es6/DateRangeComparator.js.map +1 -1
  27. package/lib/es6/MonthDateRangeComparator.js +21 -14
  28. package/lib/es6/MonthDateRangeComparator.js.map +1 -1
  29. package/lib/es6/components/Calendar.js +22 -22
  30. package/lib/es6/components/Calendar.js.map +1 -1
  31. package/lib/es6/components/DateRangeComparatorAbstract.js +57 -40
  32. package/lib/es6/components/DateRangeComparatorAbstract.js.map +1 -1
  33. package/lib/es6/components/InputTrigger.js +73 -43
  34. package/lib/es6/components/InputTrigger.js.map +1 -1
  35. package/lib/es6/components/PickerAbstract.js +30 -30
  36. package/lib/es6/components/PickerAbstract.js.map +1 -1
  37. package/lib/es6/components/RangePickerAbstract.js +30 -30
  38. package/lib/es6/components/RangePickerAbstract.js.map +1 -1
  39. package/lib/es6/index.d.js.map +1 -1
  40. package/lib/es6/utils/datesIntersects.js +22 -0
  41. package/lib/es6/utils/datesIntersects.js.map +1 -0
  42. package/lib/es6/utils/includesDate.js +2 -2
  43. package/lib/es6/utils/includesDate.js.map +1 -1
  44. package/lib/types/index.d.ts +15 -9
  45. package/package.json +14 -14
@@ -1,6 +1,6 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
2
2
  import { isInPeriod, isValidSchedule } from './cronTabScheduler';
3
- export default (function (date, unit) {
3
+ export var includesDate = function includesDate(date, unit) {
4
4
  return function (disabled_day) {
5
5
  if (Array.isArray(disabled_day)) {
6
6
  var MAX_DATE_TIMESTAMP = 8640000000000000;
@@ -14,5 +14,5 @@ export default (function (date, unit) {
14
14
  }
15
15
  return date.isSame(disabled_day, 'date');
16
16
  };
17
- });
17
+ };
18
18
  //# sourceMappingURL=includesDate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"includesDate.js","names":["isInPeriod","isValidSchedule","date","unit","disabled_day","Array","isArray","MAX_DATE_TIMESTAMP","_disabled_day","_slicedToArray","start","end","isBetween","toDate","isSame"],"sources":["../../../src/utils/includesDate.js"],"sourcesContent":["import { isInPeriod, isValidSchedule } from './cronTabScheduler';\n\nexport default (date, unit) => (disabled_day) => {\n if (Array.isArray(disabled_day)) {\n const MAX_DATE_TIMESTAMP = 8640000000000000;\n const [start, end] = disabled_day;\n return date.isBetween(start || -MAX_DATE_TIMESTAMP, end || MAX_DATE_TIMESTAMP, unit, '[]');\n }\n if (isValidSchedule(disabled_day)) {\n return isInPeriod(disabled_day, date.toDate());\n }\n return date.isSame(disabled_day, 'date');\n};\n"],"mappings":";AAAA,SAASA,UAAU,EAAEC,eAAe,QAAQ,oBAAoB;AAEhE,gBAAe,UAACC,IAAI,EAAEC,IAAI;EAAA,OAAK,UAACC,YAAY,EAAK;IAC/C,IAAIC,KAAK,CAACC,OAAO,CAACF,YAAY,CAAC,EAAE;MAC/B,IAAMG,kBAAkB,GAAG,gBAAgB;MAC3C,IAAAC,aAAA,GAAAC,cAAA,CAAqBL,YAAY;QAA1BM,KAAK,GAAAF,aAAA;QAAEG,GAAG,GAAAH,aAAA;MACjB,OAAON,IAAI,CAACU,SAAS,CAACF,KAAK,IAAI,CAACH,kBAAkB,EAAEI,GAAG,IAAIJ,kBAAkB,EAAEJ,IAAI,EAAE,IAAI,CAAC;IAC5F;IACA,IAAIF,eAAe,CAACG,YAAY,CAAC,EAAE;MACjC,OAAOJ,UAAU,CAACI,YAAY,EAAEF,IAAI,CAACW,MAAM,EAAE,CAAC;IAChD;IACA,OAAOX,IAAI,CAACY,MAAM,CAACV,YAAY,EAAE,MAAM,CAAC;EAC1C,CAAC;AAAA"}
1
+ {"version":3,"file":"includesDate.js","names":["isInPeriod","isValidSchedule","includesDate","date","unit","disabled_day","Array","isArray","MAX_DATE_TIMESTAMP","_disabled_day","_slicedToArray","start","end","isBetween","toDate","isSame"],"sources":["../../../src/utils/includesDate.js"],"sourcesContent":["import { isInPeriod, isValidSchedule } from './cronTabScheduler';\n\nexport const includesDate = (date, unit) => (disabled_day) => {\n if (Array.isArray(disabled_day)) {\n const MAX_DATE_TIMESTAMP = 8640000000000000;\n const [start, end] = disabled_day;\n return date.isBetween(start || -MAX_DATE_TIMESTAMP, end || MAX_DATE_TIMESTAMP, unit, '[]');\n }\n if (isValidSchedule(disabled_day)) {\n return isInPeriod(disabled_day, date.toDate());\n }\n return date.isSame(disabled_day, 'date');\n};\n"],"mappings":";AAAA,SAASA,UAAU,EAAEC,eAAe,QAAQ,oBAAoB;AAEhE,OAAO,IAAMC,YAAY,GAAG,SAAfA,YAAYA,CAAIC,IAAI,EAAEC,IAAI;EAAA,OAAK,UAACC,YAAY,EAAK;IAC5D,IAAIC,KAAK,CAACC,OAAO,CAACF,YAAY,CAAC,EAAE;MAC/B,IAAMG,kBAAkB,GAAG,gBAAgB;MAC3C,IAAAC,aAAA,GAAAC,cAAA,CAAqBL,YAAY;QAA1BM,KAAK,GAAAF,aAAA;QAAEG,GAAG,GAAAH,aAAA;MACjB,OAAON,IAAI,CAACU,SAAS,CAACF,KAAK,IAAI,CAACH,kBAAkB,EAAEI,GAAG,IAAIJ,kBAAkB,EAAEJ,IAAI,EAAE,IAAI,CAAC;IAC5F;IACA,IAAIH,eAAe,CAACI,YAAY,CAAC,EAAE;MACjC,OAAOL,UAAU,CAACK,YAAY,EAAEF,IAAI,CAACW,MAAM,EAAE,CAAC;IAChD;IACA,OAAOX,IAAI,CAACY,MAAM,CAACV,YAAY,EAAE,MAAM,CAAC;EAC1C,CAAC;AAAA"}
@@ -26,7 +26,7 @@ export type CalendarProps = BoxProps & {
26
26
  * Array of dates blocked for selection
27
27
  * Accepts the date or the range of dates for specifying infinity ([Date | false, Date | false]), crontab(6,7)
28
28
  * */
29
- disabled?: (Date | (Date | false)[] | string)[];
29
+ disabled?: (DateConstructorParams | (DateConstructorParams | false)[] | string)[];
30
30
  /**
31
31
  * @ignore
32
32
  * */
@@ -113,7 +113,7 @@ export type DatePickerProps = Intergalactic.InternalTypings.EfficientOmit<
113
113
  /**
114
114
  * Array of dates blocked for selection
115
115
  * */
116
- disabled?: (Date | (Date | false)[] | string)[];
116
+ disabled?: (DateConstructorParams | (DateConstructorParams | false)[] | string)[];
117
117
  /**
118
118
  * Error message when user attempts to input a disabled date
119
119
  * */
@@ -180,7 +180,7 @@ export type DateRangePickerProps = Intergalactic.InternalTypings.EfficientOmit<
180
180
  /**
181
181
  * Array of dates blocked for selection
182
182
  * */
183
- disabled?: (Date | (Date | false)[] | string)[];
183
+ disabled?: (DateConstructorParams | (DateConstructorParams | false)[] | string)[];
184
184
  /**
185
185
  * Error message when user attempts to input a disabled date
186
186
  * */
@@ -296,7 +296,7 @@ export type BaseInputTriggerProps = InputProps &
296
296
  export type InputTriggerProps = BaseInputTriggerProps & {
297
297
  value?: Date;
298
298
  onChange?: (date: Date, event: ChangeEvent) => void;
299
- /** Flag to show or hide error state (and tooltip with error message) on Input */
299
+ /** @deprecated Set `disabledErrorText={null}` on the picker Root instead */
300
300
  showError?: boolean;
301
301
  };
302
302
 
@@ -490,6 +490,12 @@ declare const MonthRangePicker: Intergalactic.Component<
490
490
  subtract: (date: number | Date, amount: number, unit: dayjs.OpUnitType) => Date;
491
491
  };
492
492
 
493
+ export type DateRangeComparatorFocusRange = 'value' | 'compare';
494
+ export type DateRangeComparatorValue = {
495
+ value?: DateConstructorParams[];
496
+ compare?: DateConstructorParams[];
497
+ };
498
+
493
499
  export type DateRangeComparatorProps = Intergalactic.InternalTypings.EfficientOmit<
494
500
  DropdownProps,
495
501
  'disabled'
@@ -498,11 +504,11 @@ export type DateRangeComparatorProps = Intergalactic.InternalTypings.EfficientOm
498
504
  /**
499
505
  * Selected date ranges
500
506
  * */
501
- value?: { value?: DateConstructorParams[]; compare?: DateConstructorParams[] };
507
+ value?: DateRangeComparatorValue;
502
508
  /**
503
509
  * Default value for selected date ranges
504
510
  * */
505
- defaultValue?: { value?: DateConstructorParams[]; compare?: DateConstructorParams[] };
511
+ defaultValue?: DateRangeComparatorValue;
506
512
  /**
507
513
  * Default value date for showing the necessary month
508
514
  * */
@@ -521,7 +527,7 @@ export type DateRangeComparatorProps = Intergalactic.InternalTypings.EfficientOm
521
527
  /**
522
528
  * Array of dates blocked for selection
523
529
  * */
524
- disabled?: (Date | (Date | false)[] | string)[];
530
+ disabled?: (DateConstructorParams | (DateConstructorParams | false)[] | string)[];
525
531
  /**
526
532
  * Error message when user attempts to input a disabled date
527
533
  * */
@@ -578,11 +584,11 @@ export type DateRangeComparatorProps = Intergalactic.InternalTypings.EfficientOm
578
584
  /**
579
585
  * Controls which date range is focused.
580
586
  */
581
- focusedRange?: 'value' | 'compare';
587
+ focusedRange?: DateRangeComparatorFocusRange;
582
588
  /**
583
589
  * Called when user focuses or is focused on some of the date ranges.
584
590
  */
585
- onFocusedRangeChange?: (focusedRange: 'value' | 'compare') => void;
591
+ onFocusedRangeChange?: (focusedRange: DateRangeComparatorFocusRange) => void;
586
592
  /**
587
593
  * Remove the 'Reset' button
588
594
  * */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@semcore/date-picker",
3
3
  "description": "Semrush DatePicker Component",
4
- "version": "4.42.0",
4
+ "version": "4.43.0",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/es6/index.js",
7
7
  "typings": "lib/types/index.d.ts",
@@ -9,19 +9,19 @@
9
9
  "author": "UI-kit team <ui-kit-team@semrush.com>",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
- "@semcore/utils": "4.26.1",
13
- "@semcore/base-trigger": "4.35.0",
14
- "@semcore/button": "5.26.0",
15
- "@semcore/divider": "4.24.0",
16
- "@semcore/dropdown": "4.29.0",
17
- "@semcore/flex-box": "5.25.0",
18
- "@semcore/icon": "4.34.0",
19
- "@semcore/input": "4.26.0",
20
- "@semcore/input-mask": "5.27.0",
21
- "@semcore/neighbor-location": "4.23.0",
22
- "@semcore/typography": "5.33.0",
23
- "@semcore/checkbox": "7.28.0",
24
- "@semcore/tooltip": "6.31.0",
12
+ "@semcore/utils": "4.26.2",
13
+ "@semcore/base-trigger": "4.35.1",
14
+ "@semcore/button": "5.26.1",
15
+ "@semcore/divider": "4.24.1",
16
+ "@semcore/dropdown": "4.29.1",
17
+ "@semcore/flex-box": "5.25.1",
18
+ "@semcore/icon": "4.34.1",
19
+ "@semcore/input": "4.26.1",
20
+ "@semcore/input-mask": "5.27.1",
21
+ "@semcore/neighbor-location": "4.23.1",
22
+ "@semcore/typography": "5.33.1",
23
+ "@semcore/checkbox": "7.28.1",
24
+ "@semcore/tooltip": "6.31.1",
25
25
  "dayjs": "1.8.36"
26
26
  },
27
27
  "peerDependencies": {