@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.
- package/CHANGELOG.md +23 -0
- package/lib/cjs/DatePicker.js +2 -2
- package/lib/cjs/DatePicker.js.map +1 -1
- package/lib/cjs/DateRangeComparator.js +17 -9
- package/lib/cjs/DateRangeComparator.js.map +1 -1
- package/lib/cjs/MonthDateRangeComparator.js +21 -14
- package/lib/cjs/MonthDateRangeComparator.js.map +1 -1
- package/lib/cjs/components/Calendar.js +23 -23
- package/lib/cjs/components/Calendar.js.map +1 -1
- package/lib/cjs/components/DateRangeComparatorAbstract.js +57 -40
- package/lib/cjs/components/DateRangeComparatorAbstract.js.map +1 -1
- package/lib/cjs/components/InputTrigger.js +74 -44
- package/lib/cjs/components/InputTrigger.js.map +1 -1
- package/lib/cjs/components/PickerAbstract.js +31 -31
- package/lib/cjs/components/PickerAbstract.js.map +1 -1
- package/lib/cjs/components/RangePickerAbstract.js +31 -31
- package/lib/cjs/components/RangePickerAbstract.js.map +1 -1
- package/lib/cjs/index.d.js.map +1 -1
- package/lib/cjs/utils/datesIntersects.js +30 -0
- package/lib/cjs/utils/datesIntersects.js.map +1 -0
- package/lib/cjs/utils/includesDate.js +3 -3
- package/lib/cjs/utils/includesDate.js.map +1 -1
- package/lib/es6/DatePicker.js +1 -1
- package/lib/es6/DatePicker.js.map +1 -1
- package/lib/es6/DateRangeComparator.js +17 -9
- package/lib/es6/DateRangeComparator.js.map +1 -1
- package/lib/es6/MonthDateRangeComparator.js +21 -14
- package/lib/es6/MonthDateRangeComparator.js.map +1 -1
- package/lib/es6/components/Calendar.js +22 -22
- package/lib/es6/components/Calendar.js.map +1 -1
- package/lib/es6/components/DateRangeComparatorAbstract.js +57 -40
- package/lib/es6/components/DateRangeComparatorAbstract.js.map +1 -1
- package/lib/es6/components/InputTrigger.js +73 -43
- package/lib/es6/components/InputTrigger.js.map +1 -1
- package/lib/es6/components/PickerAbstract.js +30 -30
- package/lib/es6/components/PickerAbstract.js.map +1 -1
- package/lib/es6/components/RangePickerAbstract.js +30 -30
- package/lib/es6/components/RangePickerAbstract.js.map +1 -1
- package/lib/es6/index.d.js.map +1 -1
- package/lib/es6/utils/datesIntersects.js +22 -0
- package/lib/es6/utils/datesIntersects.js.map +1 -0
- package/lib/es6/utils/includesDate.js +2 -2
- package/lib/es6/utils/includesDate.js.map +1 -1
- package/lib/types/index.d.ts +15 -9
- 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
|
|
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
|
|
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"}
|
package/lib/types/index.d.ts
CHANGED
|
@@ -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?: (
|
|
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?: (
|
|
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?: (
|
|
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
|
-
/**
|
|
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?:
|
|
507
|
+
value?: DateRangeComparatorValue;
|
|
502
508
|
/**
|
|
503
509
|
* Default value for selected date ranges
|
|
504
510
|
* */
|
|
505
|
-
defaultValue?:
|
|
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?: (
|
|
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?:
|
|
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:
|
|
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.
|
|
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.
|
|
13
|
-
"@semcore/base-trigger": "4.35.
|
|
14
|
-
"@semcore/button": "5.26.
|
|
15
|
-
"@semcore/divider": "4.24.
|
|
16
|
-
"@semcore/dropdown": "4.29.
|
|
17
|
-
"@semcore/flex-box": "5.25.
|
|
18
|
-
"@semcore/icon": "4.34.
|
|
19
|
-
"@semcore/input": "4.26.
|
|
20
|
-
"@semcore/input-mask": "5.27.
|
|
21
|
-
"@semcore/neighbor-location": "4.23.
|
|
22
|
-
"@semcore/typography": "5.33.
|
|
23
|
-
"@semcore/checkbox": "7.28.
|
|
24
|
-
"@semcore/tooltip": "6.31.
|
|
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": {
|