Skip to content

Commit 1daf88f

Browse files
authored
Autogenerate UI adapter props with ts-morph (#315)
chore: add autogenerated docs for component adapters
1 parent f81f0fa commit 1daf88f

File tree

9 files changed

+1206
-562
lines changed

9 files changed

+1206
-562
lines changed

build/generateAdapterPropDocs.ts

Lines changed: 578 additions & 0 deletions
Large diffs are not rendered by default.

docs/06/01/component-inventory.md

Lines changed: 501 additions & 449 deletions
Large diffs are not rendered by default.

package-lock.json

Lines changed: 118 additions & 87 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"build:ci": "npm run build && npm run lint:check && npm run format:check && npm run test:ci",
3333
"build:clean": "rm -rf ./dist && mkdir ./dist",
3434
"commitlint": "commitlint --edit",
35+
"adapter:docs:generate": "npx tsx ./build/generateAdapterPropDocs.ts",
3536
"watch:vite": "vite build --watch --mode development",
3637
"watch:translations": "node ./build/translationWatcher.js",
3738
"dev": "node ./build/prompt.js && npm run i18n:generate && npm-run-all --parallel watch:vite watch:translations",
@@ -78,6 +79,7 @@
7879
"npm-run-all": "^4.1.5",
7980
"prettier": "^3.5.3",
8081
"sass-embedded": "^1.87.0",
82+
"ts-morph": "^26.0.0",
8183
"tsx": "^4.19.3",
8284
"typescript-eslint": "^8.31.0",
8385
"vite": "^5.4.18",

src/components/Common/UI/Button/ButtonTypes.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
import type { Ref, ButtonHTMLAttributes, ReactNode, FocusEvent } from 'react'
22

3-
// Define event handler types that are compatible with both HTML elements and React Aria
4-
type ButtonFocusHandler = (e: FocusEvent) => void
5-
63
export interface ButtonProps
74
extends Pick<
85
ButtonHTMLAttributes<HTMLButtonElement>,
@@ -47,11 +44,11 @@ export interface ButtonProps
4744
/**
4845
* Handler for blur events
4946
*/
50-
onBlur?: ButtonFocusHandler
47+
onBlur?: (e: FocusEvent) => void
5148
/**
5249
* Handler for focus events
5350
*/
54-
onFocus?: ButtonFocusHandler
51+
onFocus?: (e: FocusEvent) => void
5552
}
5653

5754
export type ButtonIconProps = Omit<ButtonProps, 'variant'> & {

src/components/Common/UI/CheckboxGroup/CheckboxGroupTypes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { FieldsetHTMLAttributes, Ref } from 'react'
22
import type { SharedFieldLayoutProps } from '@/components/Common/FieldLayout/FieldLayoutTypes'
33

4-
export type CheckboxGroupOption = {
4+
export interface CheckboxGroupOption {
55
/**
66
* Label text or content for the checkbox option
77
*/

src/components/Common/UI/List/ListTypes.ts

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { HTMLAttributes, ReactNode } from 'react'
1+
import type { ReactNode } from 'react'
22

33
// Base list props without HTML element specific attributes
44
export interface BaseListProps {
@@ -28,12 +28,6 @@ export interface BaseListProps {
2828
'aria-describedby'?: string
2929
}
3030

31-
// UnorderedList specific props with HTMLUListElement attributes
32-
export interface UnorderedListProps extends BaseListProps, HTMLAttributes<HTMLUListElement> {
33-
// Unordered list specific props
34-
}
31+
export type UnorderedListProps = BaseListProps
3532

36-
// OrderedList specific props with HTMLOListElement attributes
37-
export interface OrderedListProps extends BaseListProps, HTMLAttributes<HTMLOListElement> {
38-
// Ordered list specific props
39-
}
33+
export type OrderedListProps = BaseListProps

src/components/Common/UI/RadioGroup/RadioGroupTypes.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { FieldsetHTMLAttributes, Ref } from 'react'
22
import type { SharedFieldLayoutProps } from '@/components/Common/FieldLayout/FieldLayoutTypes'
33

4-
export type RadioGroupOption = {
4+
export interface RadioGroupOption {
55
/**
66
* Label text or content for the radio option
77
*/

typedoc.jsonc

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)