{"version":3,"file":"command-palette.cjs","names":["CommandPaletteChrome","Dialog","InputBase","ListItemButton","Typography","Surface","t0","$","_c","label","onClose","children","className","t1","Symbol","for","p","t2","paper","sx","t3","Input","inputProps","bind","onChange","ref","px","py","input","event","target","value","t4","Item","command","active","itemProps","disabled","Empty","message","slots","CommandPalette","props","createAdapterCommandPaletteFeature","CommandPalette","commandPalette"],"sources":["../src/components/CommandPalette.tsx","../src/command-palette.tsx"],"sourcesContent":["import {\n  CommandPaletteChrome,\n  type CommandPaletteChromeProps,\n  type CommandPaletteInputProps,\n  type CommandPaletteItemProps,\n  type CommandPaletteSlots,\n  type CommandPaletteSurfaceProps,\n} from \"@adapttable/react/adapter\";\nimport { Dialog, InputBase, ListItemButton, Typography } from \"@mui/material\";\n\n/**\n * The kit's own dialog, holding core's combobox.\n *\n * The dialog is the kit's — its backdrop, its portal, its entrance — while\n * the input, the list and the highlight belong to core, because a palette\n * is a combobox over a listbox and no kit ships that shape. Splitting it\n * this way means the palette looks like the rest of the app and behaves the\n * same in all nine kits.\n */\nfunction Surface({\n  label,\n  onClose,\n  children,\n  className,\n}: Readonly<CommandPaletteSurfaceProps>) {\n  return (\n    <Dialog\n      open\n      onClose={onClose}\n      // Core moves focus into the search box and owns the trap; MUI's own\n      // autofocus and focus enforcement would take it straight back.\n      disableAutoFocus\n      disableEnforceFocus\n      fullWidth\n      maxWidth=\"sm\"\n      className={className}\n      data-adapttable-part=\"command-palette\"\n      // The name goes on the PAPER, not on `Dialog`: MUI spreads unrecognised\n      // props onto its Modal root, which it marks `role=\"presentation\"`, and a\n      // name there is discarded. `role=\"dialog\"` is on the paper.\n      slotProps={{ paper: { \"aria-label\": label, sx: { p: 1 } } }}\n    >\n      {children}\n    </Dialog>\n  );\n}\n\nfunction Input({ inputProps }: CommandPaletteInputProps) {\n  const { onChange, ref, ...bind } = inputProps;\n  return (\n    <InputBase\n      fullWidth\n      sx={{ px: 1, py: 0.5 }}\n      // The bindings go to the inner element, not to InputBase's wrapper:\n      // MUI renders a div around the real input, and a part name or a key\n      // handler left on the wrapper is on something that never has focus.\n      inputRef={ref}\n      slotProps={{ input: bind }}\n      onChange={(event) => {\n        onChange(event.target.value);\n      }}\n    />\n  );\n}\n\nfunction Item({ command, active, itemProps }: CommandPaletteItemProps) {\n  return (\n    // `ListItemButton`, not `MenuItem`: the list is core's listbox, and a\n    // MUI MenuItem requires a MenuList ancestor it will not find here.\n    <ListItemButton\n      {...itemProps}\n      selected={active}\n      disabled={command.disabled}\n      dense\n    >\n      {command.label}\n    </ListItemButton>\n  );\n}\n\nfunction Empty({ message }: Readonly<{ message: string }>) {\n  return (\n    <Typography\n      variant=\"body2\"\n      color=\"text.secondary\"\n      sx={{ p: 1 }}\n      data-adapttable-part=\"command-empty\"\n    >\n      {message}\n    </Typography>\n  );\n}\n\nconst slots: CommandPaletteSlots = { Surface, Input, Item, Empty };\n\n/** mui-owned command palette. */\nexport function CommandPalette(\n  props: Readonly<Omit<CommandPaletteChromeProps, \"slots\">>\n) {\n  return <CommandPaletteChrome {...props} slots={slots} />;\n}\n","import { createAdapterCommandPaletteFeature } from \"@adapttable/react/adapter\";\n\nimport { CommandPalette } from \"./components/CommandPalette\";\n\n/** Add a searchable command palette drawn with this kit's controls. @public */\nexport const commandPalette =\n  createAdapterCommandPaletteFeature(CommandPalette);\n"],"mappings":";;;;;;;;;;;;;;;;AAmBA,SAAAK,QAAAC,IAAA;CAAA,MAAAC,KAAAA,GAAAC,uBAAAA,EAAAA,CAAA,CAAA;CAAiB,MAAA,EAAAC,OAAAC,SAAAC,UAAAC,cAAAN;CAKsB,IAAAO;CAAA,IAAAN,EAAA,OAAAO,OAAAC,IAAA,2BAAA,GAAA;EAgBcF,KAAA,EAAAG,GAAK,EAAE;EAACT,EAAA,KAAAM;CAAA,OAAAA,KAAAN,EAAA;CAAA,IAAAU;CAAA,IAAAV,EAAA,OAAAE,OAAA;EAA5CQ,KAAA,EAAAC,OAAS;GAAA,cAAgBT;GAAKU,IAAMN;E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