@kalyx/core 1.0.0-rc.4 → 1.0.0-rc.7
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 +53 -0
- package/dist/index.cjs +15 -2
- package/dist/index.d.cts +21 -2
- package/dist/index.d.ts +21 -2
- package/dist/index.js +14 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,58 @@
|
|
|
1
1
|
# @kalyx/core
|
|
2
2
|
|
|
3
|
+
## 1.0.0-rc.7
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 0eca2e8: Two new `DatePicker.Calendar` / `RangePicker.Calendar` props plus an ISO-week utility:
|
|
8
|
+
- **`showWeekNumber`** — render an ISO 8601 week-number column (1–53) on the left of the grid. The column uses `<th scope="row" aria-hidden="true">` so it doesn't participate in the WAI-ARIA grid data region; keyboard navigation across date cells is unchanged. New className slots: `weekNumberHeader`, `weekNumber`.
|
|
9
|
+
- **`fixedWeeks`** — when true, always render 6 rows (42 cells) regardless of the month. Useful for popover layouts that need a stable height across month navigation.
|
|
10
|
+
|
|
11
|
+
Both also accepted on `CalendarOptions` (the `getCalendarDays` core util gains `fixedWeeks`).
|
|
12
|
+
|
|
13
|
+
New core export: **`getISOWeekNumber(iso)`** — pure UTC computation, no date-fns dep. Anchored to the Thursday of the week (so the same week always returns the same number regardless of `weekStartsOn`).
|
|
14
|
+
|
|
15
|
+
```tsx
|
|
16
|
+
<DatePicker value={date} onChange={setDate}>
|
|
17
|
+
<DatePicker.Input />
|
|
18
|
+
<DatePicker.Popover>
|
|
19
|
+
<DatePicker.Calendar showWeekNumber fixedWeeks />
|
|
20
|
+
</DatePicker.Popover>
|
|
21
|
+
</DatePicker>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Bundle impact: +0.46 KB ESM gzip (13.96 → 14.42 KB). Still well under the 15 KB ceiling.
|
|
25
|
+
|
|
26
|
+
- d62c84e: `DisabledRule` gains a programmatic `filter` variant — pass any predicate `(iso: ISODateString) => boolean` to disable arbitrary days that don't fit the declarative `before` / `after` / `dayOfWeek` / `date` rules.
|
|
27
|
+
|
|
28
|
+
```tsx
|
|
29
|
+
const holidays = new Set(['2026-01-01T00:00:00.000Z', '2026-12-25T00:00:00.000Z']);
|
|
30
|
+
|
|
31
|
+
<DatePicker
|
|
32
|
+
disabled={[
|
|
33
|
+
{ dayOfWeek: [0, 6] }, // weekends
|
|
34
|
+
{ filter: (iso) => holidays.has(iso) }, // holidays
|
|
35
|
+
]}
|
|
36
|
+
>
|
|
37
|
+
…
|
|
38
|
+
</DatePicker>;
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
The new variant slots into the existing `isDateDisabled` evaluation (short-circuits on first match) and works with keyboard-navigation disabled-skip in `DatePicker.Calendar` / `RangePicker.Calendar` with no further changes. Equivalent to `react-datepicker`'s `filterDate` prop and MUI X DatePicker's `shouldDisableDate`. Bundle impact: 0 KB (still 13.96 KB ESM gzip).
|
|
42
|
+
|
|
43
|
+
## 1.0.0-rc.6
|
|
44
|
+
|
|
45
|
+
### Patch Changes
|
|
46
|
+
|
|
47
|
+
- abc56ac: Security: pin transitive `fast-uri` to `>=3.1.2` and `@babel/plugin-transform-modules-systemjs` to `>=7.29.4` via `pnpm.overrides`.
|
|
48
|
+
|
|
49
|
+
Resolves three Code Scanning alerts on `pnpm-lock.yaml`:
|
|
50
|
+
- `fast-uri@3.1.0` — [GHSA-v39h-62p7-jpjc](https://osv.dev/GHSA-v39h-62p7-jpjc) (CVE-2026-6322), first patched in `3.1.2`.
|
|
51
|
+
- `fast-uri@3.1.0` — [GHSA-q3j6-qgpj-74h6](https://osv.dev/GHSA-q3j6-qgpj-74h6) (CVE-2026-6321), first patched in `3.1.1`.
|
|
52
|
+
- `@babel/plugin-transform-modules-systemjs@7.29.0` — [GHSA-fv7c-fp4j-7gwp](https://osv.dev/GHSA-fv7c-fp4j-7gwp) (CVE-2026-44728), first patched in `7.29.4` on the 7.x line.
|
|
53
|
+
|
|
54
|
+
All three packages are transitive build-time dependencies (ajv → fast-uri, Babel preset-env → systemjs plugin); no public API impact.
|
|
55
|
+
|
|
3
56
|
## 1.0.0-rc.4
|
|
4
57
|
|
|
5
58
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -34,6 +34,7 @@ __export(index_exports, {
|
|
|
34
34
|
generateHours: () => generateHours,
|
|
35
35
|
generateMinutes: () => generateMinutes,
|
|
36
36
|
getCalendarDays: () => getCalendarDays,
|
|
37
|
+
getISOWeekNumber: () => getISOWeekNumber,
|
|
37
38
|
getMonthName: () => getMonthName,
|
|
38
39
|
getTime: () => getTime,
|
|
39
40
|
getTimeInTimezone: () => getTimeInTimezone,
|
|
@@ -309,7 +310,8 @@ function getCalendarDays(monthISO, adapter, options = {}) {
|
|
|
309
310
|
disabled = [],
|
|
310
311
|
range,
|
|
311
312
|
rangeHover,
|
|
312
|
-
timezone
|
|
313
|
+
timezone,
|
|
314
|
+
fixedWeeks = false
|
|
313
315
|
} = options;
|
|
314
316
|
const todayISO = today ?? adapter.today(timezone);
|
|
315
317
|
const monthStart = adapter.startOfMonth(monthISO);
|
|
@@ -339,12 +341,20 @@ function getCalendarDays(monthISO, adapter, options = {}) {
|
|
|
339
341
|
current = adapter.addDays(current, 1);
|
|
340
342
|
}
|
|
341
343
|
weeks.push(days);
|
|
342
|
-
if (!adapter.isSameMonth(current, monthISO) && week >= 3) {
|
|
344
|
+
if (!fixedWeeks && !adapter.isSameMonth(current, monthISO) && week >= 3) {
|
|
343
345
|
break;
|
|
344
346
|
}
|
|
345
347
|
}
|
|
346
348
|
return weeks;
|
|
347
349
|
}
|
|
350
|
+
function getISOWeekNumber(iso) {
|
|
351
|
+
const d = new Date(iso);
|
|
352
|
+
const utc = new Date(Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate()));
|
|
353
|
+
const isoDay = utc.getUTCDay() || 7;
|
|
354
|
+
utc.setUTCDate(utc.getUTCDate() + 4 - isoDay);
|
|
355
|
+
const yearStart = new Date(Date.UTC(utc.getUTCFullYear(), 0, 1));
|
|
356
|
+
return Math.ceil(((utc.getTime() - yearStart.getTime()) / 864e5 + 1) / 7);
|
|
357
|
+
}
|
|
348
358
|
function normalizeRangeForDisplay(range, hover, adapter, _timezone) {
|
|
349
359
|
if (!range) return { start: null, end: null };
|
|
350
360
|
const { start, end } = range;
|
|
@@ -388,6 +398,8 @@ function isDateDisabled(iso, rules, adapter) {
|
|
|
388
398
|
if (adapter.isAfter(iso, rule.after)) return true;
|
|
389
399
|
} else if ("dayOfWeek" in rule) {
|
|
390
400
|
if (rule.dayOfWeek.includes(adapter.getDay(iso))) return true;
|
|
401
|
+
} else if ("filter" in rule) {
|
|
402
|
+
if (rule.filter(iso)) return true;
|
|
391
403
|
}
|
|
392
404
|
}
|
|
393
405
|
return false;
|
|
@@ -609,6 +621,7 @@ var DEFAULT_DATETIMEPICKER_LABELS = {
|
|
|
609
621
|
generateHours,
|
|
610
622
|
generateMinutes,
|
|
611
623
|
getCalendarDays,
|
|
624
|
+
getISOWeekNumber,
|
|
612
625
|
getMonthName,
|
|
613
626
|
getTime,
|
|
614
627
|
getTimeInTimezone,
|
package/dist/index.d.cts
CHANGED
|
@@ -15,7 +15,8 @@ type ISODateString = string;
|
|
|
15
15
|
* { before: '2026-01-01T00:00:00.000Z' }, // disable before Jan 1
|
|
16
16
|
* { after: '2026-12-31T00:00:00.000Z' }, // disable after Dec 31
|
|
17
17
|
* { date: '2026-06-15T00:00:00.000Z' }, // disable a specific date
|
|
18
|
-
* { dayOfWeek: [0, 6] },
|
|
18
|
+
* { dayOfWeek: [0, 6] }, // disable weekends
|
|
19
|
+
* { filter: (iso) => holidays.has(iso) }, // programmatic filter
|
|
19
20
|
* ];
|
|
20
21
|
* ```
|
|
21
22
|
*/
|
|
@@ -27,6 +28,8 @@ type DisabledRule = {
|
|
|
27
28
|
after: ISODateString;
|
|
28
29
|
} | {
|
|
29
30
|
dayOfWeek: number[];
|
|
31
|
+
} | {
|
|
32
|
+
filter: (iso: ISODateString) => boolean;
|
|
30
33
|
};
|
|
31
34
|
/** Date range (RangePicker) */
|
|
32
35
|
interface DateRange {
|
|
@@ -108,6 +111,12 @@ interface CalendarOptions {
|
|
|
108
111
|
* midnight form while the grid iterates in UTC.
|
|
109
112
|
*/
|
|
110
113
|
timezone?: string;
|
|
114
|
+
/**
|
|
115
|
+
* Always emit exactly six weeks (42 days). The default (`false`) emits 4–6 weeks
|
|
116
|
+
* depending on the month, breaking after the last week containing a current-month day.
|
|
117
|
+
* Setting `true` is useful for layouts that need a fixed-height grid.
|
|
118
|
+
*/
|
|
119
|
+
fixedWeeks?: boolean;
|
|
111
120
|
}
|
|
112
121
|
|
|
113
122
|
/**
|
|
@@ -146,6 +155,16 @@ declare const DateFnsAdapter: DateAdapter;
|
|
|
146
155
|
* ```
|
|
147
156
|
*/
|
|
148
157
|
declare function getCalendarDays(monthISO: string, adapter: DateAdapter, options?: CalendarOptions): CalendarGrid;
|
|
158
|
+
/**
|
|
159
|
+
* Returns the ISO 8601 week number (1-53) of the given date. ISO weeks start on Monday;
|
|
160
|
+
* week 1 is the week containing the year's first Thursday. The computation works in UTC
|
|
161
|
+
* to match the calendar grid's iteration semantics.
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* getISOWeekNumber('2026-01-01T00:00:00.000Z'); // 1 (Jan 1 2026 is a Thursday → ISO week 1)
|
|
165
|
+
* getISOWeekNumber('2026-12-31T00:00:00.000Z'); // 53
|
|
166
|
+
*/
|
|
167
|
+
declare function getISOWeekNumber(iso: ISODateString): number;
|
|
149
168
|
/**
|
|
150
169
|
* Checks whether the given date matches any disable rule.
|
|
151
170
|
*/
|
|
@@ -397,4 +416,4 @@ declare const DEFAULT_RANGEPICKER_LABELS: RangePickerLabels;
|
|
|
397
416
|
declare const DEFAULT_TIMEPICKER_LABELS: TimePickerLabels;
|
|
398
417
|
declare const DEFAULT_DATETIMEPICKER_LABELS: DateTimePickerLabels;
|
|
399
418
|
|
|
400
|
-
export { type CalendarDay, type CalendarGrid, type CalendarOptions, type CalendarWeek, DEFAULT_DATEPICKER_LABELS, DEFAULT_DATETIMEPICKER_LABELS, DEFAULT_RANGEPICKER_LABELS, DEFAULT_TIMEPICKER_LABELS, type DateAdapter, DateFnsAdapter, type DatePickerLabels, type DateRange, type DateTimePickerLabels, type DisabledRule, type ISODateString, type RangePickerLabels, type TimePickerLabels, type TimeValue, type WeekStartsOn, type WeekdayInfo, civilMidnightFromUtcDay, formatFullDate, formatInTimezone, formatMonthYear, formatTimeFromISO, formatTimeString, generateHours, generateMinutes, getCalendarDays, getMonthName, getTime, getTimeInTimezone, getTimezoneOffsetMinutes, getWeekdayNames, isDateDisabled, isSameDayInTimezone, isSameTime, maxDate, minDate, normalizeISO, parseInputValue, parseTimeString, setTime, setTimeInTimezone, startOfDayInTimezone, to12Hour, to24Hour, todayInTimezone };
|
|
419
|
+
export { type CalendarDay, type CalendarGrid, type CalendarOptions, type CalendarWeek, DEFAULT_DATEPICKER_LABELS, DEFAULT_DATETIMEPICKER_LABELS, DEFAULT_RANGEPICKER_LABELS, DEFAULT_TIMEPICKER_LABELS, type DateAdapter, DateFnsAdapter, type DatePickerLabels, type DateRange, type DateTimePickerLabels, type DisabledRule, type ISODateString, type RangePickerLabels, type TimePickerLabels, type TimeValue, type WeekStartsOn, type WeekdayInfo, civilMidnightFromUtcDay, formatFullDate, formatInTimezone, formatMonthYear, formatTimeFromISO, formatTimeString, generateHours, generateMinutes, getCalendarDays, getISOWeekNumber, getMonthName, getTime, getTimeInTimezone, getTimezoneOffsetMinutes, getWeekdayNames, isDateDisabled, isSameDayInTimezone, isSameTime, maxDate, minDate, normalizeISO, parseInputValue, parseTimeString, setTime, setTimeInTimezone, startOfDayInTimezone, to12Hour, to24Hour, todayInTimezone };
|
package/dist/index.d.ts
CHANGED
|
@@ -15,7 +15,8 @@ type ISODateString = string;
|
|
|
15
15
|
* { before: '2026-01-01T00:00:00.000Z' }, // disable before Jan 1
|
|
16
16
|
* { after: '2026-12-31T00:00:00.000Z' }, // disable after Dec 31
|
|
17
17
|
* { date: '2026-06-15T00:00:00.000Z' }, // disable a specific date
|
|
18
|
-
* { dayOfWeek: [0, 6] },
|
|
18
|
+
* { dayOfWeek: [0, 6] }, // disable weekends
|
|
19
|
+
* { filter: (iso) => holidays.has(iso) }, // programmatic filter
|
|
19
20
|
* ];
|
|
20
21
|
* ```
|
|
21
22
|
*/
|
|
@@ -27,6 +28,8 @@ type DisabledRule = {
|
|
|
27
28
|
after: ISODateString;
|
|
28
29
|
} | {
|
|
29
30
|
dayOfWeek: number[];
|
|
31
|
+
} | {
|
|
32
|
+
filter: (iso: ISODateString) => boolean;
|
|
30
33
|
};
|
|
31
34
|
/** Date range (RangePicker) */
|
|
32
35
|
interface DateRange {
|
|
@@ -108,6 +111,12 @@ interface CalendarOptions {
|
|
|
108
111
|
* midnight form while the grid iterates in UTC.
|
|
109
112
|
*/
|
|
110
113
|
timezone?: string;
|
|
114
|
+
/**
|
|
115
|
+
* Always emit exactly six weeks (42 days). The default (`false`) emits 4–6 weeks
|
|
116
|
+
* depending on the month, breaking after the last week containing a current-month day.
|
|
117
|
+
* Setting `true` is useful for layouts that need a fixed-height grid.
|
|
118
|
+
*/
|
|
119
|
+
fixedWeeks?: boolean;
|
|
111
120
|
}
|
|
112
121
|
|
|
113
122
|
/**
|
|
@@ -146,6 +155,16 @@ declare const DateFnsAdapter: DateAdapter;
|
|
|
146
155
|
* ```
|
|
147
156
|
*/
|
|
148
157
|
declare function getCalendarDays(monthISO: string, adapter: DateAdapter, options?: CalendarOptions): CalendarGrid;
|
|
158
|
+
/**
|
|
159
|
+
* Returns the ISO 8601 week number (1-53) of the given date. ISO weeks start on Monday;
|
|
160
|
+
* week 1 is the week containing the year's first Thursday. The computation works in UTC
|
|
161
|
+
* to match the calendar grid's iteration semantics.
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* getISOWeekNumber('2026-01-01T00:00:00.000Z'); // 1 (Jan 1 2026 is a Thursday → ISO week 1)
|
|
165
|
+
* getISOWeekNumber('2026-12-31T00:00:00.000Z'); // 53
|
|
166
|
+
*/
|
|
167
|
+
declare function getISOWeekNumber(iso: ISODateString): number;
|
|
149
168
|
/**
|
|
150
169
|
* Checks whether the given date matches any disable rule.
|
|
151
170
|
*/
|
|
@@ -397,4 +416,4 @@ declare const DEFAULT_RANGEPICKER_LABELS: RangePickerLabels;
|
|
|
397
416
|
declare const DEFAULT_TIMEPICKER_LABELS: TimePickerLabels;
|
|
398
417
|
declare const DEFAULT_DATETIMEPICKER_LABELS: DateTimePickerLabels;
|
|
399
418
|
|
|
400
|
-
export { type CalendarDay, type CalendarGrid, type CalendarOptions, type CalendarWeek, DEFAULT_DATEPICKER_LABELS, DEFAULT_DATETIMEPICKER_LABELS, DEFAULT_RANGEPICKER_LABELS, DEFAULT_TIMEPICKER_LABELS, type DateAdapter, DateFnsAdapter, type DatePickerLabels, type DateRange, type DateTimePickerLabels, type DisabledRule, type ISODateString, type RangePickerLabels, type TimePickerLabels, type TimeValue, type WeekStartsOn, type WeekdayInfo, civilMidnightFromUtcDay, formatFullDate, formatInTimezone, formatMonthYear, formatTimeFromISO, formatTimeString, generateHours, generateMinutes, getCalendarDays, getMonthName, getTime, getTimeInTimezone, getTimezoneOffsetMinutes, getWeekdayNames, isDateDisabled, isSameDayInTimezone, isSameTime, maxDate, minDate, normalizeISO, parseInputValue, parseTimeString, setTime, setTimeInTimezone, startOfDayInTimezone, to12Hour, to24Hour, todayInTimezone };
|
|
419
|
+
export { type CalendarDay, type CalendarGrid, type CalendarOptions, type CalendarWeek, DEFAULT_DATEPICKER_LABELS, DEFAULT_DATETIMEPICKER_LABELS, DEFAULT_RANGEPICKER_LABELS, DEFAULT_TIMEPICKER_LABELS, type DateAdapter, DateFnsAdapter, type DatePickerLabels, type DateRange, type DateTimePickerLabels, type DisabledRule, type ISODateString, type RangePickerLabels, type TimePickerLabels, type TimeValue, type WeekStartsOn, type WeekdayInfo, civilMidnightFromUtcDay, formatFullDate, formatInTimezone, formatMonthYear, formatTimeFromISO, formatTimeString, generateHours, generateMinutes, getCalendarDays, getISOWeekNumber, getMonthName, getTime, getTimeInTimezone, getTimezoneOffsetMinutes, getWeekdayNames, isDateDisabled, isSameDayInTimezone, isSameTime, maxDate, minDate, normalizeISO, parseInputValue, parseTimeString, setTime, setTimeInTimezone, startOfDayInTimezone, to12Hour, to24Hour, todayInTimezone };
|
package/dist/index.js
CHANGED
|
@@ -259,7 +259,8 @@ function getCalendarDays(monthISO, adapter, options = {}) {
|
|
|
259
259
|
disabled = [],
|
|
260
260
|
range,
|
|
261
261
|
rangeHover,
|
|
262
|
-
timezone
|
|
262
|
+
timezone,
|
|
263
|
+
fixedWeeks = false
|
|
263
264
|
} = options;
|
|
264
265
|
const todayISO = today ?? adapter.today(timezone);
|
|
265
266
|
const monthStart = adapter.startOfMonth(monthISO);
|
|
@@ -289,12 +290,20 @@ function getCalendarDays(monthISO, adapter, options = {}) {
|
|
|
289
290
|
current = adapter.addDays(current, 1);
|
|
290
291
|
}
|
|
291
292
|
weeks.push(days);
|
|
292
|
-
if (!adapter.isSameMonth(current, monthISO) && week >= 3) {
|
|
293
|
+
if (!fixedWeeks && !adapter.isSameMonth(current, monthISO) && week >= 3) {
|
|
293
294
|
break;
|
|
294
295
|
}
|
|
295
296
|
}
|
|
296
297
|
return weeks;
|
|
297
298
|
}
|
|
299
|
+
function getISOWeekNumber(iso) {
|
|
300
|
+
const d = new Date(iso);
|
|
301
|
+
const utc = new Date(Date.UTC(d.getUTCFullYear(), d.getUTCMonth(), d.getUTCDate()));
|
|
302
|
+
const isoDay = utc.getUTCDay() || 7;
|
|
303
|
+
utc.setUTCDate(utc.getUTCDate() + 4 - isoDay);
|
|
304
|
+
const yearStart = new Date(Date.UTC(utc.getUTCFullYear(), 0, 1));
|
|
305
|
+
return Math.ceil(((utc.getTime() - yearStart.getTime()) / 864e5 + 1) / 7);
|
|
306
|
+
}
|
|
298
307
|
function normalizeRangeForDisplay(range, hover, adapter, _timezone) {
|
|
299
308
|
if (!range) return { start: null, end: null };
|
|
300
309
|
const { start, end } = range;
|
|
@@ -338,6 +347,8 @@ function isDateDisabled(iso, rules, adapter) {
|
|
|
338
347
|
if (adapter.isAfter(iso, rule.after)) return true;
|
|
339
348
|
} else if ("dayOfWeek" in rule) {
|
|
340
349
|
if (rule.dayOfWeek.includes(adapter.getDay(iso))) return true;
|
|
350
|
+
} else if ("filter" in rule) {
|
|
351
|
+
if (rule.filter(iso)) return true;
|
|
341
352
|
}
|
|
342
353
|
}
|
|
343
354
|
return false;
|
|
@@ -558,6 +569,7 @@ export {
|
|
|
558
569
|
generateHours,
|
|
559
570
|
generateMinutes,
|
|
560
571
|
getCalendarDays,
|
|
572
|
+
getISOWeekNumber,
|
|
561
573
|
getMonthName,
|
|
562
574
|
getTime,
|
|
563
575
|
getTimeInTimezone,
|
package/package.json
CHANGED