Skip to content

Commit

Permalink
SelectPanel2: Props for docs page (#3961)
Browse files Browse the repository at this point in the history
* wip

* add SelectPanel.Loading

* run prettier

* refine types

* add loading to SearchInput
  • Loading branch information
siddharthkp authored Nov 23, 2023
1 parent f767195 commit 88f594d
Show file tree
Hide file tree
Showing 3 changed files with 181 additions and 0 deletions.
36 changes: 36 additions & 0 deletions docs/content/drafts/SelectPanel.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
componentId: selectpanel_v2
title: SelectPanel v2
status: Draft
source: https://github.com/primer/react/blob/main/src/drafts/SelectPanel2
storybook: '/react/storybook/?path=/story/drafts-components-selectpanel'
---

import data from '../../../src/drafts/SelectPanel2/SelectPanel.docs.json'

A `SelectPanel` provides an anchor that will open an overlay with a list of selectable items, and a text input to filter the selectable items

## Props

<ComponentProps data={data} />

## Status

<ComponentChecklist
items={{
propsDocumented: true,
noUnnecessaryDeps: true,
adaptsToThemes: true,
adaptsToScreenSizes: false,
fullTestCoverage: false,
usedInProduction: false,
usageExamplesDocumented: false,
hasStorybookStories: false,
designReviewed: false,
a11yReviewed: false,
stableApi: false,
addressedApiFeedback: false,
hasDesignGuidelines: false,
hasFigmaComponent: false,
}}
/>
2 changes: 2 additions & 0 deletions docs/src/@primer/gatsby-theme-doctocat/nav.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,8 @@
url: /drafts/MarkdownViewer
- title: PageHeader
url: /drafts/PageHeader
- title: SelectPanel v2
url: /drafts/SelectPanel
- title: Tooltip v2
url: /drafts/Tooltip
- title: Deprecated
Expand Down
143 changes: 143 additions & 0 deletions src/drafts/SelectPanel2/SelectPanel.docs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
{
"id": "selectpanel_v2",
"name": "SelectPanel v2",
"status": "draft",
"a11yReviewed": false,
"stories": [],
"props": [
{
"name": "title",
"type": "string",
"required": true,
"description": "A descriptive title for the panel"
},
{
"name": "description",
"type": "string",
"description": "When provided, a description is displayed below the title"
},
{
"name": "selectionVariant",
"type": "'multiple' | 'single' | 'instant'",
"defaultValue": "multiple"
},
{
"name": "onSubmit",
"type": "(event: React.FormEvent) => void",
"description": "Function that will be called when the panel is closed"
},
{
"name": "onCancel",
"type": "() => void",
"description": "Function that will be called when the selection is submitted"
},
{
"name": "onClearSelection",
"type": "() => void",
"description": "Function that will be called when the clear selection is selection"
},
{
"name": "anchorRef",
"type": "React.RefObject<HTMLButtonElement>",
"description": "Useful for defining an external anchor"
},
{
"name": "open",
"type": "boolean",
"defaultValue": "false",
"description": "If defined, will control the open/closed state of the panel."
},
{
"name": "children",
"type": "React.ReactNode[]",
"description": "Recommended: `SelectPanel.Button`, `SelectPanel.Header`, `ActionList`, `SelectPanel.Loading`, `SelectPanel.Message`, `SelectPanel.Footer`"
}
],
"subcomponents": [
{
"name": "SelectPanel.Button",
"props": [
{
"name": "children",
"type": "React.ReactElement",
"required": true,
"defaultValue": ""
}
],
"passthrough": {
"element": "Button",
"url": "/react/Button"
}
},
{
"name": "SelectPanel.Header",
"props": [
{
"name": "children",
"type": "React.ReactNode",
"description": "Rendered before the list. Recommended: `SelectPanel.SearchInput`"
}
]
},
{
"name": "SelectPanel.SearchInput",
"props": [
{
"name": "onChange",
"type": "React.ChangeEventHandler<HTMLInputElement>",
"description": "Callback when input text changes, use this for search/filter"
},
{
"name": "loading",
"type": "boolean",
"description": "Useful for subtle loading states while fetching items asynchronously"
}
],
"passthrough": {
"element": "TextInput",
"url": "/react/TextInput"
}
},
{
"name": "SelectPanel.Footer",
"props": [
{
"name": "children",
"type": "React.ReactNode",
"description": "Optional: `<SelectPanel.SecondaryButton>`"
}
]
},
{
"name": "SelectPanel.Loading",
"props": [
{
"name": "children",
"type": "string"
}
]
},
{
"name": "SelectPanel.Message",
"props": [
{
"name": "variant",
"type": "'warning' | 'error' | 'empty'"
},
{
"name": "size",
"type": "'inline' | 'full'"
},
{
"name": "title",
"type": "string",
"description": "`inline` variant does not accept `title`"
},
{
"name": "children",
"type": "React.ReactNode"
}
]
}
]
}

0 comments on commit 88f594d

Please sign in to comment.