@hubspot/ui-extensions 0.0.1-prealpha.4 → 0.0.1-prealpha.6
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 +188 -10
- package/dist/coreComponents.d.ts +152 -0
- package/dist/coreComponents.js +32 -0
- package/dist/crm/components.d.ts +12 -0
- package/dist/crm/components.js +4 -0
- package/dist/crm/index.d.ts +2 -0
- package/dist/crm/index.js +2 -0
- package/dist/hubspot.d.ts +7 -0
- package/dist/hubspot.js +17 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/types.d.ts +329 -0
- package/dist/types.js +12 -0
- package/dist/utils/createExtensionComponent.d.ts +3 -0
- package/dist/utils/createExtensionComponent.js +4 -0
- package/package.json +6 -5
package/README.md
CHANGED
|
@@ -332,14 +332,14 @@ import { Form } from '@hubspot/ui-extensions';
|
|
|
332
332
|
```typescript
|
|
333
333
|
interface FormProps {
|
|
334
334
|
children: ReactNode;
|
|
335
|
-
onSubmit?: () => void;
|
|
335
|
+
onSubmit?: (event: RemoteEvent<FormInputValues>) => void;
|
|
336
336
|
preventDefault?: boolean;
|
|
337
337
|
}
|
|
338
338
|
```
|
|
339
339
|
| Prop | Type | Default | Description |
|
|
340
340
|
| - | - | - | - |
|
|
341
341
|
| `children` | `ReactNode` | `N/A`| Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. |
|
|
342
|
-
| `onSubmit` | `function(optional)` | `N/A`| A function that will be called when the form is submitted. It will receive
|
|
342
|
+
| `onSubmit` | `function(optional)` | `N/A`| A function that will be called when the form is submitted. It will receive a `RemoteEvent` as argument and it's return value will be ignored. |
|
|
343
343
|
| `preventDefault` | `boolean(optional)` | `false`| If set to `true` `event.preventDefault()` will be invoked before your `onSubmit` function is called, preventing the default html form behavior. |
|
|
344
344
|
|
|
345
345
|
##### Usage
|
|
@@ -362,6 +362,95 @@ const Extension = () => {
|
|
|
362
362
|
}
|
|
363
363
|
```
|
|
364
364
|
|
|
365
|
+
### EmptyState
|
|
366
|
+
|
|
367
|
+
##### Import
|
|
368
|
+
```javascript
|
|
369
|
+
import { EmptyState } from '@hubspot/ui-extensions';
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
##### Props
|
|
373
|
+
```typescript
|
|
374
|
+
interface EmptyStateProps {
|
|
375
|
+
children: ReactNode;
|
|
376
|
+
flush?: boolean;
|
|
377
|
+
imageWidth?: number;
|
|
378
|
+
layout?: 'horizontal' | 'vertical';
|
|
379
|
+
reverseOrder?: boolean;
|
|
380
|
+
title?: string;
|
|
381
|
+
}
|
|
382
|
+
```
|
|
383
|
+
| Prop | Type | Default | Description |
|
|
384
|
+
| - | - | - | - |
|
|
385
|
+
| `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. |
|
|
386
|
+
| `flush` | `boolean(optional)` | `false` | Removes the default vertical margins for the component. |
|
|
387
|
+
| `imageWidth` | `number(optional)` | `250`| The max-width for the image container. |
|
|
388
|
+
| `layout` | `'horizontal' | 'vertical'` `(optional)` | `'horizontal'` | Sets the layout direction for the content. |
|
|
389
|
+
| `reverseOrder` | `boolean(optional)` | `false` | Swaps the visual order of the text (primary) and image (secondary) content. This ensures the primary content is still presented first to assistive technology. |
|
|
390
|
+
| `title` | `string(optional)` | `Intl("All is not lost.")` | The text for the title header rendered above the `children`. |
|
|
391
|
+
|
|
392
|
+
##### Usage
|
|
393
|
+
```javascript
|
|
394
|
+
const Extension = ({ data }) => {
|
|
395
|
+
if (!data || !data.length) {
|
|
396
|
+
return (
|
|
397
|
+
<EmptyState title="Nothing here yet" layout="vertical" reverseOrder={true}>
|
|
398
|
+
<Text text="Go out there and get some leads!" />
|
|
399
|
+
</EmptyState>
|
|
400
|
+
)
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
return (
|
|
404
|
+
<Stack>
|
|
405
|
+
{data.map(...)}
|
|
406
|
+
</Stack>
|
|
407
|
+
);
|
|
408
|
+
}
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
### ErrorState
|
|
412
|
+
|
|
413
|
+
##### Import
|
|
414
|
+
```javascript
|
|
415
|
+
import { ErrorState } from '@hubspot/ui-extensions';
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
##### Props
|
|
419
|
+
```typescript
|
|
420
|
+
interface ErrorStateProps {
|
|
421
|
+
children: ReactNode;
|
|
422
|
+
title?: string;
|
|
423
|
+
type?: 'error' | 'support' | 'lock';
|
|
424
|
+
}
|
|
425
|
+
```
|
|
426
|
+
| Prop | Type | Default | Description |
|
|
427
|
+
| - | - | - | - |
|
|
428
|
+
| `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. |
|
|
429
|
+
| `title` | `string(optional)` | `Intl("All is not lost.")` | The text for the title header rendered above the `children`. |
|
|
430
|
+
| `type` | `'error' | 'support' | 'lock'` `(optional)` | `'error'` | Sets the type of error image that will be shown. |
|
|
431
|
+
|
|
432
|
+
##### Usage
|
|
433
|
+
```javascript
|
|
434
|
+
const Extension = ({ data, error, fetchData }) => {
|
|
435
|
+
if (error) {
|
|
436
|
+
return (
|
|
437
|
+
<ErrorState title="Trouble fetching properties." layout="vertical" reverseOrder={true}>
|
|
438
|
+
<Stack>
|
|
439
|
+
<Text text="Please try again in a few moments." />
|
|
440
|
+
<Button text="Try again" onClick={fetchData} />
|
|
441
|
+
</Stack>
|
|
442
|
+
</ErrorState>
|
|
443
|
+
)
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
return (
|
|
447
|
+
<Stack>
|
|
448
|
+
{data.map(...)}
|
|
449
|
+
</Stack>
|
|
450
|
+
);
|
|
451
|
+
}
|
|
452
|
+
```
|
|
453
|
+
|
|
365
454
|
### Heading
|
|
366
455
|
|
|
367
456
|
##### Import
|
|
@@ -472,9 +561,11 @@ interface InputProps {
|
|
|
472
561
|
tooltip?: string;
|
|
473
562
|
placeholder?: string;
|
|
474
563
|
error?: boolean;
|
|
475
|
-
|
|
476
|
-
onChange
|
|
477
|
-
onInput
|
|
564
|
+
validationMessage?: string;
|
|
565
|
+
onChange?: (value: string) => void;
|
|
566
|
+
onInput?: (value: string) => void;
|
|
567
|
+
onBlur?: (value: string) => void;
|
|
568
|
+
onFocus?: (value: string) => void;
|
|
478
569
|
}
|
|
479
570
|
```
|
|
480
571
|
| Prop | Type | Default | Description |
|
|
@@ -489,8 +580,10 @@ interface InputProps {
|
|
|
489
580
|
| `placeholder` | `string(optional)` | `N/A`| Text that appears in the input when it has no value set. |
|
|
490
581
|
| `error` | `boolean(optional)` | `false`| If set to true, `validationMessage` is displayed as an error message, if it was provided. The input will also render it's error state to let the user know there is an error. If false, `validationMessage` is displayed as a success message. |
|
|
491
582
|
| `validationMessage` | `string(optional)` | `''`| The text to show if the input has an error. |
|
|
492
|
-
| `onChange` | `(value: string) => void` | `N/A`| A callback function that is invoked when the value is committed. Currently these times are `onBlur` of the input and when the user
|
|
493
|
-
| `onInput` | `(value: string) => void` | `N/A`| A function that is called and passed the value every time the field is edited by the user. It is recommended that you do not use this value to update state, that is what `onChange` should be used for. Instead this should be used for validation. |
|
|
583
|
+
| `onChange` | `(value: string) => void(optional)` | `N/A`| A callback function that is invoked when the value is committed. Currently these times are `onBlur` of the input and when the user submits the form. |
|
|
584
|
+
| `onInput` | `(value: string) => void(optional)` | `N/A`| A function that is called and passed the value every time the field is edited by the user. It is recommended that you do not use this value to update state, that is what `onChange` should be used for. Instead this should be used for validation. |
|
|
585
|
+
| `onBlur` | `(value: string) => void(optional)` | `N/A`| A function that is called and passed the value every time the field loses focus. |
|
|
586
|
+
| `onFocus` | `(value: string) => void(optional)` | `N/A`| A function that is called and passed the value every time the field gets focused. |
|
|
494
587
|
|
|
495
588
|
##### Usage
|
|
496
589
|
```javascript
|
|
@@ -698,13 +791,15 @@ import { Stack } from '@hubspot/ui-extensions';
|
|
|
698
791
|
##### Props
|
|
699
792
|
```typescript
|
|
700
793
|
interface StackProps {
|
|
701
|
-
distance?: 'flush' | 'small';
|
|
794
|
+
distance?: 'flush' | 'small' | 'extra-small' | 'medium' | 'large';
|
|
795
|
+
direction?: 'row' | 'column';
|
|
702
796
|
children?: ReactNode;
|
|
703
797
|
}
|
|
704
798
|
```
|
|
705
799
|
| Prop | Type | Default | Description |
|
|
706
800
|
| - | - | - | - |
|
|
707
|
-
| `distance` | `'flush' \| 'small'` | `'small'`| Amount of
|
|
801
|
+
| `distance` | `'flush' \| 'extra-small' \| 'small' \| 'medium' \| 'large'` | `'small'`| Amount of space between each child component passed as children |
|
|
802
|
+
| `direction` | `'row' \| 'column'` | `'column'`| Stacks elements in the vertical or horizontal direction. |
|
|
708
803
|
| `children` | `ReactNode` | `N/A`| Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. |
|
|
709
804
|
|
|
710
805
|
##### Usage
|
|
@@ -833,6 +928,14 @@ interface TableProps {
|
|
|
833
928
|
children: ReactNode;
|
|
834
929
|
flush?: boolean;
|
|
835
930
|
bordered?: boolean;
|
|
931
|
+
paginated?: boolean;
|
|
932
|
+
// if paginated=true
|
|
933
|
+
pageCount: number;
|
|
934
|
+
onPageChange: (pageNumber: number) => void;
|
|
935
|
+
showButtonLabels?: boolean;
|
|
936
|
+
showFirstLastButtons?: boolean;
|
|
937
|
+
maxVisiblePageButtons?: number;
|
|
938
|
+
page?: number;
|
|
836
939
|
}
|
|
837
940
|
```
|
|
838
941
|
| Prop | Type | Default | Description |
|
|
@@ -840,6 +943,19 @@ interface TableProps {
|
|
|
840
943
|
| `children` | `ReactNode` | `N/A`| Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. These children should be [TableHead](#tablehead), [TableFooter](#tablefooter), or [TableBody](#tablebody) |
|
|
841
944
|
| `flush` | `boolean(optional)` | `false`| If true the table will not have bottom margin. |
|
|
842
945
|
| `bordered` | `boolean(optional)` | `true`| If false the table will not haver borders around its content. |
|
|
946
|
+
| `paginated` | `boolean(optional)` | `false`| If true, the table will display the paginator component and consumer will have to provide extra pagination props. |
|
|
947
|
+
|
|
948
|
+
**Props for paginated=true**
|
|
949
|
+
|
|
950
|
+
| Prop | Type | Default | Description |
|
|
951
|
+
| - | - | - | - |
|
|
952
|
+
| `pageCount` | `number` | `N/A`| The total number of pages available |
|
|
953
|
+
| `onPageChange` | `onPageChange: (pageNumber: number) => void` |`N/A`| A function that will be invoked when the pagination button is clicked. It receives the new page number as argument. |
|
|
954
|
+
| `showButtonLabels` | `boolean(optional)` | `true` | if `false`, it hides the text labels for the First/Prev/Next/Last buttons. The button labels will still be accessible for screen readers. |
|
|
955
|
+
| `showFirstLastButtons` | `boolean(optional)` | `false` | if `true`, it displays the First page and Last page buttons. |
|
|
956
|
+
| `maxVisiblePageButtons` | `number(optional)` | `5` | Changes how many page buttons are shown. |
|
|
957
|
+
| `page` | `number(optional)` | `N/A` | Denotes the current page. |
|
|
958
|
+
|
|
843
959
|
|
|
844
960
|
##### Usage
|
|
845
961
|
```javascript
|
|
@@ -861,6 +977,64 @@ const Extension = () => {
|
|
|
861
977
|
</Table>
|
|
862
978
|
);
|
|
863
979
|
}
|
|
980
|
+
|
|
981
|
+
|
|
982
|
+
// Paginated example
|
|
983
|
+
|
|
984
|
+
function generateData(count = 15) {
|
|
985
|
+
const result = [];
|
|
986
|
+
|
|
987
|
+
for (let index = 0; index < count; index++) {
|
|
988
|
+
result.push({
|
|
989
|
+
name: `Jane Doe ${index}`,
|
|
990
|
+
email: `janedoemail${index}@hubspot.com`,
|
|
991
|
+
});
|
|
992
|
+
}
|
|
993
|
+
|
|
994
|
+
return result;
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
function PaginatedTable() {
|
|
998
|
+
const ITEMS_PER_PAGE = 10;
|
|
999
|
+
const data = generateData(30);
|
|
1000
|
+
|
|
1001
|
+
const [currentPage, setCurrentPage] = useState(1);
|
|
1002
|
+
const pageCount = data.length / ITEMS_PER_PAGE;
|
|
1003
|
+
|
|
1004
|
+
const dataToDisplay = data.slice(
|
|
1005
|
+
(currentPage - 1) * ITEMS_PER_PAGE,
|
|
1006
|
+
currentPage * ITEMS_PER_PAGE
|
|
1007
|
+
);
|
|
1008
|
+
|
|
1009
|
+
return (
|
|
1010
|
+
<Table
|
|
1011
|
+
paginated={true}
|
|
1012
|
+
pageCount={pageCount}
|
|
1013
|
+
page={currentPage}
|
|
1014
|
+
onPageChange={(nextPageNumber: number) => {
|
|
1015
|
+
setCurrentPage(nextPageNumber);
|
|
1016
|
+
}}
|
|
1017
|
+
>
|
|
1018
|
+
<TableHead>
|
|
1019
|
+
<TableRow>
|
|
1020
|
+
<TableHeader>Name</TableHeader>
|
|
1021
|
+
<TableHeader>Email</TableHeader>
|
|
1022
|
+
</TableRow>
|
|
1023
|
+
</TableHead>
|
|
1024
|
+
<TableBody>
|
|
1025
|
+
{dataToDisplay.map(({ name, email }) => {
|
|
1026
|
+
console.log(name, email);
|
|
1027
|
+
return (
|
|
1028
|
+
<TableRow key={email}>
|
|
1029
|
+
<TableCell>{name}</TableCell>
|
|
1030
|
+
<TableCell>{email}</TableCell>
|
|
1031
|
+
</TableRow>
|
|
1032
|
+
);
|
|
1033
|
+
})}
|
|
1034
|
+
</TableBody>
|
|
1035
|
+
</Table>
|
|
1036
|
+
);
|
|
1037
|
+
}
|
|
864
1038
|
```
|
|
865
1039
|
### TableBody
|
|
866
1040
|
|
|
@@ -1160,13 +1334,17 @@ interface TextProps {
|
|
|
1160
1334
|
format?: 'plaintext' | 'markdown';
|
|
1161
1335
|
text: string;
|
|
1162
1336
|
variant?: 'bodytext' | 'microcopy';
|
|
1337
|
+
children: ReactNode;
|
|
1338
|
+
tagName?: 'p' | 'span' | 'small';
|
|
1163
1339
|
}
|
|
1164
1340
|
```
|
|
1165
1341
|
| Prop | Type | Default | Description |
|
|
1166
1342
|
| - | - | - | - |
|
|
1167
1343
|
| `format` | `'plaintext' \| 'markdown'` `(optional)`| `'plaintext'`| Type of formatting for the display text. |
|
|
1168
|
-
| `text` | `string` | `N/A`| Text to be displayed as body text
|
|
1344
|
+
| `text` | `string` | `N/A`| Text to be displayed as body text iff format is `"markdown"`. Inline markdown elements (i.e. bold, italics, code, links) are supported |
|
|
1345
|
+
| `children` | `string` | `N/A`| Text to be displayed as body text iff format is `"plaintext"`. |
|
|
1169
1346
|
| `variant` | `'bodytext' \| 'microcopy'` | `'bodytext`| Type of text to display |
|
|
1347
|
+
| `tagName` | `'p' \| 'small' \| 'span'` | `'bodytext`| Type of text element(tag) to display. |
|
|
1170
1348
|
|
|
1171
1349
|
#### Markdown
|
|
1172
1350
|
Markdown syntax supported in the component:
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import type { AlertProps, ButtonProps, ButtonRowProps, CardProps, DescriptionListProps, DescriptionListItemProps, DividerProps, EmptyStateProps, ErrorStateProps, FormProps, HeadingProps, ImageProps, InputProps, LoadingSpinnerProps, ProgressBarProps, SelectProps, TagProps, TextProps, TileProps, StackProps, StatisticsProps, StatisticsItemProps, StatisticsTrendProps, TableProps, TableElementProps } from './types';
|
|
2
|
+
declare const Alert: "Alert" & {
|
|
3
|
+
readonly type?: "Alert" | undefined;
|
|
4
|
+
readonly props?: AlertProps | undefined;
|
|
5
|
+
readonly children?: true | undefined;
|
|
6
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Alert", AlertProps, true>>;
|
|
7
|
+
declare const Button: "Button" & {
|
|
8
|
+
readonly type?: "Button" | undefined;
|
|
9
|
+
readonly props?: ButtonProps | undefined;
|
|
10
|
+
readonly children?: true | undefined;
|
|
11
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Button", ButtonProps, true>>;
|
|
12
|
+
declare const ButtonRow: "ButtonRow" & {
|
|
13
|
+
readonly type?: "ButtonRow" | undefined;
|
|
14
|
+
readonly props?: ButtonRowProps | undefined;
|
|
15
|
+
readonly children?: true | undefined;
|
|
16
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"ButtonRow", ButtonRowProps, true>>;
|
|
17
|
+
declare const Card: "Card" & {
|
|
18
|
+
readonly type?: "Card" | undefined;
|
|
19
|
+
readonly props?: CardProps | undefined;
|
|
20
|
+
readonly children?: true | undefined;
|
|
21
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Card", CardProps, true>>;
|
|
22
|
+
declare const DescriptionList: "DescriptionList" & {
|
|
23
|
+
readonly type?: "DescriptionList" | undefined;
|
|
24
|
+
readonly props?: DescriptionListProps | undefined;
|
|
25
|
+
readonly children?: true | undefined;
|
|
26
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"DescriptionList", DescriptionListProps, true>>;
|
|
27
|
+
declare const DescriptionListItem: "DescriptionListItem" & {
|
|
28
|
+
readonly type?: "DescriptionListItem" | undefined;
|
|
29
|
+
readonly props?: DescriptionListItemProps | undefined;
|
|
30
|
+
readonly children?: true | undefined;
|
|
31
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"DescriptionListItem", DescriptionListItemProps, true>>;
|
|
32
|
+
declare const Divider: "Divider" & {
|
|
33
|
+
readonly type?: "Divider" | undefined;
|
|
34
|
+
readonly props?: DividerProps | undefined;
|
|
35
|
+
readonly children?: true | undefined;
|
|
36
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Divider", DividerProps, true>>;
|
|
37
|
+
declare const EmptyState: "EmptyState" & {
|
|
38
|
+
readonly type?: "EmptyState" | undefined;
|
|
39
|
+
readonly props?: EmptyStateProps | undefined;
|
|
40
|
+
readonly children?: true | undefined;
|
|
41
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"EmptyState", EmptyStateProps, true>>;
|
|
42
|
+
declare const ErrorState: "ErrorState" & {
|
|
43
|
+
readonly type?: "ErrorState" | undefined;
|
|
44
|
+
readonly props?: ErrorStateProps | undefined;
|
|
45
|
+
readonly children?: true | undefined;
|
|
46
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"ErrorState", ErrorStateProps, true>>;
|
|
47
|
+
declare const Form: "Form" & {
|
|
48
|
+
readonly type?: "Form" | undefined;
|
|
49
|
+
readonly props?: FormProps | undefined;
|
|
50
|
+
readonly children?: true | undefined;
|
|
51
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Form", FormProps, true>>;
|
|
52
|
+
declare const Heading: "Heading" & {
|
|
53
|
+
readonly type?: "Heading" | undefined;
|
|
54
|
+
readonly props?: HeadingProps | undefined;
|
|
55
|
+
readonly children?: true | undefined;
|
|
56
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Heading", HeadingProps, true>>;
|
|
57
|
+
declare const Image: "Image" & {
|
|
58
|
+
readonly type?: "Image" | undefined;
|
|
59
|
+
readonly props?: ImageProps | undefined;
|
|
60
|
+
readonly children?: true | undefined;
|
|
61
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Image", ImageProps, true>>;
|
|
62
|
+
declare const Input: "Input" & {
|
|
63
|
+
readonly type?: "Input" | undefined;
|
|
64
|
+
readonly props?: InputProps | undefined;
|
|
65
|
+
readonly children?: true | undefined;
|
|
66
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Input", InputProps, true>>;
|
|
67
|
+
declare const LoadingSpinner: "LoadingSpinner" & {
|
|
68
|
+
readonly type?: "LoadingSpinner" | undefined;
|
|
69
|
+
readonly props?: LoadingSpinnerProps | undefined;
|
|
70
|
+
readonly children?: true | undefined;
|
|
71
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"LoadingSpinner", LoadingSpinnerProps, true>>;
|
|
72
|
+
declare const ProgressBar: "ProgressBar" & {
|
|
73
|
+
readonly type?: "ProgressBar" | undefined;
|
|
74
|
+
readonly props?: ProgressBarProps | undefined;
|
|
75
|
+
readonly children?: true | undefined;
|
|
76
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"ProgressBar", ProgressBarProps, true>>;
|
|
77
|
+
declare const Select: "Select" & {
|
|
78
|
+
readonly type?: "Select" | undefined;
|
|
79
|
+
readonly props?: SelectProps | undefined;
|
|
80
|
+
readonly children?: true | undefined;
|
|
81
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Select", SelectProps, true>>;
|
|
82
|
+
declare const Tag: "Tag" & {
|
|
83
|
+
readonly type?: "Tag" | undefined;
|
|
84
|
+
readonly props?: TagProps | undefined;
|
|
85
|
+
readonly children?: true | undefined;
|
|
86
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Tag", TagProps, true>>;
|
|
87
|
+
declare const Text: "Text" & {
|
|
88
|
+
readonly type?: "Text" | undefined;
|
|
89
|
+
readonly props?: TextProps | undefined;
|
|
90
|
+
readonly children?: true | undefined;
|
|
91
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Text", TextProps, true>>;
|
|
92
|
+
declare const Tile: "Tile" & {
|
|
93
|
+
readonly type?: "Tile" | undefined;
|
|
94
|
+
readonly props?: TileProps | undefined;
|
|
95
|
+
readonly children?: true | undefined;
|
|
96
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Tile", TileProps, true>>;
|
|
97
|
+
declare const Stack: "Stack" & {
|
|
98
|
+
readonly type?: "Stack" | undefined;
|
|
99
|
+
readonly props?: StackProps | undefined;
|
|
100
|
+
readonly children?: true | undefined;
|
|
101
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Stack", StackProps, true>>;
|
|
102
|
+
declare const StatisticsItem: "StatisticsItem" & {
|
|
103
|
+
readonly type?: "StatisticsItem" | undefined;
|
|
104
|
+
readonly props?: StatisticsItemProps | undefined;
|
|
105
|
+
readonly children?: true | undefined;
|
|
106
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"StatisticsItem", StatisticsItemProps, true>>;
|
|
107
|
+
declare const Statistics: "Statistics" & {
|
|
108
|
+
readonly type?: "Statistics" | undefined;
|
|
109
|
+
readonly props?: StatisticsProps | undefined;
|
|
110
|
+
readonly children?: true | undefined;
|
|
111
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Statistics", StatisticsProps, true>>;
|
|
112
|
+
declare const StatisticsTrend: "StatisticsTrend" & {
|
|
113
|
+
readonly type?: "StatisticsTrend" | undefined;
|
|
114
|
+
readonly props?: StatisticsTrendProps | undefined;
|
|
115
|
+
readonly children?: true | undefined;
|
|
116
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"StatisticsTrend", StatisticsTrendProps, true>>;
|
|
117
|
+
declare const Table: "Table" & {
|
|
118
|
+
readonly type?: "Table" | undefined;
|
|
119
|
+
readonly props?: TableProps | undefined;
|
|
120
|
+
readonly children?: true | undefined;
|
|
121
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Table", TableProps, true>>;
|
|
122
|
+
declare const TableFooter: "TableFooter" & {
|
|
123
|
+
readonly type?: "TableFooter" | undefined;
|
|
124
|
+
readonly props?: TableElementProps | undefined;
|
|
125
|
+
readonly children?: true | undefined;
|
|
126
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"TableFooter", TableElementProps, true>>;
|
|
127
|
+
declare const TableCell: "TableCell" & {
|
|
128
|
+
readonly type?: "TableCell" | undefined;
|
|
129
|
+
readonly props?: TableElementProps | undefined;
|
|
130
|
+
readonly children?: true | undefined;
|
|
131
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"TableCell", TableElementProps, true>>;
|
|
132
|
+
declare const TableRow: "TableRow" & {
|
|
133
|
+
readonly type?: "TableRow" | undefined;
|
|
134
|
+
readonly props?: TableElementProps | undefined;
|
|
135
|
+
readonly children?: true | undefined;
|
|
136
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"TableRow", TableElementProps, true>>;
|
|
137
|
+
declare const TableBody: "TableBody" & {
|
|
138
|
+
readonly type?: "TableBody" | undefined;
|
|
139
|
+
readonly props?: TableElementProps | undefined;
|
|
140
|
+
readonly children?: true | undefined;
|
|
141
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"TableBody", TableElementProps, true>>;
|
|
142
|
+
declare const TableHeader: "TableHeader" & {
|
|
143
|
+
readonly type?: "TableHeader" | undefined;
|
|
144
|
+
readonly props?: TableElementProps | undefined;
|
|
145
|
+
readonly children?: true | undefined;
|
|
146
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"TableHeader", TableElementProps, true>>;
|
|
147
|
+
declare const TableHead: "TableHead" & {
|
|
148
|
+
readonly type?: "TableHead" | undefined;
|
|
149
|
+
readonly props?: TableElementProps | undefined;
|
|
150
|
+
readonly children?: true | undefined;
|
|
151
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"TableHead", TableElementProps, true>>;
|
|
152
|
+
export { Alert, Button, ButtonRow, Card, DescriptionList, DescriptionListItem, Divider, EmptyState, ErrorState, Form, Heading, Image, Input, LoadingSpinner, ProgressBar, Select, Stack, Statistics, StatisticsItem, StatisticsTrend, Table, TableFooter, TableCell, TableRow, TableBody, TableHeader, TableHead, Tag, Text, Tile, };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { createRemoteReactComponent } from '@remote-ui/react';
|
|
2
|
+
const Alert = createRemoteReactComponent('Alert');
|
|
3
|
+
const Button = createRemoteReactComponent('Button');
|
|
4
|
+
const ButtonRow = createRemoteReactComponent('ButtonRow');
|
|
5
|
+
const Card = createRemoteReactComponent('Card');
|
|
6
|
+
const DescriptionList = createRemoteReactComponent('DescriptionList');
|
|
7
|
+
const DescriptionListItem = createRemoteReactComponent('DescriptionListItem');
|
|
8
|
+
const Divider = createRemoteReactComponent('Divider');
|
|
9
|
+
const EmptyState = createRemoteReactComponent('EmptyState');
|
|
10
|
+
const ErrorState = createRemoteReactComponent('ErrorState');
|
|
11
|
+
const Form = createRemoteReactComponent('Form');
|
|
12
|
+
const Heading = createRemoteReactComponent('Heading');
|
|
13
|
+
const Image = createRemoteReactComponent('Image');
|
|
14
|
+
const Input = createRemoteReactComponent('Input');
|
|
15
|
+
const LoadingSpinner = createRemoteReactComponent('LoadingSpinner');
|
|
16
|
+
const ProgressBar = createRemoteReactComponent('ProgressBar');
|
|
17
|
+
const Select = createRemoteReactComponent('Select');
|
|
18
|
+
const Tag = createRemoteReactComponent('Tag');
|
|
19
|
+
const Text = createRemoteReactComponent('Text');
|
|
20
|
+
const Tile = createRemoteReactComponent('Tile');
|
|
21
|
+
const Stack = createRemoteReactComponent('Stack');
|
|
22
|
+
const StatisticsItem = createRemoteReactComponent('StatisticsItem');
|
|
23
|
+
const Statistics = createRemoteReactComponent('Statistics');
|
|
24
|
+
const StatisticsTrend = createRemoteReactComponent('StatisticsTrend');
|
|
25
|
+
const Table = createRemoteReactComponent('Table');
|
|
26
|
+
const TableFooter = createRemoteReactComponent('TableFooter');
|
|
27
|
+
const TableCell = createRemoteReactComponent('TableCell');
|
|
28
|
+
const TableRow = createRemoteReactComponent('TableRow');
|
|
29
|
+
const TableBody = createRemoteReactComponent('TableBody');
|
|
30
|
+
const TableHeader = createRemoteReactComponent('TableHeader');
|
|
31
|
+
const TableHead = createRemoteReactComponent('TableHead');
|
|
32
|
+
export { Alert, Button, ButtonRow, Card, DescriptionList, DescriptionListItem, Divider, EmptyState, ErrorState, Form, Heading, Image, Input, LoadingSpinner, ProgressBar, Select, Stack, Statistics, StatisticsItem, StatisticsTrend, Table, TableFooter, TableCell, TableRow, TableBody, TableHeader, TableHead, Tag, Text, Tile, };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CrmAssociationsTableProps, CrmPropertyListProps } from '../types';
|
|
2
|
+
declare const CrmPropertyList: "CrmPropertyList" & {
|
|
3
|
+
readonly type?: "CrmPropertyList" | undefined;
|
|
4
|
+
readonly props?: CrmPropertyListProps | undefined;
|
|
5
|
+
readonly children?: true | undefined;
|
|
6
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"CrmPropertyList", CrmPropertyListProps, true>>;
|
|
7
|
+
declare const CrmAssociationsTable: "CrmAssociationsTable" & {
|
|
8
|
+
readonly type?: "CrmAssociationsTable" | undefined;
|
|
9
|
+
readonly props?: CrmAssociationsTableProps | undefined;
|
|
10
|
+
readonly children?: true | undefined;
|
|
11
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"CrmAssociationsTable", CrmAssociationsTableProps, true>>;
|
|
12
|
+
export { CrmPropertyList, CrmAssociationsTable };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { createExtensionComponent } from '../utils/createExtensionComponent';
|
|
2
|
+
const CrmPropertyList = createExtensionComponent('CrmPropertyList');
|
|
3
|
+
const CrmAssociationsTable = createExtensionComponent('CrmAssociationsTable');
|
|
4
|
+
export { CrmPropertyList, CrmAssociationsTable };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import type { ExtensionPoints, ExtensionPointApi } from './types';
|
|
3
|
+
export declare const hubspot: {
|
|
4
|
+
extend: typeof render;
|
|
5
|
+
};
|
|
6
|
+
declare function render<ExtensionPointName extends keyof ExtensionPoints>(renderCallback: (api: ExtensionPointApi<ExtensionPointName>) => ReactElement<any>): any;
|
|
7
|
+
export {};
|
package/dist/hubspot.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/* eslint-disable hubspot-dev/no-confusing-browser-globals */
|
|
2
|
+
import { createRoot } from '@remote-ui/react';
|
|
3
|
+
import { isValidElement } from 'react';
|
|
4
|
+
export const hubspot = {
|
|
5
|
+
extend: render,
|
|
6
|
+
};
|
|
7
|
+
const extend = (...args) => self.extend(...args);
|
|
8
|
+
function render(renderCallback) {
|
|
9
|
+
return extend((root, api) => {
|
|
10
|
+
const renderCallbackResult = renderCallback(api);
|
|
11
|
+
if (!isValidElement(renderCallbackResult)) {
|
|
12
|
+
throw new Error(`[hubspot.extend]: Expected callback function to return a valid element, got: ${renderCallbackResult}`);
|
|
13
|
+
}
|
|
14
|
+
createRoot(root).render(renderCallbackResult);
|
|
15
|
+
root.mount();
|
|
16
|
+
});
|
|
17
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { Alert, Button, ButtonRow, Card, DescriptionList, DescriptionListItem, Divider, EmptyState, ErrorState, Form, Heading, Image, Input, LoadingSpinner, ProgressBar, Select, Stack, Statistics, StatisticsItem, StatisticsTrend, Table, TableFooter, TableCell, TableRow, TableBody, TableHeader, TableHead, Tag, Text, Tile, } from './coreComponents';
|
|
2
|
+
export { hubspot } from './hubspot';
|
|
3
|
+
export * from './types';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { Alert, Button, ButtonRow, Card, DescriptionList, DescriptionListItem, Divider, EmptyState, ErrorState, Form, Heading, Image, Input, LoadingSpinner, ProgressBar, Select, Stack, Statistics, StatisticsItem, StatisticsTrend, Table, TableFooter, TableCell, TableRow, TableBody, TableHeader, TableHead, Tag, Text, Tile, } from './coreComponents';
|
|
2
|
+
export { hubspot } from './hubspot';
|
|
3
|
+
export * from './types';
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import { ReactNode, ComponentType } from 'react';
|
|
2
|
+
export interface AlertProps {
|
|
3
|
+
title: string;
|
|
4
|
+
body?: string;
|
|
5
|
+
children?: ReactNode;
|
|
6
|
+
variant?: 'info' | 'warning' | 'success' | 'error' | 'danger';
|
|
7
|
+
}
|
|
8
|
+
export interface ButtonProps {
|
|
9
|
+
text: string;
|
|
10
|
+
onClick?: () => void;
|
|
11
|
+
href?: string;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
variant?: 'primary' | 'secondary' | 'destructive';
|
|
14
|
+
type?: 'button' | 'reset' | 'submit';
|
|
15
|
+
}
|
|
16
|
+
export interface ButtonRowProps {
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
disableDropdown?: boolean;
|
|
19
|
+
}
|
|
20
|
+
export interface CardProps {
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
}
|
|
23
|
+
export interface DescriptionListItemProps {
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
label: string;
|
|
26
|
+
}
|
|
27
|
+
export interface DescriptionListProps {
|
|
28
|
+
children: ReactNode;
|
|
29
|
+
direction?: 'row' | 'column';
|
|
30
|
+
}
|
|
31
|
+
export interface DividerProps {
|
|
32
|
+
distance?: 'flush' | 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large';
|
|
33
|
+
}
|
|
34
|
+
export interface EmptyStateProps {
|
|
35
|
+
flush?: boolean;
|
|
36
|
+
children: ReactNode;
|
|
37
|
+
title?: string;
|
|
38
|
+
layout?: 'horizontal' | 'vertical';
|
|
39
|
+
reverseOrder?: boolean;
|
|
40
|
+
imageWidth?: number;
|
|
41
|
+
}
|
|
42
|
+
export interface ErrorStateProps {
|
|
43
|
+
children: ReactNode;
|
|
44
|
+
title?: string;
|
|
45
|
+
type?: 'error' | 'support' | 'lock';
|
|
46
|
+
}
|
|
47
|
+
export type FormInputValues = Record<string, string | number>;
|
|
48
|
+
export interface FormProps {
|
|
49
|
+
children: ReactNode;
|
|
50
|
+
onSubmit?: (event: RemoteEvent<FormInputValues>) => void;
|
|
51
|
+
preventDefault?: boolean;
|
|
52
|
+
}
|
|
53
|
+
export interface HeadingProps {
|
|
54
|
+
text: string;
|
|
55
|
+
format?: 'plaintext' | 'markdown';
|
|
56
|
+
}
|
|
57
|
+
export interface ImageProps {
|
|
58
|
+
alt?: string;
|
|
59
|
+
href?: string;
|
|
60
|
+
onClick?: () => void;
|
|
61
|
+
src: string;
|
|
62
|
+
width?: number;
|
|
63
|
+
}
|
|
64
|
+
export interface InputProps {
|
|
65
|
+
label: string;
|
|
66
|
+
name: string;
|
|
67
|
+
value?: string;
|
|
68
|
+
required?: boolean;
|
|
69
|
+
readonly?: boolean;
|
|
70
|
+
description?: string;
|
|
71
|
+
tooltip?: string;
|
|
72
|
+
placeholder?: string;
|
|
73
|
+
error?: boolean;
|
|
74
|
+
validationMessage?: string;
|
|
75
|
+
onChange?: (value: string) => void;
|
|
76
|
+
onInput?: (value: string) => void;
|
|
77
|
+
onBlur?: (value: string) => void;
|
|
78
|
+
onFocus?: (value: string) => void;
|
|
79
|
+
}
|
|
80
|
+
export interface ProgressBarProps {
|
|
81
|
+
title?: string;
|
|
82
|
+
showPercentage?: boolean;
|
|
83
|
+
value?: number;
|
|
84
|
+
valueMax?: number;
|
|
85
|
+
valueDescription?: string;
|
|
86
|
+
variant?: 'success' | 'danger' | 'warning';
|
|
87
|
+
}
|
|
88
|
+
export interface SelectProps {
|
|
89
|
+
label: string;
|
|
90
|
+
name: string;
|
|
91
|
+
value?: string | number;
|
|
92
|
+
required?: boolean;
|
|
93
|
+
readonly?: boolean;
|
|
94
|
+
description?: string;
|
|
95
|
+
tooltip?: string;
|
|
96
|
+
placeholder?: string;
|
|
97
|
+
error?: boolean;
|
|
98
|
+
validationMessage?: string;
|
|
99
|
+
onChange?: (value: SelectProps['value']) => void;
|
|
100
|
+
options: {
|
|
101
|
+
label: string;
|
|
102
|
+
value: string | number;
|
|
103
|
+
}[];
|
|
104
|
+
}
|
|
105
|
+
export interface TagProps {
|
|
106
|
+
text: string;
|
|
107
|
+
onClick?: () => void;
|
|
108
|
+
variant?: 'default' | 'warning' | 'success' | 'error';
|
|
109
|
+
}
|
|
110
|
+
interface BaseTextProps {
|
|
111
|
+
variant?: 'bodytext' | 'microcopy';
|
|
112
|
+
tagName?: 'p' | 'span' | 'small';
|
|
113
|
+
}
|
|
114
|
+
export interface PlainTextProps extends BaseTextProps {
|
|
115
|
+
format?: 'plaintext';
|
|
116
|
+
children: ReactNode;
|
|
117
|
+
}
|
|
118
|
+
export interface MarkdownTextProps extends BaseTextProps {
|
|
119
|
+
format: 'markdown';
|
|
120
|
+
text: string;
|
|
121
|
+
}
|
|
122
|
+
export type TextProps = PlainTextProps | MarkdownTextProps;
|
|
123
|
+
export interface TileProps {
|
|
124
|
+
children: ReactNode;
|
|
125
|
+
flush?: boolean;
|
|
126
|
+
}
|
|
127
|
+
interface Team {
|
|
128
|
+
id: number;
|
|
129
|
+
name: string;
|
|
130
|
+
teammates: number[];
|
|
131
|
+
}
|
|
132
|
+
export interface UserContext {
|
|
133
|
+
id: number;
|
|
134
|
+
emails: string[];
|
|
135
|
+
email: string;
|
|
136
|
+
firstName: string;
|
|
137
|
+
lastName: string;
|
|
138
|
+
roles: string[];
|
|
139
|
+
teams: Team[];
|
|
140
|
+
locale?: string;
|
|
141
|
+
}
|
|
142
|
+
export interface PortalContext {
|
|
143
|
+
id: number;
|
|
144
|
+
timezone: string;
|
|
145
|
+
}
|
|
146
|
+
export interface Context {
|
|
147
|
+
user: UserContext;
|
|
148
|
+
portal: PortalContext;
|
|
149
|
+
}
|
|
150
|
+
export interface StackProps {
|
|
151
|
+
distance?: 'flush' | 'small' | 'extra-small' | 'medium' | 'large';
|
|
152
|
+
children?: React.ReactNode;
|
|
153
|
+
direction?: 'row' | 'column';
|
|
154
|
+
}
|
|
155
|
+
export interface StatisticsTrendProps {
|
|
156
|
+
value: string;
|
|
157
|
+
direction: 'increase' | 'decrease';
|
|
158
|
+
}
|
|
159
|
+
export interface StatisticsItemProps {
|
|
160
|
+
id?: string;
|
|
161
|
+
label: string;
|
|
162
|
+
number: string;
|
|
163
|
+
children: ReactNode;
|
|
164
|
+
}
|
|
165
|
+
export interface StatisticsProps {
|
|
166
|
+
children: ReactNode;
|
|
167
|
+
}
|
|
168
|
+
export interface ServerlessRunnerParams {
|
|
169
|
+
name: string;
|
|
170
|
+
payload: Record<string, unknown>;
|
|
171
|
+
onError?: () => void;
|
|
172
|
+
}
|
|
173
|
+
export type ServerlessFuncRunner = (params: ServerlessRunnerParams) => Promise<any>;
|
|
174
|
+
export interface ServerlessSuccessResponse {
|
|
175
|
+
logId: string;
|
|
176
|
+
response: {
|
|
177
|
+
message?: {
|
|
178
|
+
type: 'SUCCESS' | 'ERROR';
|
|
179
|
+
body: string;
|
|
180
|
+
} | string;
|
|
181
|
+
context?: Record<string, unknown>;
|
|
182
|
+
section?: Record<string, unknown>;
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
export interface ServerlessErrorResponse {
|
|
186
|
+
responseJSON?: {
|
|
187
|
+
message: string;
|
|
188
|
+
correlationId: string;
|
|
189
|
+
category: string;
|
|
190
|
+
subCategory?: string;
|
|
191
|
+
errors?: {
|
|
192
|
+
message: string;
|
|
193
|
+
subCategory: string;
|
|
194
|
+
}[];
|
|
195
|
+
};
|
|
196
|
+
status: number;
|
|
197
|
+
}
|
|
198
|
+
export interface ExtensionCardContextData {
|
|
199
|
+
cardId: string;
|
|
200
|
+
appId: number | string;
|
|
201
|
+
objectId: number | string;
|
|
202
|
+
objectTypeId: string;
|
|
203
|
+
location: keyof ExtensionPoints;
|
|
204
|
+
}
|
|
205
|
+
export type ExtensionPointAction = (...args: any[]) => Promise<any> | void;
|
|
206
|
+
export interface ExtensionPointContract {
|
|
207
|
+
actions?: {
|
|
208
|
+
[k: string]: ExtensionPointAction;
|
|
209
|
+
} | {};
|
|
210
|
+
customComponents: Record<string, ComponentType<any>>;
|
|
211
|
+
}
|
|
212
|
+
type AlertType = 'info' | 'warning' | 'success' | 'danger' | 'tip' | undefined;
|
|
213
|
+
export type AddAlertAction = (args: {
|
|
214
|
+
type?: AlertType;
|
|
215
|
+
message: string;
|
|
216
|
+
}) => void;
|
|
217
|
+
export type ReloadPageAction = () => void;
|
|
218
|
+
export type FetchCrmObjectPropertiesAction = (properties: string[]) => Promise<{
|
|
219
|
+
name: string;
|
|
220
|
+
value: string;
|
|
221
|
+
}[]>;
|
|
222
|
+
export type OpenIframeModalAction = (action: OpenIframeActionPayload) => void;
|
|
223
|
+
export interface CrmMiddleExtensionPoint extends ExtensionPointContract {
|
|
224
|
+
actions: {
|
|
225
|
+
addAlert: AddAlertAction;
|
|
226
|
+
reloadPage: ReloadPageAction;
|
|
227
|
+
fetchCrmObjectProperties: FetchCrmObjectPropertiesAction;
|
|
228
|
+
openIframeModal: OpenIframeModalAction;
|
|
229
|
+
};
|
|
230
|
+
customComponents: {
|
|
231
|
+
CrmPropertyList?: ComponentType<CrmPropertyListProps>;
|
|
232
|
+
CrmAssociationsTable?: ComponentType<CrmAssociationsTableProps>;
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
export interface CrmPropertyListProps {
|
|
236
|
+
properties: string[];
|
|
237
|
+
direction?: string;
|
|
238
|
+
}
|
|
239
|
+
type CrmSortDescriptor = {
|
|
240
|
+
columnName: string;
|
|
241
|
+
direction: 1 | -1;
|
|
242
|
+
};
|
|
243
|
+
interface CrmSearchFilter {
|
|
244
|
+
operator: 'EQ' | 'NEQ' | 'LT' | 'LTE' | 'GT' | 'GTE' | 'BETWEEN' | 'IN' | 'NOT_IN' | 'HAS_PROPERTY' | 'NOT_HAS_PROPERTY' | 'ROLLING_DATE_RANGE' | 'TIME_UNIT_TO_DATE';
|
|
245
|
+
value?: string | number;
|
|
246
|
+
highValue?: string | number;
|
|
247
|
+
property: string;
|
|
248
|
+
}
|
|
249
|
+
export interface CrmAssociationsTableProps {
|
|
250
|
+
objectTypeId: string;
|
|
251
|
+
propertyColumns: Array<string>;
|
|
252
|
+
quickFilterProperties?: Array<string>;
|
|
253
|
+
searchable?: boolean;
|
|
254
|
+
pagination?: boolean;
|
|
255
|
+
pageSize?: number;
|
|
256
|
+
preFilters?: Array<CrmSearchFilter>;
|
|
257
|
+
sort?: Array<CrmSortDescriptor>;
|
|
258
|
+
}
|
|
259
|
+
interface CrmSidebarExtensionPoint extends ExtensionPointContract {
|
|
260
|
+
actions: {
|
|
261
|
+
reloadPage: ReloadPageAction;
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
interface RemotePlaygroundExtensionPoint extends ExtensionPointContract {
|
|
265
|
+
actions: {
|
|
266
|
+
warn: () => void;
|
|
267
|
+
};
|
|
268
|
+
customComponents: {
|
|
269
|
+
ExampleCrmComponent: ComponentType<ExampleCrmComponentProps>;
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
export interface ExtensionPoints {
|
|
273
|
+
'uie.playground.middle': RemotePlaygroundExtensionPoint;
|
|
274
|
+
'crm.record.tab': CrmMiddleExtensionPoint;
|
|
275
|
+
'crm.record.sidebar': CrmSidebarExtensionPoint;
|
|
276
|
+
}
|
|
277
|
+
export interface ExampleCrmComponentProps {
|
|
278
|
+
name: string;
|
|
279
|
+
size: 'sm' | 'md' | 'lg';
|
|
280
|
+
count: number;
|
|
281
|
+
}
|
|
282
|
+
export interface ExtensionPointApi<ExtensionPointName extends keyof ExtensionPoints> {
|
|
283
|
+
context: Context;
|
|
284
|
+
runServerlessFunction: ServerlessFuncRunner;
|
|
285
|
+
actions: ExtensionPoints[ExtensionPointName]['actions'];
|
|
286
|
+
customComponents: string[];
|
|
287
|
+
}
|
|
288
|
+
interface OpenIframeActionPayload {
|
|
289
|
+
uri: string;
|
|
290
|
+
height: number;
|
|
291
|
+
width: number;
|
|
292
|
+
associatedObjectProperties?: string[];
|
|
293
|
+
}
|
|
294
|
+
export interface LoadingSpinnerProps {
|
|
295
|
+
label: string;
|
|
296
|
+
showLabel?: boolean;
|
|
297
|
+
size?: 'xs' | 'sm' | 'md';
|
|
298
|
+
layout?: 'inline' | 'centered';
|
|
299
|
+
grow?: boolean;
|
|
300
|
+
}
|
|
301
|
+
export interface TableElementProps {
|
|
302
|
+
children: React.ReactNode;
|
|
303
|
+
}
|
|
304
|
+
interface BaseTableProps {
|
|
305
|
+
bordered?: boolean;
|
|
306
|
+
flush?: boolean;
|
|
307
|
+
children: React.ReactNode;
|
|
308
|
+
}
|
|
309
|
+
export interface TableNoPaginatedProps extends BaseTableProps {
|
|
310
|
+
paginated?: false;
|
|
311
|
+
}
|
|
312
|
+
export interface TablePaginatedProps extends BaseTableProps {
|
|
313
|
+
paginated: true;
|
|
314
|
+
pageCount: number;
|
|
315
|
+
onPageChange: (pageNumber: number) => void;
|
|
316
|
+
showButtonLabels?: boolean;
|
|
317
|
+
showFirstLastButtons?: boolean;
|
|
318
|
+
maxVisiblePageButtons?: number;
|
|
319
|
+
page?: number;
|
|
320
|
+
}
|
|
321
|
+
export type TableProps = TableNoPaginatedProps | TablePaginatedProps;
|
|
322
|
+
export declare class RemoteEvent<V> {
|
|
323
|
+
type: string;
|
|
324
|
+
bubbles: boolean;
|
|
325
|
+
timeStamp: number;
|
|
326
|
+
targetValue: V;
|
|
327
|
+
constructor(value: V, event: Event);
|
|
328
|
+
}
|
|
329
|
+
export {};
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { RemoteComponentType } from '@remote-ui/core';
|
|
2
|
+
import type { ReactComponentTypeFromRemoteComponentType } from '@remote-ui/react';
|
|
3
|
+
export declare function createExtensionComponent<ComponentType extends string, Props = Record<string, never>, AllowedChildren extends RemoteComponentType<string, any> | boolean = true>(componentType: ComponentType | RemoteComponentType<ComponentType, Props, AllowedChildren>): RemoteComponentType<ComponentType, Props, AllowedChildren> & ReactComponentTypeFromRemoteComponentType<RemoteComponentType<ComponentType, Props, AllowedChildren>>;
|
package/package.json
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/ui-extensions",
|
|
3
|
-
"version": "0.0.1-prealpha.
|
|
3
|
+
"version": "0.0.1-prealpha.6",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"
|
|
10
|
-
"
|
|
9
|
+
"clean": "rm -rf dist/",
|
|
10
|
+
"build": "npm run clean && tsc",
|
|
11
|
+
"watch": "npm run clean && tsc --watch",
|
|
12
|
+
"prepare": "npm run build"
|
|
11
13
|
},
|
|
12
14
|
"files": [
|
|
13
15
|
"dist/**/*"
|
|
14
16
|
],
|
|
15
|
-
"prepare": "npm run build",
|
|
16
17
|
"publishConfig": {
|
|
17
18
|
"access": "public"
|
|
18
19
|
},
|
|
@@ -47,5 +48,5 @@
|
|
|
47
48
|
"devDependencies": {
|
|
48
49
|
"typescript": "5.0.4"
|
|
49
50
|
},
|
|
50
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "1dfa4048c08a39c6f50a5f87e92eddf1b19dde5c"
|
|
51
52
|
}
|