Skip to content

[scheduler] Add the eventDialogGeneralTab slot - #23338

Open
rita-codes wants to merge 5 commits into
mui:masterfrom
rita-codes:22871-scheduler-edit-dialog-general-tab-slot-for-composing-sections-built-in-custom-phase-1
Open

[scheduler] Add the eventDialogGeneralTab slot#23338
rita-codes wants to merge 5 commits into
mui:masterfrom
rita-codes:22871-scheduler-edit-dialog-general-tab-slot-for-composing-sections-built-in-custom-phase-1

Conversation

@rita-codes

@rita-codes rita-codes commented Aug 14, 2026

Copy link
Copy Markdown
Member

Part of #22871 — first of the two planned PRs. The follow-up flips the public exports of the built-in section components and useEventDialogFormField.

Changes

  • Adds slots / slotProps with a single eventDialogGeneralTab slot to every public component that can open the event dialog or the compact editing drawer (17 surfaces across @mui/x-scheduler and @mui/x-scheduler-premium), delivered through a slots-only context (SchedulerSlotsProvider), following the Charts/Tree View pattern.
  • The slot replaces the content of the General tab, not the tab panel: role="tabpanel", the id/aria-labelledby pairing and the hidden state stay owned by the dialog.
  • The General tab sections stop taking occurrence as a prop and read it from the new EventEditingOccurrenceContext, so a slot can compose them in any order. The default composition is extracted to EventDialogGeneralTabContent.
  • New dev warnings:
    • on submit, when shouldEventRequireResource is enabled but no field of the dialog validates resourceId (for example the slot omitted the resource section) — it reads the selector, so it stays silent when no resources are configured;
    • when useEventDialogFormField() receives a defaultValue for a built-in key, which is always a silent no-op.

Notes for reviewers

  • Validators stay mount-scoped: omitting ResourceAndColorSection disables the resource requirement. This is deliberate (one rule for built-in and custom sections alike) and is covered by the submit-time warning instead of an always-on validator, which would leave the end user with a dead Save button and no visible error.
  • slotProps.eventDialogGeneralTab only carries the EventDialogGeneralTabPropsOverrides augmentation seam — occurrence is supplied by the scheduler and cannot be overridden.
  • The section components and the form hook are intentionally not exported yet; that is the follow-up PR, so this one ships a working slot whose only content is the consumer's own JSX.

rita-codes and others added 3 commits August 7, 2026 18:27
Part of mui#22866. Groundwork for the General-tab slot (mui#22871).

The General tab sections received the occurrence as a prop, which a consumer
composing them as JSX has no way to pass. They now read it from an editing
context provided by `FormContent`, so each section is a zero-prop component.

The default composition moves out of `GeneralTab` into
`EventDialogGeneralTabContent`, which is what the slot will fall back to.

Validators stay registered by the section that owns the field, so omitting a
section also drops its validation. `shouldEventRequireResource` is the one case
where that silently weakens a guarantee the consumer opted into, so submit warns
in dev when no field validates the resource. It reads the selector, which already
resolves to `false` when no resources are configured.

Also warns when a built-in form key receives a `defaultValue`: built-in keys are
always seeded from the event, so `seedDefault` never applies it.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Part of mui#22866. Closes mui#22871.

Introduces `slots` and `slotProps` on the scheduler, with a single slot:
`eventDialogGeneralTab`, the content of the General tab of the event editing
dialog. Consumers pass a component that composes whatever they want, so the
sections can be reordered, omitted, wrapped in arbitrary JSX, or interleaved
with sections of their own that read and write the form through
`useEventDialogFormField`.

Follows the MUI X convention: a flat camelCase slot name on the root component
regardless of how deep the render site is (Pickers exposes `day`, Data Grid
exposes `columnsManagement`), delivered to that site through a slots-only
context like Charts and Tree View rather than by prop drilling.

The slot replaces the content of the tab, not the tab panel: the panel carries
`role="tabpanel"`, the ids pairing it with its tab, and the `hidden` state
driven by the tab selection, none of which the consumer can supply.

The props are declared on every public component that opens an editing surface.
`EventCalendarProvider` mounts the context once for all the standalone views,
including the compact ones, so the slot reaches the mobile drawer too — it
shares `FormContent` with the dialog.

The section components stay internal for now; a consumer can only render their
own JSX in the slot until they are exported.

The API docs builder looks for a `<ComponentName>Slots` interface by default,
so `getComponentInfo` points it at the shared `SchedulerSlots` instead, except
for `StandaloneEvent`, the only public component that takes no slots.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Also extracts the error code for the new useEventEditingOccurrence guard.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QjGAGrDTiWVHJ1gyrj4uM2
@rita-codes rita-codes self-assigned this Aug 14, 2026
@rita-codes rita-codes added type: new feature Expand the scope of the product to solve a new problem. scope: scheduler Changes related to the scheduler. labels Aug 14, 2026
…dit-dialog-general-tab-slot-for-composing-sections-built-in-custom-phase-1

# Conflicts:
#	packages/x-scheduler-premium/src/compact-day-view-premium/CompactDayViewPremium.types.ts
#	packages/x-scheduler-premium/src/compact-week-view-premium/CompactWeekViewPremium.types.ts
@code-infra-dashboard

code-infra-dashboard Bot commented Aug 14, 2026

Copy link
Copy Markdown

Deploy preview

https://deploy-preview-23338--material-ui-x.netlify.app/
QR code for https://deploy-preview-23338--material-ui-x.netlify.app/

Bundle size

Bundle Parsed size Gzip size
@mui/x-data-grid 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-pro 0B(0.00%) 0B(0.00%)
@mui/x-data-grid-premium 0B(0.00%) 0B(0.00%)
@mui/x-charts 0B(0.00%) 0B(0.00%)
@mui/x-charts-pro 0B(0.00%) 0B(0.00%)
@mui/x-charts-premium 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers 0B(0.00%) 0B(0.00%)
@mui/x-date-pickers-pro 0B(0.00%) 0B(0.00%)
@mui/x-tree-view 0B(0.00%) 0B(0.00%)
@mui/x-tree-view-pro 0B(0.00%) 0B(0.00%)
@mui/x-scheduler 🔺+1.2KB(+0.31%) 🔺+260B(+0.25%)
@mui/x-scheduler-premium 🔺+1.28KB(+0.23%) 🔺+278B(+0.18%)
@mui/x-chat 0B(0.00%) 0B(0.00%)
@mui/x-license 0B(0.00%) 0B(0.00%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

@rita-codes rita-codes changed the title [scheduler] Add the eventDialogGeneralTab slot [scheduler] Add the eventDialogGeneralTab slot Aug 14, 2026
@github-actions github-actions Bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Aug 18, 2026
@github-actions

Copy link
Copy Markdown
Contributor

This pull request has conflicts, please resolve those before we can evaluate the pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: out-of-date The pull request has merge conflicts and can't be merged. scope: scheduler Changes related to the scheduler. type: new feature Expand the scope of the product to solve a new problem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant