@@ -7,22 +7,16 @@ import { Input } from '@base-ui-components/react/input';
77import { Select } from '@base-ui-components/react/select' ;
88import { RadioGroup } from '@base-ui-components/react/radio-group' ;
99import { Radio } from '@base-ui-components/react/radio' ;
10+ import { Separator } from '@base-ui-components/react/separator' ;
1011import { ChevronDown } from 'lucide-react' ;
11- import { Toggle } from '@base-ui-components/react/toggle' ;
12- import { ToggleGroup } from '@base-ui-components/react/toggle-group' ;
1312import {
1413 SchedulerEventOccurrence ,
1514 RecurringEventFrequency ,
1615 RecurringEventPresetKey ,
17- RecurringEventByDayValue ,
18- RecurringEventWeekDayCode ,
1916} from '@mui/x-scheduler-headless/models' ;
2017import { useSchedulerStoreContext } from '@mui/x-scheduler-headless/use-scheduler-store-context' ;
2118import { useAdapter } from '@mui/x-scheduler-headless/use-adapter' ;
22- import {
23- schedulerEventSelectors ,
24- schedulerRecurringEventSelectors ,
25- } from '@mui/x-scheduler-headless/scheduler-selectors' ;
19+ import { schedulerEventSelectors } from '@mui/x-scheduler-headless/scheduler-selectors' ;
2620import { Tabs } from '@base-ui-components/react/tabs' ;
2721import { useTranslations } from '../../utils/TranslationsContext' ;
2822import { ControlledValue , EndsSelection , getEndsSelectionFromRRule } from './utils' ;
@@ -48,12 +42,6 @@ export function RecurrenceTab(props: RecurrenceTabProps) {
4842 occurrence . id ,
4943 ) ;
5044 const customDisabled = controlled . recurrenceSelection !== 'custom' || isPropertyReadOnly ( 'rrule' ) ;
51- const monthlyRef = useStore (
52- store ,
53- schedulerRecurringEventSelectors . monthlyReference ,
54- occurrence . start ,
55- ) ;
56- const weeklyDays = useStore ( store , schedulerRecurringEventSelectors . weeklyDays ) ;
5745
5846 const handleRecurrenceSelectionChange = ( value : RecurringEventPresetKey | null | 'custom' ) => {
5947 if ( value === 'custom' ) {
@@ -145,30 +133,6 @@ export function RecurrenceTab(props: RecurrenceTabProps) {
145133 } ) ) ;
146134 } ;
147135
148- const handleChangeWeeklyDays = ( next : RecurringEventWeekDayCode [ ] ) => {
149- setControlled ( ( prev ) => ( {
150- ...prev ,
151- rruleDraft : {
152- ...prev . rruleDraft ,
153- byDay : next ,
154- } ,
155- } ) ) ;
156- } ;
157-
158- const handleChangeMonthlyGroup = ( next : string [ ] ) => {
159- const nextKey = next [ 0 ] ;
160-
161- setControlled ( ( prev ) => {
162- if ( nextKey === 'byDay' ) {
163- const value = `${ monthlyRef . ord } ${ monthlyRef . code } ` as RecurringEventByDayValue ;
164- const { byMonthDay, ...rest } = prev . rruleDraft ;
165- return { ...prev , rruleDraft : { ...rest , byDay : [ value ] } } ;
166- }
167- const { byDay, ...rest } = prev . rruleDraft ;
168- return { ...prev , rruleDraft : { ...rest , byMonthDay : [ monthlyRef . dayOfMonth ] } } ;
169- } ) ;
170- } ;
171-
172136 const customEndsValue : 'never' | 'after' | 'until' = getEndsSelectionFromRRule (
173137 controlled . rruleDraft ,
174138 ) ;
@@ -219,46 +183,6 @@ export function RecurrenceTab(props: RecurrenceTabProps) {
219183 } ,
220184 ] ;
221185
222- const weeklyDayItems = React . useMemo (
223- ( ) =>
224- weeklyDays . map ( ( { code, date } ) => ( {
225- value : code ,
226- ariaLabel : adapter . format ( date , 'weekday' ) ,
227- label : adapter . format ( date , 'weekdayShort' ) ,
228- } ) ) ,
229- [ adapter , weeklyDays ] ,
230- ) ;
231-
232- const monthlyItems = React . useMemo ( ( ) => {
233- const ordinal = monthlyRef . ord ;
234- const dayOfMonthLabel = translations . recurrenceMonthlyDayOfMonthLabel ?.( monthlyRef . dayOfMonth ) ;
235- const isLast = ordinal === - 1 ;
236- const weekdayShort = adapter . formatByString ( monthlyRef . date , 'ccc' ) ;
237- const weekAriaLabel = isLast
238- ? translations . recurrenceMonthlyLastWeekAriaLabel ( weekday )
239- : translations . recurrenceMonthlyWeekNumberAriaLabel ?.( ordinal , weekday ) ;
240- const weekLabel = isLast
241- ? translations . recurrenceMonthlyLastWeekLabel ( weekdayShort )
242- : translations . recurrenceMonthlyWeekNumberLabel ?.( ordinal , weekdayShort ) ;
243-
244- return [
245- {
246- value : 'byMonthDay' ,
247- ariaLabel : dayOfMonthLabel ,
248- label : dayOfMonthLabel ,
249- } ,
250- {
251- value : 'byDay' ,
252- ariaLabel : weekAriaLabel ,
253- label : weekLabel ,
254- } ,
255- ] ;
256- } , [ adapter , monthlyRef . date , monthlyRef . dayOfMonth , monthlyRef . ord , translations , weekday ] ) ;
257-
258- const monthlyMode : 'byMonthDay' | 'byDay' = controlled . rruleDraft . byDay ?. length
259- ? 'byDay'
260- : 'byMonthDay' ;
261-
262186 return (
263187 < Tabs . Panel value = "recurrence" keepMounted >
264188 < div className = "EventPopoverMainContent" >
@@ -311,6 +235,7 @@ export function RecurrenceTab(props: RecurrenceTabProps) {
311235 < Field . Root className = "EventPopoverInputsRow" >
312236 { translations . recurrenceEveryLabel }
313237 < Input
238+ name = "interval"
314239 type = "number"
315240 min = { 1 }
316241 value = { controlled . rruleDraft . interval }
@@ -350,40 +275,15 @@ export function RecurrenceTab(props: RecurrenceTabProps) {
350275 </ Field . Root >
351276 </ Fieldset . Root >
352277 { controlled . recurrenceSelection === 'custom' && controlled . rruleDraft . freq === 'WEEKLY' && (
353- < Field . Root className = "EventPopoverInputsRow" >
354- < Field . Label > { translations . recurrenceWeeklyMonthlySpecificInputsLabel } </ Field . Label >
355- < ToggleGroup
356- className = "ToggleGroup"
357- multiple
358- value = { controlled . rruleDraft . byDay }
359- onValueChange = { handleChangeWeeklyDays }
360- >
361- { weeklyDayItems . map ( ( { value, ariaLabel, label } ) => (
362- < Toggle key = { value } aria-label = { ariaLabel } value = { value } className = "ToggleItem" >
363- { label }
364- </ Toggle >
365- ) ) }
366- </ ToggleGroup >
367- </ Field . Root >
278+ < p className = "EventPopoverRecurrenceFieldset" > TODO: Weekly Fields</ p >
368279 ) }
369280 { controlled . recurrenceSelection === 'custom' &&
370281 controlled . rruleDraft . freq === 'MONTHLY' && (
371- < Field . Root className = "EventPopoverInputsRow" >
372- < Field . Label > { translations . recurrenceWeeklyMonthlySpecificInputsLabel } </ Field . Label >
373- < ToggleGroup
374- className = "ToggleGroup"
375- value = { [ monthlyMode ] }
376- onValueChange = { handleChangeMonthlyGroup }
377- >
378- { monthlyItems . map ( ( { value, ariaLabel, label } ) => (
379- < Toggle key = { value } aria-label = { ariaLabel } value = { value } className = "ToggleItem" >
380- { label }
381- </ Toggle >
382- ) ) }
383- </ ToggleGroup >
384- </ Field . Root >
282+ < p className = "EventPopoverRecurrenceFieldset" > TODO: Monthly Fields</ p >
385283 ) }
386284
285+ < Separator className = "EventPopoverSeparator" />
286+
387287 < Fieldset . Root
388288 className = "EventPopoverRecurrenceFieldset"
389289 disabled = { customDisabled }
@@ -427,6 +327,7 @@ export function RecurrenceTab(props: RecurrenceTabProps) {
427327 </ Radio . Root >
428328 < div className = "EventPopoverAfterTimesInputWrapper" >
429329 < Input
330+ name = "count"
430331 type = "number"
431332 min = { 1 }
432333 value = { customEndsValue === 'after' ? ( controlled . rruleDraft . count ?? 1 ) : 1 }
@@ -452,6 +353,7 @@ export function RecurrenceTab(props: RecurrenceTabProps) {
452353 </ span >
453354 </ Radio . Root >
454355 < Input
356+ name = "until"
455357 type = "date"
456358 value = {
457359 customEndsValue === 'until' && controlled . rruleDraft . until
0 commit comments