docs: generate documentation for UI components (#5849)

* added tool to generate spec files for React components

* use typedoc for missing descriptions and types

* improvements and fixes

* improvements

* added doc comments for half of the components

* add custom resolver + more doc comments

* added all tsdocs

* general improvements

* add specs to UI docs

* added github action

* remove unnecessary api route

* Added readme for react-docs-generator

* remove comment

* Update packages/design-system/ui/src/components/currency-input/currency-input.tsx

Co-authored-by: Kasper Fabricius Kristensen <45367945+kasperkristensen@users.noreply.github.com>

* remove description of aria fields + add generate script

---------

Co-authored-by: Kasper Fabricius Kristensen <45367945+kasperkristensen@users.noreply.github.com>
This commit is contained in:
Shahed Nasser
2023-12-13 16:02:41 +02:00
committed by GitHub
parent edc49bfe1d
commit 245e5c9a69
288 changed files with 6029 additions and 1447 deletions

View File

@@ -25,6 +25,4 @@ import { Avatar } from "@medusajs/ui"
---
This component is based on the [Radix UI Avatar](https://www.radix-ui.com/primitives/docs/components/avatar) primitive.
<ComponentProps component="avatar" />
<ComponentReference mainComponent="Avatar" />

View File

@@ -22,9 +22,7 @@ import { Badge } from "@medusajs/ui"
---
This component is based on the `div` element and supports all props of this element.
<ComponentProps component="badge" />
<ComponentReference mainComponent="Badge" />
## Examples

View File

@@ -22,9 +22,7 @@ import { Button } from "@medusajs/ui"
---
This component is based on the `button` element and supports all props of this element.
<ComponentProps component="button" />
<ComponentReference mainComponent="Button" />
## Examples

View File

@@ -22,9 +22,7 @@ import { Calendar } from "@medusajs/ui"
---
This component is based on the [react-date-picker](https://www.npmjs.com/package/react-date-picker) package.
<ComponentProps component="calendar" />
<ComponentReference mainComponent="Calendar" />
## Examples

View File

@@ -22,7 +22,7 @@ import { Checkbox } from "@medusajs/ui"
---
This component is based on the [Radix UI Checkbox](https://www.radix-ui.com/primitives/docs/components/checkbox) primitive.
<ComponentReference mainComponent="Checkbox" />
## Examples

View File

@@ -34,25 +34,12 @@ import { CodeBlock } from "@medusajs/ui"
---
### CodeBlock
This component is based on the `div` element and supports all props of this element.
<ComponentProps component="code-block" />
### CodeBlock.Header
This component is based on the `div` element and supports all props of this element.
<ComponentProps component="code-block-header" />
### CodeBlock.Header.Meta
This component is based on the `div` element and supports all props of this element.
### CodeBlock.Body
This component is based on the `div` element and supports all props of this element.
<ComponentReference mainComponent="CodeBlock" componentsToShow={[
"CodeBlock",
"CodeBlock.Header",
"CodeBlock.Header.Meta",
"CodeBlock.Body"
]} />
## Examples

View File

@@ -38,26 +38,10 @@ import { CommandBar } from "@medusajs/ui"
---
### CommandBar
The root component of the command bar. This component manages the state of the command bar.
<ComponentProps component="command-bar" />
### CommandBar.Bar
The bar component of the command bar. This component is used to display the commands.
### CommandBar.Value
The value component of the command bar. This component is used to display a value, such as the number of selected items which the commands will act on.
### CommandBar.Seperator
The seperator component of the command bar. This component is used to display a seperator between commands.
### CommandBar.Command
The command component of the command bar. This component is used to display a command, as well as registering the keyboad shortcut.
<ComponentProps component="command-bar-command" />
<ComponentReference mainComponent="CommandBar" componentsToShow={[
"CommandBar",
"CommandBar.Bar",
"CommandBar.Value",
"CommandBar.Seperator",
"CommandBar.Command"
]} />

View File

@@ -24,4 +24,4 @@ import { Command } from "@medusajs/ui"
---
This component is based on the `div` element and supports all props of this element.
<ComponentReference mainComponent="Command" />

View File

@@ -22,7 +22,7 @@ import { Container } from "@medusajs/ui"
---
This component is based on the `div` element and supports all props of this element.
<ComponentReference mainComponent="Container" />
## Examples

View File

@@ -22,9 +22,7 @@ import { Copy } from "@medusajs/ui"
---
This component is based on the `button` element and supports all props of this element.
<ComponentProps component="copy" />
<ComponentReference mainComponent="Copy" />
## Examples

View File

@@ -22,9 +22,7 @@ import { CurrencyInput } from "@medusajs/ui"
---
This component is based on the `input` element and supports all props of this element.
<ComponentProps component="currency-input" />
<ComponentReference mainComponent="CurrencyInput" />
## Examples

View File

@@ -22,9 +22,7 @@ import { DatePicker } from "@medusajs/ui"
---
This component is based on the [Calendar](/components/calendar) component and [Radix UI Popover](https://www.radix-ui.com/primitives/docs/components/popover).
<ComponentProps component="date-picker" />
<ComponentReference mainComponent="DatePicker" />
## Examples

View File

@@ -31,4 +31,4 @@ import { Drawer } from "@medusajs/ui"
---
This component is based on the [Radix UI Dialog](https://www.radix-ui.com/primitives/docs/components/dialog) primitives.
<ComponentReference mainComponent="Drawer" />

View File

@@ -29,15 +29,11 @@ import { DropdownMenu } from "@medusajs/ui"
---
This component is based on the [Radix UI Dropdown Menu](https://www.radix-ui.com/primitives/docs/components/dropdown-menu) primitive.
### DropdownMenu.Shortcut
This component is based on the `span` element and supports all props of this element.
### DropdownMenu.Hint
This component is based on the `span` element and supports all props of this element.
<ComponentReference mainComponent="DropdownMenu" componentsToShow={[
"DropdownMenu",
"DropdownMenu.Shortcut",
"DropdownMenu.Hint",
]} />
## Examples

View File

@@ -28,17 +28,11 @@ import { FocusModal } from "@medusajs/ui"
---
This component is based on the [Radix UI Dialog](https://www.radix-ui.com/primitives/docs/components/dialog) primitives.
<ComponentProps component="focus-modal" />
### FocusModal.Header
This component is based on the `div` element and supports all props of this element.
### FocusModal.Body
This component is based on the `div` element and supports all props of this element.
<ComponentReference mainComponent="FocusModal" componentsToShow={[
"FocusModal",
"FocusModal.Header",
"FocusModal.Body",
]} />
## Example: Control Open State

View File

@@ -22,6 +22,4 @@ import { Heading } from "@medusajs/ui"
---
This component is based on the `heading` element and supports all props of this element.
<ComponentProps component="heading" />
<ComponentReference mainComponent="Heading" />

View File

@@ -25,9 +25,7 @@ import { BuildingTax } from "@medusajs/icons"
---
This component is based on the `span` element and supports all props of this element.
<ComponentProps component="icon-badge" />
<ComponentReference mainComponent="IconBadge" />
## Examples

View File

@@ -25,9 +25,7 @@ import { Plus } from "@medusajs/icons"
---
This component is based on the `button` element and supports all props of this element.
<ComponentProps component="icon-button" />
<ComponentReference mainComponent="IconButton" />
## Examples

View File

@@ -22,9 +22,7 @@ import { Input } from "@medusajs/ui"
---
This component is based on the `input` element and supports all props of this element.
<ComponentProps component="input" />
<ComponentReference mainComponent="Input" />
## Examples

View File

@@ -23,4 +23,4 @@ import { Kbd } from "@medusajs/ui"
---
This component is based on the `kbd` element and supports all props of this element.
<ComponentReference mainComponent="Kbd" />

View File

@@ -23,9 +23,7 @@ import { Label } from "@medusajs/ui"
---
This component is based on the [Radix UI Label](https://www.radix-ui.com/primitives/docs/components/label) primitive.
<ComponentProps component="label" />
<ComponentReference mainComponent="Label" />
## Examples

View File

@@ -39,13 +39,10 @@ import { ProgressAccordion } from "@medusajs/ui"
---
This component is based on the [Radix UI Accordion](https://radix-ui.com/primitives/docs/components/accordion) primitves.
### ProgressAccordion.Header
---
<ComponentProps component="progress-accordion-header" />
<ComponentReference mainComponent="ProgressAccordion" componentsToShow={[
"ProgressAccordion",
"ProgressAccordion.Header"
]} />
## Examples

View File

@@ -43,8 +43,7 @@ import { ProgressTabs } from "@medusajs/ui"
---
This component is based on the [Radix UI Tabs](https://radix-ui.com/primitives/docs/components/tabs) primitves.
### ProgressAccordion.Header
<ComponentProps component="progress-tabs-trigger" />
<ComponentReference mainComponent="ProgressTabs" componentsToShow={[
"ProgressTabs",
"ProgressTabs.ProgressIndicator"
]} />

View File

@@ -34,12 +34,8 @@ import { Prompt } from "@medusajs/ui"
---
This component is based on the [Radix UI Alert Dialog](https://www.radix-ui.com/primitives/docs/components/alert-dialog) primitives.
### Prompt.Header
This component is based on the `div` element and supports all props of this element.
### Prompt.Footer
This component is based on the `div` element and supports all props of this element.
<ComponentReference mainComponent="Prompt" componentsToShow={[
"Prompt",
"Prompt.Header",
"Prompt.Footer"
]} />

View File

@@ -26,7 +26,7 @@ import { RadioGroup } from "@medusajs/ui"
---
This component is based on the [Radix UI Radio Group](https://www.radix-ui.com/primitives/docs/components/radio-group) primitives.
<ComponentReference mainComponent="RadioGroup" />
## Examples

View File

@@ -33,37 +33,14 @@ import { Select } from "@medusajs/ui"
---
This component is based on [Radix UI Select](https://www.radix-ui.com/primitives/docs/components/select).
### Select
Contains all the parts of the select component.
<ComponentProps component="select" />
### Select.Trigger
The trigger that toggles the select.
### Select.Value
Displays the selected value, or a placeholder if no value is selected.
<ComponentProps component="select-value" />
### Select.Group
Groups multiple items together.
### Select.Label
Used to label a group of items.
### Select.Item
An item in the select.
<ComponentProps component="select-item" />
<ComponentReference mainComponent="Select" componentsToShow={[
"Select",
"Select.Trigger",
"Select.Value",
"Select.Group",
"Select.Label",
"Select.Item"
]} />
## Examples

View File

@@ -22,9 +22,7 @@ import { StatusBadge } from "@medusajs/ui"
---
This component is based on the `span` element and supports all props of this element.
<ComponentProps component="status-badge" />
<ComponentReference mainComponent="StatusBadge" />
## Examples

View File

@@ -22,9 +22,7 @@ import { Switch } from "@medusajs/ui"
---
This component is based on the [Radix UI Switch](https://www.radix-ui.com/primitives/docs/components/switch) primitive.
<ComponentProps component="switch" />
<ComponentReference mainComponent="Switch" />
## Examples

View File

@@ -36,17 +36,7 @@ import { Table } from "@medusajs/ui"
---
This component is based on the `table` element and its various children, and supports all props of those elements.
- `Table`: `table`
- `Table.Header`: `thead`
- `Table.Row`: `tr`
- `Table.HeaderCell`: `th`
- `Table.Body`: `tbody`
- `Table.Cell`: `td`
### Pagination
This component is based on the `div` element and supports all props of this element.
<ComponentProps component="table-pagination" />
<ComponentReference mainComponent="Table" componentsToShow={[
"Table",
"Table.Pagination"
]} />

View File

@@ -31,4 +31,4 @@ import { Tabs } from "@medusajs/ui"
---
This component is based on the [Radix UI Tabs](https://radix-ui.com/primitives/docs/components/tabs) primitves
<ComponentReference mainComponent="Tabs" />

View File

@@ -23,9 +23,7 @@ import { Text } from "@medusajs/ui"
---
This component is based on the `p` element and supports all props of this element.
<ComponentProps component="text" />
<ComponentReference mainComponent="Text" />
## Examples

View File

@@ -22,4 +22,4 @@ import { Textarea } from "@medusajs/ui"
---
This component is based on the `textarea` element and supports all props of this element.
<ComponentReference mainComponent="Textarea" />

View File

@@ -46,7 +46,7 @@ return (
## API Reference
This component is based on the [Radix UI Toast](https://www.radix-ui.com/primitives/docs/components/toast) primitives.
<ComponentReference mainComponent="Toast" />
## Examples

View File

@@ -22,6 +22,4 @@ import { Tooltip } from "@medusajs/ui"
---
This component is based on the [Radix UI Tooltip](https://www.radix-ui.com/primitives/docs/components/tooltip) primitive.
<ComponentProps component="tooltip" />
<ComponentReference mainComponent="Tooltip" />