fix(filterChip): fix for breaking date type filterchip, width wrapping, and text value date#821
fix(filterChip): fix for breaking date type filterchip, width wrapping, and text value date#821Shreyag02 wants to merge 2 commits into
Conversation
…g, and text value date
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThis PR consolidates the DatePicker and RangePicker component APIs by switching from separate Sequence DiagramsequenceDiagram
participant User
participant FilterChip
participant DatePicker
participant Calendar
User->>FilterChip: filterValue (Date or non-Date)
alt filterValue is Date
FilterChip->>FilterChip: Pass Date to DatePicker value
else filterValue is not Date
FilterChip->>FilterChip: Pass undefined to DatePicker value
end
FilterChip->>DatePicker: dateFormat, slotProps.input config
DatePicker->>Calendar: slotProps.calendar config
User->>Calendar: Select date
Calendar->>DatePicker: onSelect(date)
DatePicker->>FilterChip: Propagate selection
FilterChip->>User: Update filter with selected Date
Possibly related issuesSuggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| /** Date display/parse format for `columnType="date"`, forwarded to the underlying DatePicker. | ||
| * @default "DD MMM YYYY" | ||
| */ | ||
| dateFormat?: string; |
There was a problem hiding this comment.
Let's expose a calendarProps similar to selectProps and expose and forward all props
There was a problem hiding this comment.
The input field should also shrink on parent resize which was working before, but not working now.
Fixes the date-type
FilterChipand makes its value fields hug their content. After PR #819 madeDatePicker.valuestrictlyDate | undefinedand added a controlled-sync effect keyed onvalueProp?.getTime(), the date filter chip crashed:FilterChipseeds its value state with''and forwarded that string to the picker, so''.getTime()threwTypeError: valueProp?.getTime is not a function(caught by the ErrorBoundary, regenerating the tree).Changes:
Datevalues toundefined(value={filterValue instanceof Date ? filterValue : undefined}), so an unset/string-valued chip starts on the "Select date" placeholder instead of throwing.slotProps.input— off theinputPropsAPI fix(calendar): typing, controlled-value, slotProps API, tz-aware day keys #819 deprecated.dateFormatprop (default'DD MMM YYYY'), forwarded to theDatePicker, so the capture-date filter reads "27 May 2026" instead of "27/05/2026".field-sizing: contentwithwidth: autoplus guardrails (min-width: var(--rs-space-10),max-width: 200px), so the chip hugs its value like the "All Bands" select chip; falls back to a bounded intrinsic width wherefield-sizingis unsupported.V1-migration.md, a CHANGELOG entry under 0.49.0, thedateFormatprop documented in the FilterChip props doc, and the showcase/playground demos migrated off the deprecated picker props toslotProps.Behavior note: existing date
FilterChips now display month-as-text by default; this is overridable per-chip via the newdateFormatprop.Type of Change
How Has This Been Tested?
filter-chip.test.tsx(12 → 18, all passing): no-crash regression for an unset date chip, nonDatevalue coercion to unselected, default month-as-text formatting (27 May 2026), customdateFormat(27/05/2026), and content-fit width wiring on both the string and date containers.@raystack/apsaraVitest suite passes (1,852 tests) — no cross-component regression; calendar + filter-chip together: 89/89.tsc --noEmitclean forfilter-chip/calendarand the two editedapps/wwwfiles.components/filter-chip(only the 2 pre-existinganywarnings in the originaluseCallback; no new warnings).Checklist:
Screenshots (if appropriate):
[Add screenshots here]
Related Issues
[Link any related issues here using #issue-number]