Skip to content
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

[DataGridPremium] Control grid with prompts #16992

Open
wants to merge 15 commits into
base: master
Choose a base branch
from

Conversation

arminmeh
Copy link
Contributor

@arminmeh arminmeh commented Mar 17, 2025

Closes #15548

I have extracted context processing and result processing in a hook. This also allows building custom UI.

Preivew
https://deploy-preview-16992--material-ui-x.netlify.app/x/react-data-grid/prompt/

Before merging:

  • add-on needs to be defined

Follow ups:

  • Pivoting support

@arminmeh arminmeh added component: data grid This is the name of the generic UI component, not the React module! new feature New feature or request plan: Premium Impact at least one Premium user labels Mar 17, 2025
@arminmeh arminmeh requested a review from a team March 17, 2025 09:13

<p class="description">Translate natural language into a set of grid state updates and apply them to the Data Grid component.</p>

:::warning
To use this feature, you need to have a prompt processing backend. MUI offers this service as a part of a premium package add-on. Check [licensing page](/x/introduction/licensing/) for more information.
To use this feature, you need to have a prompt processing backend. MUI offers this service as a part of a premium package add-on.
Check [licensing page](/x/introduction/licensing/) for more information.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joserodolfofreitas this needs to point to the right page with all necessary information

@@ -2,22 +2,24 @@
title: Data Grid - Prompt
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@joserodolfofreitas I am not sure if this will be the official name

@@ -122,7 +122,6 @@ const Toolbar = forwardRef<HTMLDivElement, ToolbarProps>(function Toolbar(props,
role: 'toolbar',
'aria-orientation': 'horizontal',
className: clsx(classes.root, className),
ownerState: rootProps,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@KenanYusuf
I was getting error in the prompt demos that owner state does not exist on the component (since Box is used for rendering)
Removing ownerState makes this more generic and you can get rootProps again in your custom renderer

Copy link
Member

@KenanYusuf KenanYusuf Mar 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I don't think we need ownerState in this case anyway, but it definitely shouldn't be forwarded to the rendered element. Makes sense to me.

@mui-bot
Copy link

mui-bot commented Mar 17, 2025

Deploy preview: https://deploy-preview-16992--material-ui-x.netlify.app/

Updated pages:

Generated by 🚫 dangerJS against 03571ef

@arminmeh arminmeh force-pushed the prompt-improvements branch from 0f7d5c1 to 03571ef Compare March 17, 2025 09:23
</Box>
<GridToolbarPromptControl onPrompt={mockPromptResolver} allowDataSampling />
<GridToolbarPromptControl
Copy link
Member

@KenanYusuf KenanYusuf Mar 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@arminmeh @joserodolfofreitas I'm thinking GridToolbarPromptControl should be a composable component. I'd propose an API similar to the Quick Filter component:

<PromptField
  <PromptFieldRecord />
  <PromptFieldControl />
  <PromptFieldSubmit />
</PromptField>

For Material UI it would be composed like:

<PromptField>
  <PromptFieldControl
    render={({ ref, ...other }) => (
      <TextField
        {...other}
        aria-label="Prompt"
        placeholder="Record or type a prompt..."
        size="small"
        InputProps={{
          startAdornment: (
            <InputAdornment position="start">
              <PromptFieldRecord
                edge="start"
                size="small"
                aria-label="Record voice"
              >
                <MicrophoneIcon fontSize="small" />
              </PromptFieldRecord>
            </InputAdornment>
          ),
          endAdornment: other.value ? (
            <InputAdornment position="end">
              <PromptFieldSubmit
                edge="end"
                size="small"
                aria-label="Send"
              >
                <SendIcon fontSize="small" />
              </PromptFieldSubmit>
            </InputAdornment>
          ) : null,
        }}
      />
    )}
  />
</PromptField>

Just suggesting it here as it came into my head—I can move this to a separate issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will update it in this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: data grid This is the name of the generic UI component, not the React module! new feature New feature or request plan: Premium Impact at least one Premium user
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[data grid] Prompt control improvements
3 participants