@hubspot/ui-extensions-sdk-api-metadata 0.11.6 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![npm version](https://img.shields.io/npm/v/@hubspot/ui-extensions-sdk-api-metadata.svg)](https://www.npmjs.com/package/@hubspot/ui-extensions-sdk-api-metadata)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
- This package provides machine-readable API metadata for the [HubSpot UI Extensions SDK](https://www.npmjs.com/package/@hubspot/ui-extensions). It contains extracted TypeScript type information for component props and other exported types from the SDK.
6
+ This package provides structured component props documentation for the [HubSpot UI Extensions SDK](https://www.npmjs.com/package/@hubspot/ui-extensions). It extracts TypeScript type information from SDK components and converts it into a documentation-friendly format with rendered HTML suitable for embedding in documentation sites.
7
7
 
8
8
  ## ⚠️ Internal Use Only
9
9
 
@@ -11,7 +11,7 @@ This package provides machine-readable API metadata for the [HubSpot UI Extensio
11
11
 
12
12
  ## Purpose
13
13
 
14
- This package currently serves as a data source for documentation generation tools. In the future, it may be used by other tools that need programmatic access to SDK type information.
14
+ This package serves as a data source for documentation generation tools, providing structured documentation for component props including type information, descriptions, default values, and related links.
15
15
 
16
16
  ## Installation
17
17
 
@@ -22,27 +22,54 @@ npm install @hubspot/ui-extensions-sdk-api-metadata
22
22
  ## Usage
23
23
 
24
24
  ```typescript
25
- import { componentPropsReader } from '@hubspot/ui-extensions-sdk-api-metadata/component-props';
26
-
27
- // Find a specific component's props by export name
28
- const buttonProps = componentPropsReader.findExportByName({
29
- exportName: 'ButtonProps',
25
+ import {
26
+ getComponentPropsDocumentation,
27
+ ComponentName,
28
+ } from '@hubspot/ui-extensions-sdk-api-metadata';
29
+
30
+ // Get documentation for a specific component's props
31
+ const accordionPropsDocs = getComponentPropsDocumentation(
32
+ ComponentName.Accordion
33
+ );
34
+
35
+ // Each prop documentation includes:
36
+ accordionPropsDocs.forEach((propDoc) => {
37
+ console.log(propDoc.name); // Prop name (e.g., "open")
38
+ console.log(propDoc.required); // Whether the prop is required
39
+ console.log(propDoc.typeJsx); // Type as JSX string (e.g., "<><code>boolean</code></>")
40
+ console.log(propDoc.descriptionJsx); // Description as JSX string
41
+ console.log(propDoc.defaultValueJsx); // Optional default value as JSX string
42
+ console.log(propDoc.seeJsxItems); // Optional array of related links as JSX strings
30
43
  });
31
-
32
- // Look up a referenced type by its ID
33
- const referencedType = componentPropsReader.findReferencedTypeById(typeId);
34
44
  ```
35
45
 
36
46
  ## API
37
47
 
38
- The package exports a `componentPropsReader` object implementing the `AnalyzeResultReader` interface:
48
+ ### `getComponentPropsDocumentation(componentName: ComponentName): ComponentPropDocumentation[]`
49
+
50
+ Retrieves structured documentation for all props of the specified component.
51
+
52
+ **Parameters:**
53
+ - `componentName` - The component to get documentation for (from the `ComponentName` enum)
54
+
55
+ **Returns:** An array of `ComponentPropDocumentation` objects, sorted with required props first, then alphabetically by name.
56
+
57
+ ### `ComponentPropDocumentation`
58
+
59
+ Interface for component prop documentation:
60
+
61
+ | Property | Type | Description |
62
+ |----------|------|-------------|
63
+ | `name` | `string` | The name of the prop |
64
+ | `required` | `boolean` | Whether the prop is required |
65
+ | `typeJsx` | `string` | The type rendered as JSX-embeddable HTML |
66
+ | `descriptionJsx` | `string` | The description rendered as JSX-embeddable HTML |
67
+ | `defaultValueJsx?` | `string` | Optional default value rendered as JSX-embeddable HTML |
68
+ | `seeJsxItems?` | `string[]` | Optional array of related links rendered as JSX-embeddable HTML |
39
69
 
40
- | Method | Description |
41
- |--------|-------------|
42
- | `findExportByName(options)` | Finds an export by its name and path |
43
- | `findReferencedTypeById(typeId)` | Finds a referenced type by its unique identifier |
70
+ ### `ComponentName`
44
71
 
45
- See [`@hubspot/ts-export-types-reader`](https://www.npmjs.com/package/@hubspot/ts-export-types-reader) for more details.
72
+ Enum of available component names in the SDK (e.g., `ComponentName.Accordion`).
46
73
 
47
74
  ## Related Packages
48
75