-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(docs): types in date-related doc pages #3393
base: canary
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
WalkthroughRecent updates to the documentation and codebase include enhancing type definitions related to date and time handling, refining data structures, and adjusting method parameters. These changes largely focus on standardizing how dates and times are represented across components and improving the handling of component properties in the Changes
Sequence Diagram(s)(For this set of changes, generating sequence diagrams isn't necessary, as the changes are primarily related to type definitions, handler parameter updates, and minor refactoring.) Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (1)
- apps/docs/content/docs/components/range-calendar.mdx (1 hunks)
Additional comments not posted (1)
apps/docs/content/docs/components/range-calendar.mdx (1)
239-239
: Correct theonChange
handler type.The
onChange
handler type has been correctly updated toRangeValue<MappedDateValue<DateValue>>
. This change ensures that the handler processes and handles value changes appropriately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (6)
- apps/docs/content/docs/components/calendar.mdx (2 hunks)
- apps/docs/content/docs/components/date-input.mdx (1 hunks)
- apps/docs/content/docs/components/date-picker.mdx (1 hunks)
- apps/docs/content/docs/components/date-range-picker.mdx (1 hunks)
- apps/docs/content/docs/components/range-calendar.mdx (2 hunks)
- packages/components/image/src/use-image.ts (3 hunks)
Files skipped from review as they are similar to previous changes (1)
- apps/docs/content/docs/components/range-calendar.mdx
Additional comments not posted (18)
packages/components/image/src/use-image.ts (2)
124-137
: Consolidate width and height calculations.The changes to consolidate width and height calculations into a single
useMemo
block are efficient and improve code readability.However, ensure that
props
is correctly used and passed in the context.Verification successful
Verified: Correct usage of
props
inuseImage
function.The
props
object is correctly used and passed within theuseImage
function. The consolidation of width and height calculations into a singleuseMemo
block is efficient and improves code readability.
props
is mapped fromoriginalProps
and used consistently within the function.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `props` in the `useImage` function. # Test: Search for the usage of `props` within the `useImage` function. Expect: Correct usage and passing of `props`. rg --type js --pcre2 "props" packages/components/image/src/use-image.tsLength of output: 579
170-170
: Conditional application of height.The logic for applying height conditionally based on
otherProps
is correct.Ensure that
otherProps
is properly populated in the context.apps/docs/content/docs/components/date-input.mdx (3)
330-330
: UpdateonChange
handler type.The update to the
onChange
handler type aligns with the new date and time types.Ensure the new type
MappedDateValue
is correctly used and documented.
361-364
: IntroduceMappedDateValue
type.The
MappedDateValue
type mapsDateValue
to specific date and time types correctly.Ensure that the mapping logic is accurate.
369-372
: IntroduceDateValue
,CalendarDate
,CalendarDateTime
, andZonedDateTime
types.The types represent different date and time formats correctly.
Ensure that the constructors and methods are accurately documented and implemented.
Also applies to: 379-419, 426-474, 481-535
Verification successful
Introduce
DateValue
,CalendarDate
,CalendarDateTime
, andZonedDateTime
types.The types represent different date and time formats correctly. The documentation and implementation for these types, including their constructors and methods, are accurately documented across various locations in the codebase.
- Verified in:
apps/docs/content/components/date-range-picker/international-calendar.ts
apps/docs/content/components/date-range-picker/with-time-field.ts
apps/docs/content/components/date-range-picker/time-zones.ts
apps/docs/content/components/time-input/controlled.ts
apps/docs/content/components/time-input/timezones.ts
apps/docs/content/components/time-input/hour-cycle.ts
apps/docs/content/components/date-range-picker/presets.ts
apps/docs/content/components/time-input/hide-timezone.ts
apps/docs/content/components/date-range-picker/granularity.ts
apps/docs/content/components/range-calendar/controlled.ts
apps/docs/content/components/range-calendar/presets.ts
apps/docs/content/components/range-calendar/invalid-date.ts
apps/docs/content/components/range-calendar/index.ts
apps/docs/content/components/date-range-picker/controlled.ts
apps/docs/content/components/date-picker/controlled.ts
apps/docs/content/components/date-input/controlled.ts
apps/docs/content/components/date-input/disabled.ts
apps/docs/content/components/date-input/hide-timezone.ts
apps/docs/content/components/date-picker/preset.ts
apps/docs/content/components/date-picker/time-zones.ts
apps/docs/content/components/date-input/error-message-function.ts
apps/docs/content/components/date-input/usage.ts
apps/docs/content/components/date-input/hourly-cycle.ts
apps/docs/content/components/date-input/time-zones.ts
apps/docs/content/components/date-input/international-calendar.ts
apps/docs/content/components/date-input/variants.ts
apps/docs/content/components/date-input/readonly.ts
apps/docs/content/components/date-input/label-placements.ts
apps/docs/content/components/date-input/granularity.ts
apps/docs/content/components/date-input/error-message.ts
apps/docs/content/components/date-picker/granularity.ts
apps/docs/content/components/date-input/start-end-content.ts
apps/docs/content/components/date-picker/international-calendar.ts
apps/docs/content/components/date-input/required.ts
apps/docs/content/components/date-input/description.ts
apps/docs/content/components/calendar/presets.ts
apps/docs/content/components/calendar/invalid-date.ts
apps/docs/content/components/calendar/index.ts
apps/docs/content/components/calendar/controlled.ts
apps/docs/content/components/calendar/controlled-focused-value.ts
apps/docs/content/docs/components/time-input.mdx
apps/docs/content/docs/components/date-range-picker.mdx
apps/docs/content/docs/components/date-picker.mdx
apps/docs/content/docs/components/range-calendar.mdx
apps/docs/content/docs/components/calendar.mdx
apps/docs/content/docs/api-references/nextui-provider.mdx
apps/docs/content/blog/v2.3.0.mdx
apps/docs/config/search-meta.json
packages/components/calendar/src/index.ts
packages/components/calendar/stories/calendar.stories.tsx
packages/components/calendar/src/utils.ts
packages/components/calendar/src/use-range-calendar.ts
packages/components/calendar/stories/range-calendar.stories.tsx
packages/components/calendar/src/use-calendar.ts
packages/components/calendar/src/range-calendar.tsx
packages/components/calendar/src/calendar.tsx
packages/components/calendar/src/use-calendar-base.ts
packages/components/calendar/src/use-calendar-picker.ts
packages/components/calendar/src/calendar-month.tsx
packages/components/calendar/src/calendar-header.tsx
packages/components/calendar/src/calendar-cell.tsx
packages/components/calendar/__tests__/calendar.test.tsx
packages/components/calendar/__tests__/range-calendar.test.tsx
packages/components/date-picker/__tests__/date-picker.test.tsx
packages/components/date-input/src/use-date-input.ts
packages/components/date-input/stories/time-input.stories.tsx
packages/components/date-input/src/date-input.tsx
packages/components/date-input/stories/date-input.stories.tsx
packages/components/date-input/src/index.ts
packages/components/date-input/__tests__/time-input.test.tsx
packages/components/date-input/__tests__/date-input.test.tsx
packages/components/date-picker/src/use-date-picker-base.ts
packages/components/date-picker/stories/date-picker.stories.tsx
packages/components/date-picker/src/date-range-picker.tsx
packages/components/date-picker/src/date-range-picker-field.tsx
packages/components/date-picker/src/date-picker.tsx
packages/components/date-picker/src/use-date-range-picker.ts
packages/components/date-picker/src/use-date-picker.ts
packages/components/date-picker/stories/date-range-picker.stories.tsx
packages/core/system/src/provider-context.ts
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the documentation and implementation of constructors and methods in `DateValue`, `CalendarDate`, `CalendarDateTime`, and `ZonedDateTime`. # Test: Search for the documentation and implementation of constructors and methods. Expect: Accurate documentation and implementation. rg --type ts --pcre2 "(DateValue|CalendarDate|CalendarDateTime|ZonedDateTime)" apps/docs/content/docs/componentsLength of output: 114
Script:
#!/bin/bash # Description: Verify the documentation and implementation of constructors and methods in `DateValue`, `CalendarDate`, `CalendarDateTime`, and `ZonedDateTime`. # Test: Search for the documentation and implementation of constructors and methods. Expect: Accurate documentation and implementation. rg --pcre2 "(DateValue|CalendarDate|CalendarDateTime|ZonedDateTime)"Length of output: 92664
apps/docs/content/docs/components/calendar.mdx (3)
274-277
: IntroduceDateValue
,CalendarDate
,CalendarDateTime
, andZonedDateTime
types.The types represent different date and time formats correctly.
Ensure that the constructors and methods are accurately documented and implemented.
Also applies to: 284-324, 331-379, 386-440
Verification successful
Introduce
DateValue
,CalendarDate
,CalendarDateTime
, andZonedDateTime
types.The types represent different date and time formats correctly. The documentation and implementation of their constructors and methods are accurately provided in the codebase.
DateValue
,CalendarDate
,CalendarDateTime
, andZonedDateTime
are well-documented in the.mdx
files.- The constructors and methods for these types are implemented and documented as expected.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the documentation and implementation of constructors and methods in `DateValue`, `CalendarDate`, `CalendarDateTime`, and `ZonedDateTime`. # Test: Search for the documentation and implementation of constructors and methods. Expect: Accurate documentation and implementation. rg --type ts --pcre2 "(DateValue|CalendarDate|CalendarDateTime|ZonedDateTime)" apps/docs/content/docs/componentsLength of output: 114
Script:
#!/bin/bash # Description: Verify the documentation and implementation of constructors and methods in `DateValue`, `CalendarDate`, `CalendarDateTime`, and `ZonedDateTime`. # Test: Search the entire codebase for the documentation and implementation of constructors and methods. Expect: Accurate documentation and implementation. rg --type-add 'docs:*.{ts,js,mdx}' --type docs --pcre2 "(DateValue|CalendarDate|CalendarDateTime|ZonedDateTime)"Length of output: 69173
Line range hint
244-261
:
IntroduceSupportedCalendars
type.The
SupportedCalendars
type lists various calendar systems correctly.Ensure that all listed calendars are supported.
Verification successful
All listed calendar types in
SupportedCalendars
are correctly supported.The search results confirm that each calendar type listed in the
SupportedCalendars
type is referenced and supported across various parts of the codebase, including documentation, utility functions, and test files.
- buddhist: Found in multiple files including
dates.ts
,types.ts
, and several MDX files.- ethiopic: Found in
dates.ts
,types.ts
, and several MDX files.- ethioaa: Found in
dates.ts
,types.ts
, and several MDX files.- coptic: Found in
dates.ts
,types.ts
, and several MDX files.- hebrew: Found in
dates.ts
,types.ts
, and several MDX files.- indian: Found in
dates.ts
,types.ts
, and several MDX files.- islamic-civil: Found in
dates.ts
,types.ts
, and several MDX files.- islamic-tbla: Found in
dates.ts
,types.ts
, and several MDX files.- islamic-umalqura: Found in
dates.ts
,types.ts
, and several MDX files.- japanese: Found in
dates.ts
,types.ts
, and several MDX files.- persian: Found in
dates.ts
,types.ts
, and several MDX files.- roc: Found in
dates.ts
,types.ts
, and several MDX files.- gregory: Found in
dates.ts
,types.ts
, and several MDX files.All calendar types are adequately supported and referenced in the codebase, confirming the correctness of the
SupportedCalendars
type definition.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the support for all listed calendars in `SupportedCalendars`. # Test: Search for the usage and support for all listed calendars. Expect: Correct support for all listed calendars. rg --type ts --pcre2 "SupportedCalendars" apps/docs/content/docs/componentsLength of output: 75
Script:
#!/bin/bash # Description: Verify the support for each listed calendar in `SupportedCalendars`. # List of calendar types to verify calendars=("buddhist" "ethiopic" "ethioaa" "coptic" "hebrew" "indian" "islamic-civil" "islamic-tbla" "islamic-umalqura" "japanese" "persian" "roc" "gregory") # Search for each calendar type in the codebase for calendar in "${calendars[@]}"; do echo "Searching for support for calendar type: $calendar" rg --type ts --pcre2 "$calendar" apps/docs/content/docs/components doneLength of output: 2911
Script:
#!/bin/bash # Description: Verify the support for each listed calendar in `SupportedCalendars` across the entire repository. # List of calendar types to verify calendars=("buddhist" "ethiopic" "ethioaa" "coptic" "hebrew" "indian" "islamic-civil" "islamic-tbla" "islamic-umalqura" "japanese" "persian" "roc" "gregory") # Search for each calendar type in the entire repository for calendar in "${calendars[@]}"; do echo "Searching for support for calendar type: $calendar" rg --pcre2 "$calendar" doneLength of output: 23453
266-269
: IntroduceMappedDateValue
type.The
MappedDateValue
type mapsDateValue
to specific date and time types correctly.Ensure that the mapping logic is accurate.
apps/docs/content/docs/components/date-picker.mdx (4)
367-380
: Approved: SupportedCalendars type.The
SupportedCalendars
type definition looks correct and comprehensive.
394-396
: Approved: DateValue type.The
DateValue
type definition as a union ofCalendarDate
,CalendarDateTime
, andZonedDateTime
looks correct.
404-443
: Approved: CalendarDate, CalendarDateTime, and ZonedDateTime classes.The class definitions for
CalendarDate
,CalendarDateTime
, andZonedDateTime
look comprehensive and well-documented. Ensure that the classes are correctly used and instantiated in the codebase.Also applies to: 451-498, 506-559
Verification successful
Verified: Usage of CalendarDate, CalendarDateTime, and ZonedDateTime classes.
The classes
CalendarDate
,CalendarDateTime
, andZonedDateTime
are correctly used and instantiated across various files in the codebase. The search results show proper references and instantiations of these classes.
Files with
CalendarDate
usage:
packages/core/system/src/provider-context.ts
apps/docs/content/components/date-input/error-message.ts
apps/docs/content/components/date-input/error-message-function.ts
apps/docs/content/components/date-input/required.ts
apps/docs/content/components/date-input/start-end-content.ts
apps/docs/content/components/date-input/variants.ts
apps/docs/content/components/date-input/usage.ts
apps/docs/content/components/date-input/readonly.ts
apps/docs/content/components/date-input/label-placements.ts
apps/docs/content/components/date-input/disabled.ts
packages/components/date-input/stories/date-input.stories.tsx
packages/components/date-picker/__tests__/date-picker.test.tsx
packages/components/date-input/__tests__/date-input.test.tsx
packages/components/calendar/src/calendar-month.tsx
packages/components/calendar/__tests__/calendar.test.tsx
packages/components/calendar/src/use-calendar-picker.ts
packages/components/calendar/src/calendar-header.tsx
packages/components/calendar/src/calendar-cell.tsx
packages/components/calendar/src/use-calendar-base.ts
packages/components/calendar/__tests__/range-calendar.test.tsx
packages/components/calendar/stories/range-calendar.stories.tsx
Files with
CalendarDateTime
usage:
packages/components/date-picker/__tests__/date-picker.test.tsx
packages/components/date-input/__tests__/date-input.test.tsx
Files with
ZonedDateTime
usage:
apps/docs/content/components/time-input/controlled.ts
apps/docs/content/components/time-input/hide-timezone.ts
packages/components/date-input/stories/time-input.stories.tsx
packages/components/date-input/__tests__/time-input.test.tsx
The search results confirm that the classes are used appropriately, and there are no apparent issues with their instantiation or usage.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of the `CalendarDate`, `CalendarDateTime`, and `ZonedDateTime` classes in the codebase. # Test: Search for the usage of the classes. Expect: Correct usage and instantiation. rg --type ts $'CalendarDate|CalendarDateTime|ZonedDateTime'Length of output: 22860
386-388
: LGTM! But verify the usage of theMappedDateValue
type.The
MappedDateValue
type definition looks correct. Ensure that the mapping logic is consistently used throughout the codebase.apps/docs/content/docs/components/date-range-picker.mdx (6)
409-421
: LGTM!The
RangeValue
interface is well-defined and documented.
423-429
: LGTM!The
MappedDateValue
type definition is correct and aligns with the new type mappings for date values.
431-437
: LGTM!The
DateValue
type definition is correct and includes the appropriate date value types.
439-483
: LGTM!The
CalendarDate
class is well-defined and documented, providing detailed information about each property and method.
486-537
: LGTM!The
CalendarDateTime
class is well-defined and documented, providing detailed information about each property and method.
541-599
: LGTM!The
ZonedDateTime
class is well-defined and documented, providing detailed information about each property and method.
Closes #
📝 Description
⛳️ Current behavior (updates)
🚀 New behavior
💣 Is this a breaking change (Yes/No):
📝 Additional Information
Summary by CodeRabbit
New Features
onChange
handlers indate-input
,date-picker
,DateRangePicker
, andRangeCalendar
components to useMappedDateValue
for better date handling.SupportedCalendars
,MappedDateValue
,DateValue
,CalendarDate
,CalendarDateTime
, andZonedDateTime
.Refactor
useImage
function with a more efficientuseMemo
implementation.