🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

@react-stately/calendar

Package Overview
Dependencies
Maintainers
0
Versions
807
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@react-stately/calendar - npm Package Compare versions

Comparing version

to
3.0.0-nightly-74cac946a-250315

9

dist/useCalendarState.main.js

@@ -35,3 +35,3 @@ var $4301262d71f567b9$exports = require("./utils.main.js");

months: 1
}, minValue: minValue, maxValue: maxValue, selectionAlignment: selectionAlignment, isDateUnavailable: isDateUnavailable, pageBehavior: pageBehavior = 'visible' } = props;
}, minValue: minValue, maxValue: maxValue, selectionAlignment: selectionAlignment, isDateUnavailable: isDateUnavailable, pageBehavior: pageBehavior = 'visible', firstDayOfWeek: firstDayOfWeek } = props;
let calendar = (0, $cpRwL$react.useMemo)(()=>createCalendar(resolvedOptions.calendar), [

@@ -232,3 +232,3 @@ createCalendar,

selectFocusedDate () {
setValue(focusedDate);
if (!(isDateUnavailable && isDateUnavailable(focusedDate))) setValue(focusedDate);
},

@@ -270,3 +270,2 @@ selectDate (date) {

getDatesInWeek (weekIndex, from = startDate) {
// let date = startOfWeek(from, locale);
let date = from.add({

@@ -276,6 +275,6 @@ weeks: weekIndex

let dates = [];
date = (0, $cpRwL$internationalizeddate.startOfWeek)(date, locale);
date = (0, $cpRwL$internationalizeddate.startOfWeek)(date, locale, firstDayOfWeek);
// startOfWeek will clamp dates within the calendar system's valid range, which may
// start in the middle of a week. In this case, add null placeholders.
let dayOfWeek = (0, $cpRwL$internationalizeddate.getDayOfWeek)(date, locale);
let dayOfWeek = (0, $cpRwL$internationalizeddate.getDayOfWeek)(date, locale, firstDayOfWeek);
for(let i = 0; i < dayOfWeek; i++)dates.push(null);

@@ -282,0 +281,0 @@ while(dates.length < 7){

@@ -29,3 +29,3 @@ import {alignCenter as $f62d864046160412$export$f4a51ff076cc9a09, alignEnd as $f62d864046160412$export$530edbfc915b2b04, alignStart as $f62d864046160412$export$144a00ba6044eb9, constrainStart as $f62d864046160412$export$5bb865b12696a77d, constrainValue as $f62d864046160412$export$4f5203c0d889109e, isInvalid as $f62d864046160412$export$eac50920cf2fd59a, previousAvailableDate as $f62d864046160412$export$a1d3911297b952d7} from "./utils.module.js";

months: 1
}, minValue: minValue, maxValue: maxValue, selectionAlignment: selectionAlignment, isDateUnavailable: isDateUnavailable, pageBehavior: pageBehavior = 'visible' } = props;
}, minValue: minValue, maxValue: maxValue, selectionAlignment: selectionAlignment, isDateUnavailable: isDateUnavailable, pageBehavior: pageBehavior = 'visible', firstDayOfWeek: firstDayOfWeek } = props;
let calendar = (0, $7G4ZY$useMemo)(()=>createCalendar(resolvedOptions.calendar), [

@@ -226,3 +226,3 @@ createCalendar,

selectFocusedDate () {
setValue(focusedDate);
if (!(isDateUnavailable && isDateUnavailable(focusedDate))) setValue(focusedDate);
},

@@ -264,3 +264,2 @@ selectDate (date) {

getDatesInWeek (weekIndex, from = startDate) {
// let date = startOfWeek(from, locale);
let date = from.add({

@@ -270,6 +269,6 @@ weeks: weekIndex

let dates = [];
date = (0, $7G4ZY$startOfWeek)(date, locale);
date = (0, $7G4ZY$startOfWeek)(date, locale, firstDayOfWeek);
// startOfWeek will clamp dates within the calendar system's valid range, which may
// start in the middle of a week. In this case, add null placeholders.
let dayOfWeek = (0, $7G4ZY$getDayOfWeek)(date, locale);
let dayOfWeek = (0, $7G4ZY$getDayOfWeek)(date, locale, firstDayOfWeek);
for(let i = 0; i < dayOfWeek; i++)dates.push(null);

@@ -276,0 +275,0 @@ while(dates.length < 7){

{
"name": "@react-stately/calendar",
"version": "3.0.0-nightly-73414999f-240916",
"version": "3.0.0-nightly-74cac946a-250315",
"description": "Spectrum UI components in React",

@@ -25,15 +25,14 @@ "license": "Apache-2.0",

"dependencies": {
"@internationalized/date": "^3.0.0-nightly-73414999f-240916",
"@react-stately/utils": "^3.0.0-nightly-73414999f-240916",
"@react-types/calendar": "^3.0.0-nightly-73414999f-240916",
"@react-types/shared": "^3.0.0-nightly-73414999f-240916",
"@internationalized/date": "3.0.0-nightly-74cac946a-250315",
"@react-stately/utils": "3.0.0-nightly-74cac946a-250315",
"@react-types/calendar": "3.0.0-nightly-74cac946a-250315",
"@react-types/shared": "3.0.0-nightly-74cac946a-250315",
"@swc/helpers": "^0.5.0"
},
"peerDependencies": {
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
},
"publishConfig": {
"access": "public"
},
"stableVersion": "3.5.4"
}
}

@@ -69,3 +69,4 @@ /*

isDateUnavailable,
pageBehavior = 'visible'
pageBehavior = 'visible',
firstDayOfWeek
} = props;

@@ -295,3 +296,5 @@ let calendar = useMemo(() => createCalendar(resolvedOptions.calendar), [createCalendar, resolvedOptions.calendar]);

selectFocusedDate() {
setValue(focusedDate);
if (!(isDateUnavailable && isDateUnavailable(focusedDate))) {
setValue(focusedDate);
}
},

@@ -329,11 +332,10 @@ selectDate(date) {

getDatesInWeek(weekIndex, from = startDate) {
// let date = startOfWeek(from, locale);
let date = from.add({weeks: weekIndex});
let dates: (CalendarDate | null)[] = [];
date = startOfWeek(date, locale);
date = startOfWeek(date, locale, firstDayOfWeek);
// startOfWeek will clamp dates within the calendar system's valid range, which may
// start in the middle of a week. In this case, add null placeholders.
let dayOfWeek = getDayOfWeek(date, locale);
let dayOfWeek = getDayOfWeek(date, locale, firstDayOfWeek);
for (let i = 0; i < dayOfWeek; i++) {

@@ -340,0 +342,0 @@ dates.push(null);

@@ -16,3 +16,3 @@ /*

import {CalendarState, RangeCalendarState} from './types';
import {DateValue, RangeCalendarProps} from '@react-types/calendar';
import {DateValue, MappedDateValue, RangeCalendarProps} from '@react-types/calendar';
import {RangeValue, ValidationState} from '@react-types/shared';

@@ -46,3 +46,3 @@ import {useCalendarState} from './useCalendarState';

let {value: valueProp, defaultValue, onChange, createCalendar, locale, visibleDuration = {months: 1}, minValue, maxValue, ...calendarProps} = props;
let [value, setValue] = useControlledState<RangeValue<T> | null, RangeValue<T>>(
let [value, setValue] = useControlledState<RangeValue<T> | null, RangeValue<MappedDateValue<T>>>(
valueProp!,

@@ -49,0 +49,0 @@ defaultValue || null!,

@@ -24,3 +24,3 @@ /*

export function isInvalid(date: DateValue, minValue?: DateValue | null, maxValue?: DateValue | null) {
export function isInvalid(date: DateValue, minValue?: DateValue | null, maxValue?: DateValue | null): boolean {
return (minValue != null && date.compare(minValue) < 0) ||

@@ -30,3 +30,3 @@ (maxValue != null && date.compare(maxValue) > 0);

export function alignCenter(date: CalendarDate, duration: DateDuration, locale: string, minValue?: DateValue | null, maxValue?: DateValue | null) {
export function alignCenter(date: CalendarDate, duration: DateDuration, locale: string, minValue?: DateValue | null, maxValue?: DateValue | null): CalendarDate {
let halfDuration: DateDuration = {};

@@ -44,3 +44,3 @@ for (let key in duration) {

export function alignStart(date: CalendarDate, duration: DateDuration, locale: string, minValue?: DateValue | null, maxValue?: DateValue | null) {
export function alignStart(date: CalendarDate, duration: DateDuration, locale: string, minValue?: DateValue | null, maxValue?: DateValue | null): CalendarDate {
// align to the start of the largest unit

@@ -59,3 +59,3 @@ let aligned = date;

export function alignEnd(date: CalendarDate, duration: DateDuration, locale: string, minValue?: DateValue | null, maxValue?: DateValue | null) {
export function alignEnd(date: CalendarDate, duration: DateDuration, locale: string, minValue?: DateValue | null, maxValue?: DateValue | null): CalendarDate {
let d = {...duration};

@@ -83,3 +83,3 @@ // subtract 1 from the smallest unit

minValue?: DateValue | null,
maxValue?: DateValue | null) {
maxValue?: DateValue | null): CalendarDate {
if (minValue && date.compare(minValue) >= 0) {

@@ -108,3 +108,3 @@ let newDate = maxDate(

export function constrainValue(date: CalendarDate, minValue?: DateValue | null, maxValue?: DateValue | null) {
export function constrainValue(date: CalendarDate, minValue?: DateValue | null, maxValue?: DateValue | null): CalendarDate {
if (minValue) {

@@ -111,0 +111,0 @@ let newDate = maxDate(date, toCalendarDate(minValue));

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet