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

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.
@@ -0,0 +1,399 @@
1
+ /**
2
+ * Lookup table for component type sources.
3
+ *
4
+ * FUTURE: We should use code generation to generate this lookup table.
5
+ */
6
+ const componentSourceLookup = {
7
+ Accordion: {
8
+ exportName: 'AccordionProps',
9
+ exportPath: '.',
10
+ },
11
+ Alert: {
12
+ exportName: 'AlertProps',
13
+ exportPath: '.',
14
+ },
15
+ AutoGrid: {
16
+ exportName: 'AutoGridProps',
17
+ exportPath: '.',
18
+ },
19
+ BarChart: {
20
+ exportName: 'BarChartProps',
21
+ exportPath: '.',
22
+ },
23
+ Box: {
24
+ exportName: 'BoxProps',
25
+ exportPath: '.',
26
+ },
27
+ Button: {
28
+ exportName: 'ButtonProps',
29
+ exportPath: '.',
30
+ },
31
+ ButtonRow: {
32
+ exportName: 'ButtonRowProps',
33
+ exportPath: '.',
34
+ },
35
+ Card: {
36
+ exportName: 'CardProps',
37
+ exportPath: '.',
38
+ },
39
+ Center: {
40
+ exportName: 'CenterProps',
41
+ exportPath: './experimental',
42
+ },
43
+ Checkbox: {
44
+ exportName: 'CheckboxProps',
45
+ exportPath: '.',
46
+ },
47
+ CrmActionButton: {
48
+ exportName: 'CrmActionButtonProps',
49
+ exportPath: './crm',
50
+ },
51
+ CrmActionLink: {
52
+ exportName: 'CrmActionLinkProps',
53
+ exportPath: './crm',
54
+ },
55
+ CrmAssociationPivot: {
56
+ exportName: 'CrmAssociationPivotProps',
57
+ exportPath: './crm',
58
+ },
59
+ CrmAssociationPropertyList: {
60
+ exportName: 'CrmAssociationPropertyListProps',
61
+ exportPath: './crm',
62
+ },
63
+ CrmAssociationStageTracker: {
64
+ exportName: 'CrmAssociationStageTrackerProps',
65
+ exportPath: './crm',
66
+ },
67
+ CrmAssociationTable: {
68
+ exportName: 'CrmAssociationTableProps',
69
+ exportPath: './crm',
70
+ },
71
+ CrmCardActions: {
72
+ exportName: 'CrmCardActionsProps',
73
+ exportPath: './crm',
74
+ },
75
+ CrmDataHighlight: {
76
+ exportName: 'CrmDataHighlightProps',
77
+ exportPath: './crm',
78
+ },
79
+ CrmPropertyList: {
80
+ exportName: 'CrmPropertyListProps',
81
+ exportPath: './crm',
82
+ },
83
+ CrmReport: {
84
+ exportName: 'CrmReportProps',
85
+ exportPath: './crm',
86
+ },
87
+ CrmSimpleDeadline: {
88
+ exportName: 'CrmSimpleDeadlineProps',
89
+ exportPath: './crm',
90
+ },
91
+ CrmStageTracker: {
92
+ exportName: 'CrmStageTrackerProps',
93
+ exportPath: './crm',
94
+ },
95
+ CrmStatistics: {
96
+ exportName: 'CrmStatisticsProps',
97
+ exportPath: './crm',
98
+ },
99
+ CurrencyInput: {
100
+ exportName: 'CurrencyInputProps',
101
+ exportPath: '.',
102
+ },
103
+ DateInput: {
104
+ exportName: 'DateInputProps',
105
+ exportPath: '.',
106
+ },
107
+ DescriptionList: {
108
+ exportName: 'DescriptionListProps',
109
+ exportPath: '.',
110
+ },
111
+ DescriptionListItem: {
112
+ exportName: 'DescriptionListItemProps',
113
+ exportPath: '.',
114
+ },
115
+ Divider: {
116
+ exportName: 'DividerProps',
117
+ exportPath: '.',
118
+ },
119
+ Dropdown: {
120
+ exportName: 'DropdownProps',
121
+ exportPath: '.',
122
+ },
123
+ DropdownButtonItem: {
124
+ exportName: 'DropdownButtonItemProps',
125
+ exportPath: '.',
126
+ },
127
+ EmptyState: {
128
+ exportName: 'EmptyStateProps',
129
+ exportPath: '.',
130
+ },
131
+ ErrorState: {
132
+ exportName: 'ErrorStateProps',
133
+ exportPath: '.',
134
+ },
135
+ ExpandableText: {
136
+ exportName: 'ExpandableTextProps',
137
+ exportPath: './experimental',
138
+ },
139
+ FileInput: {
140
+ exportName: 'FileInputProps',
141
+ exportPath: './experimental',
142
+ },
143
+ Flex: {
144
+ exportName: 'FlexProps',
145
+ exportPath: '.',
146
+ },
147
+ Form: {
148
+ exportName: 'FormProps',
149
+ exportPath: '.',
150
+ },
151
+ Grid: {
152
+ exportName: 'GridProps',
153
+ exportPath: './experimental',
154
+ },
155
+ GridItem: {
156
+ exportName: 'GridItemProps',
157
+ exportPath: './experimental',
158
+ },
159
+ HeaderActions: {
160
+ exportName: 'HeaderActionsProps',
161
+ exportPath: '.',
162
+ },
163
+ Heading: {
164
+ exportName: 'HeadingProps',
165
+ exportPath: '.',
166
+ },
167
+ Icon: {
168
+ exportName: 'IconProps',
169
+ exportPath: '.',
170
+ },
171
+ Iframe: {
172
+ exportName: 'IframeProps',
173
+ exportPath: '.',
174
+ },
175
+ Illustration: {
176
+ exportName: 'IllustrationProps',
177
+ exportPath: '.',
178
+ },
179
+ Image: {
180
+ exportName: 'ImageProps',
181
+ exportPath: '.',
182
+ },
183
+ Inline: {
184
+ exportName: 'InlineProps',
185
+ exportPath: '.',
186
+ },
187
+ Input: {
188
+ exportName: 'InputProps',
189
+ exportPath: '.',
190
+ },
191
+ LineChart: {
192
+ exportName: 'LineChartProps',
193
+ exportPath: '.',
194
+ },
195
+ Link: {
196
+ exportName: 'LinkProps',
197
+ exportPath: '.',
198
+ },
199
+ List: {
200
+ exportName: 'ListProps',
201
+ exportPath: '.',
202
+ },
203
+ LoadingButton: {
204
+ exportName: 'LoadingButtonProps',
205
+ exportPath: '.',
206
+ },
207
+ LoadingSpinner: {
208
+ exportName: 'LoadingSpinnerProps',
209
+ exportPath: '.',
210
+ },
211
+ MediaObject: {
212
+ exportName: 'MediaObjectProps',
213
+ exportPath: './experimental',
214
+ },
215
+ Modal: {
216
+ exportName: 'ModalProps',
217
+ exportPath: '.',
218
+ },
219
+ ModalBody: {
220
+ exportName: 'ModalBodyProps',
221
+ exportPath: '.',
222
+ },
223
+ ModalFooter: {
224
+ exportName: 'ModalFooterProps',
225
+ exportPath: '.',
226
+ },
227
+ MultiSelect: {
228
+ exportName: 'MultiSelectProps',
229
+ exportPath: '.',
230
+ },
231
+ NumberInput: {
232
+ exportName: 'NumberInputProps',
233
+ exportPath: '.',
234
+ },
235
+ Panel: {
236
+ exportName: 'PanelProps',
237
+ exportPath: '.',
238
+ },
239
+ PanelBody: {
240
+ exportName: 'PanelBodyProps',
241
+ exportPath: '.',
242
+ },
243
+ PanelFooter: {
244
+ exportName: 'PanelFooterProps',
245
+ exportPath: '.',
246
+ },
247
+ PanelSection: {
248
+ exportName: 'PanelSectionProps',
249
+ exportPath: '.',
250
+ },
251
+ Popover: {
252
+ exportName: 'PopoverProps',
253
+ exportPath: './experimental',
254
+ },
255
+ PrimaryHeaderActionButton: {
256
+ exportName: 'HeaderActionButtonProps',
257
+ exportPath: '.',
258
+ },
259
+ ProgressBar: {
260
+ exportName: 'ProgressBarProps',
261
+ exportPath: '.',
262
+ },
263
+ RadioButton: {
264
+ exportName: 'RadioButtonProps',
265
+ exportPath: '.',
266
+ },
267
+ ScoreCircle: {
268
+ exportName: 'ScoreProps',
269
+ exportPath: '.',
270
+ },
271
+ SearchInput: {
272
+ exportName: 'SearchInputProps',
273
+ exportPath: '.',
274
+ },
275
+ SecondaryHeaderActionButton: {
276
+ exportName: 'HeaderActionButtonProps',
277
+ exportPath: '.',
278
+ },
279
+ Select: {
280
+ exportName: 'SelectProps',
281
+ exportPath: '.',
282
+ },
283
+ SettingsView: {
284
+ exportName: 'SettingsViewProps',
285
+ exportPath: './experimental',
286
+ },
287
+ Stack2: {
288
+ exportName: 'Stack2Props',
289
+ exportPath: './experimental',
290
+ },
291
+ Statistics: {
292
+ exportName: 'StatisticsProps',
293
+ exportPath: '.',
294
+ },
295
+ StatisticsItem: {
296
+ exportName: 'StatisticsItemProps',
297
+ exportPath: '.',
298
+ },
299
+ StatisticsTrend: {
300
+ exportName: 'StatisticsTrendProps',
301
+ exportPath: '.',
302
+ },
303
+ StatusTag: {
304
+ exportName: 'StatusTagProps',
305
+ exportPath: '.',
306
+ },
307
+ StepIndicator: {
308
+ exportName: 'StepIndicatorProps',
309
+ exportPath: '.',
310
+ },
311
+ StepperInput: {
312
+ exportName: 'StepperInputProps',
313
+ exportPath: '.',
314
+ },
315
+ Tab: {
316
+ exportName: 'TabProps',
317
+ exportPath: '.',
318
+ },
319
+ Table: {
320
+ exportName: 'TableProps',
321
+ exportPath: '.',
322
+ },
323
+ TableBody: {
324
+ exportName: 'TableElementProps',
325
+ exportPath: '.',
326
+ },
327
+ TableCell: {
328
+ exportName: 'TableCellProps',
329
+ exportPath: '.',
330
+ },
331
+ TableFooter: {
332
+ exportName: 'TableElementProps',
333
+ exportPath: '.',
334
+ },
335
+ TableHead: {
336
+ exportName: 'TableElementProps',
337
+ exportPath: '.',
338
+ },
339
+ TableHeader: {
340
+ exportName: 'TableHeaderProps',
341
+ exportPath: '.',
342
+ },
343
+ TableRow: {
344
+ exportName: 'TableElementProps',
345
+ exportPath: '.',
346
+ },
347
+ Tabs: {
348
+ exportName: 'TabsProps',
349
+ exportPath: '.',
350
+ },
351
+ Tag: {
352
+ exportName: 'TagProps',
353
+ exportPath: '.',
354
+ },
355
+ Text: {
356
+ exportName: 'TextProps',
357
+ exportPath: '.',
358
+ },
359
+ TextArea: {
360
+ exportName: 'TextAreaProps',
361
+ exportPath: '.',
362
+ },
363
+ Tile: {
364
+ exportName: 'TileProps',
365
+ exportPath: '.',
366
+ },
367
+ TimeInput: {
368
+ exportName: 'TimeInputProps',
369
+ exportPath: '.',
370
+ },
371
+ Toggle: {
372
+ exportName: 'ToggleProps',
373
+ exportPath: '.',
374
+ },
375
+ ToggleGroup: {
376
+ exportName: 'ToggleGroupProps',
377
+ exportPath: '.',
378
+ },
379
+ Tooltip: {
380
+ exportName: 'TooltipProps',
381
+ exportPath: '.',
382
+ },
383
+ };
384
+ /**
385
+ * Gets the type source for a component.
386
+ *
387
+ * The component type source is the name of the export and the path the
388
+ * export is exported from for the `@hubspot/ui-extensions` package.
389
+ *
390
+ * @param componentName - The name of the component to get the type source for
391
+ * @returns The type source for the component
392
+ */
393
+ export const getComponentTypeSource = (componentName) => {
394
+ const componentSource = componentSourceLookup[componentName];
395
+ if (!componentSource) {
396
+ throw new Error(`Invalid component name: ${componentName}`);
397
+ }
398
+ return componentSource;
399
+ };
@@ -0,0 +1,31 @@
1
+ import { AnalyzeResultReader, ApiNode } from '@hubspot/ts-export-types-reader';
2
+ /**
3
+ * Context object passed through the type rendering functions.
4
+ *
5
+ * This context maintains state needed for rendering types correctly:
6
+ * - typesReader: The reader for looking up referenced types
7
+ * - typePath: An array tracking the current path of type nodes being rendered,
8
+ * used to detect actual circular references (not just repeated types)
9
+ */
10
+ export interface RenderTypeContext {
11
+ typesReader: AnalyzeResultReader;
12
+ typePath: ApiNode[];
13
+ }
14
+ /**
15
+ * Renders a prop's type as an HTML string.
16
+ *
17
+ * This function handles the special case of union types in props, which need
18
+ * to be rendered recursively. All types are wrapped in HTML code tags for
19
+ * proper HTML rendering.
20
+ *
21
+ * @param context - The rendering context containing the types reader
22
+ * @param propType - The API node representing the prop's type
23
+ * @returns An HTML string representation of the type (wrapped in code tags)
24
+ *
25
+ * @example
26
+ * ```typescript
27
+ * renderPropTypeToHtml(context, stringNode) // Returns: "<code>string</code>"
28
+ * renderPropTypeToHtml(context, unionNode) // Returns: "<code>boolean</code> | <code>number</code> | <code>string</code>"
29
+ * ```
30
+ */
31
+ export declare const renderPropTypeToJsx: (context: RenderTypeContext, propType: ApiNode) => string;