@hubspot/ui-extensions 0.0.1-prealpha.5 → 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 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 no arguments and it's return value will be ignored. |
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
- errorMessage?: string;
476
- onChange: (value: string) => void;
477
- onInput: (value: string) => void;
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 stops typing. |
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 padding between each child component passed as children |
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. If format is `"markdown"`, inline markdown elements (i.e. bold, italics, code, links) are supported |
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:
@@ -1,4 +1,4 @@
1
- import type { AlertProps, ButtonProps, ButtonRowProps, CardProps, DescriptionListProps, DescriptionListItemProps, DividerProps, FormProps, HeadingProps, ImageProps, InputProps, LoadingSpinnerProps, ProgressBarProps, SelectProps, TagProps, TextProps, TileProps, StackProps, StatisticsProps, StatisticsItemProps, StatisticsTrendProps, TableProps, TableElementProps } from './types';
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
2
  declare const Alert: "Alert" & {
3
3
  readonly type?: "Alert" | undefined;
4
4
  readonly props?: AlertProps | undefined;
@@ -34,6 +34,16 @@ declare const Divider: "Divider" & {
34
34
  readonly props?: DividerProps | undefined;
35
35
  readonly children?: true | undefined;
36
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>>;
37
47
  declare const Form: "Form" & {
38
48
  readonly type?: "Form" | undefined;
39
49
  readonly props?: FormProps | undefined;
@@ -139,4 +149,4 @@ declare const TableHead: "TableHead" & {
139
149
  readonly props?: TableElementProps | undefined;
140
150
  readonly children?: true | undefined;
141
151
  } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"TableHead", TableElementProps, true>>;
142
- export { Alert, Button, ButtonRow, Card, DescriptionList, DescriptionListItem, Divider, Form, Heading, Image, Input, LoadingSpinner, ProgressBar, Select, Stack, Statistics, StatisticsItem, StatisticsTrend, Table, TableFooter, TableCell, TableRow, TableBody, TableHeader, TableHead, Tag, Text, Tile, };
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, };
@@ -6,6 +6,8 @@ const Card = createRemoteReactComponent('Card');
6
6
  const DescriptionList = createRemoteReactComponent('DescriptionList');
7
7
  const DescriptionListItem = createRemoteReactComponent('DescriptionListItem');
8
8
  const Divider = createRemoteReactComponent('Divider');
9
+ const EmptyState = createRemoteReactComponent('EmptyState');
10
+ const ErrorState = createRemoteReactComponent('ErrorState');
9
11
  const Form = createRemoteReactComponent('Form');
10
12
  const Heading = createRemoteReactComponent('Heading');
11
13
  const Image = createRemoteReactComponent('Image');
@@ -27,4 +29,4 @@ const TableRow = createRemoteReactComponent('TableRow');
27
29
  const TableBody = createRemoteReactComponent('TableBody');
28
30
  const TableHeader = createRemoteReactComponent('TableHeader');
29
31
  const TableHead = createRemoteReactComponent('TableHead');
30
- export { Alert, Button, ButtonRow, Card, DescriptionList, DescriptionListItem, Divider, Form, Heading, Image, Input, LoadingSpinner, ProgressBar, Select, Stack, Statistics, StatisticsItem, StatisticsTrend, Table, TableFooter, TableCell, TableRow, TableBody, TableHeader, TableHead, Tag, Text, Tile, };
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, };
@@ -1,7 +1,12 @@
1
- import { CrmPropertyListProps } from '../types';
1
+ import { CrmAssociationsTableProps, CrmPropertyListProps } from '../types';
2
2
  declare const CrmPropertyList: "CrmPropertyList" & {
3
3
  readonly type?: "CrmPropertyList" | undefined;
4
4
  readonly props?: CrmPropertyListProps | undefined;
5
5
  readonly children?: true | undefined;
6
6
  } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"CrmPropertyList", CrmPropertyListProps, true>>;
7
- export { CrmPropertyList };
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 };
@@ -1,3 +1,4 @@
1
1
  import { createExtensionComponent } from '../utils/createExtensionComponent';
2
2
  const CrmPropertyList = createExtensionComponent('CrmPropertyList');
3
- export { CrmPropertyList };
3
+ const CrmAssociationsTable = createExtensionComponent('CrmAssociationsTable');
4
+ export { CrmPropertyList, CrmAssociationsTable };
@@ -1,2 +1,2 @@
1
- import { CrmPropertyList } from './components';
2
- export { CrmPropertyList };
1
+ import { CrmPropertyList, CrmAssociationsTable } from './components';
2
+ export { CrmPropertyList, CrmAssociationsTable };
package/dist/crm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { CrmPropertyList } from './components';
2
- export { CrmPropertyList };
1
+ import { CrmPropertyList, CrmAssociationsTable } from './components';
2
+ export { CrmPropertyList, CrmAssociationsTable };
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { Alert, Button, ButtonRow, Card, DescriptionList, DescriptionListItem, Divider, Form, Heading, Image, Input, LoadingSpinner, ProgressBar, Select, Stack, Statistics, StatisticsItem, StatisticsTrend, Table, TableFooter, TableCell, TableRow, TableBody, TableHeader, TableHead, Tag, Text, Tile, } from './coreComponents';
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
2
  export { hubspot } from './hubspot';
3
3
  export * from './types';
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- export { Alert, Button, ButtonRow, Card, DescriptionList, DescriptionListItem, Divider, Form, Heading, Image, Input, LoadingSpinner, ProgressBar, Select, Stack, Statistics, StatisticsItem, StatisticsTrend, Table, TableFooter, TableCell, TableRow, TableBody, TableHeader, TableHead, Tag, Text, Tile, } from './coreComponents';
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
2
  export { hubspot } from './hubspot';
3
3
  export * from './types';
package/dist/types.d.ts CHANGED
@@ -31,9 +31,23 @@ export interface DescriptionListProps {
31
31
  export interface DividerProps {
32
32
  distance?: 'flush' | 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large';
33
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>;
34
48
  export interface FormProps {
35
49
  children: ReactNode;
36
- onSubmit?: () => void;
50
+ onSubmit?: (event: RemoteEvent<FormInputValues>) => void;
37
51
  preventDefault?: boolean;
38
52
  }
39
53
  export interface HeadingProps {
@@ -58,8 +72,10 @@ export interface InputProps {
58
72
  placeholder?: string;
59
73
  error?: boolean;
60
74
  validationMessage?: string;
61
- onChange: (value: string) => void;
62
- onInput: (value: string) => void;
75
+ onChange?: (value: string) => void;
76
+ onInput?: (value: string) => void;
77
+ onBlur?: (value: string) => void;
78
+ onFocus?: (value: string) => void;
63
79
  }
64
80
  export interface ProgressBarProps {
65
81
  title?: string;
@@ -72,7 +88,7 @@ export interface ProgressBarProps {
72
88
  export interface SelectProps {
73
89
  label: string;
74
90
  name: string;
75
- value?: string | number | boolean;
91
+ value?: string | number;
76
92
  required?: boolean;
77
93
  readonly?: boolean;
78
94
  description?: string;
@@ -83,7 +99,7 @@ export interface SelectProps {
83
99
  onChange?: (value: SelectProps['value']) => void;
84
100
  options: {
85
101
  label: string;
86
- value: string | number | boolean;
102
+ value: string | number;
87
103
  }[];
88
104
  }
89
105
  export interface TagProps {
@@ -91,11 +107,19 @@ export interface TagProps {
91
107
  onClick?: () => void;
92
108
  variant?: 'default' | 'warning' | 'success' | 'error';
93
109
  }
94
- export interface TextProps {
95
- format?: 'plaintext' | 'markdown';
96
- text: string;
110
+ interface BaseTextProps {
97
111
  variant?: 'bodytext' | 'microcopy';
112
+ tagName?: 'p' | 'span' | 'small';
113
+ }
114
+ export interface PlainTextProps extends BaseTextProps {
115
+ format?: 'plaintext';
116
+ children: ReactNode;
98
117
  }
118
+ export interface MarkdownTextProps extends BaseTextProps {
119
+ format: 'markdown';
120
+ text: string;
121
+ }
122
+ export type TextProps = PlainTextProps | MarkdownTextProps;
99
123
  export interface TileProps {
100
124
  children: ReactNode;
101
125
  flush?: boolean;
@@ -123,10 +147,10 @@ export interface Context {
123
147
  user: UserContext;
124
148
  portal: PortalContext;
125
149
  }
126
- type distanceOptions = 'flush' | 'small';
127
150
  export interface StackProps {
128
- distance?: distanceOptions;
151
+ distance?: 'flush' | 'small' | 'extra-small' | 'medium' | 'large';
129
152
  children?: React.ReactNode;
153
+ direction?: 'row' | 'column';
130
154
  }
131
155
  export interface StatisticsTrendProps {
132
156
  value: string;
@@ -141,10 +165,6 @@ export interface StatisticsItemProps {
141
165
  export interface StatisticsProps {
142
166
  children: ReactNode;
143
167
  }
144
- export interface CrmPropertyListProps {
145
- properties: string[];
146
- direction?: string;
147
- }
148
168
  export interface ServerlessRunnerParams {
149
169
  name: string;
150
170
  payload: Record<string, unknown>;
@@ -209,8 +229,33 @@ export interface CrmMiddleExtensionPoint extends ExtensionPointContract {
209
229
  };
210
230
  customComponents: {
211
231
  CrmPropertyList?: ComponentType<CrmPropertyListProps>;
232
+ CrmAssociationsTable?: ComponentType<CrmAssociationsTableProps>;
212
233
  };
213
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
+ }
214
259
  interface CrmSidebarExtensionPoint extends ExtensionPointContract {
215
260
  actions: {
216
261
  reloadPage: ReloadPageAction;
@@ -256,8 +301,29 @@ export interface LoadingSpinnerProps {
256
301
  export interface TableElementProps {
257
302
  children: React.ReactNode;
258
303
  }
259
- export interface TableProps extends TableElementProps {
260
- flush?: boolean;
304
+ interface BaseTableProps {
261
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);
262
328
  }
263
329
  export {};
package/dist/types.js CHANGED
@@ -1 +1,12 @@
1
- export {};
1
+ export class RemoteEvent {
2
+ type;
3
+ bubbles;
4
+ timeStamp;
5
+ targetValue;
6
+ constructor(value, event) {
7
+ this.bubbles = event.bubbles;
8
+ this.type = event.type;
9
+ this.timeStamp = event.timeStamp;
10
+ this.targetValue = value;
11
+ }
12
+ }
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@hubspot/ui-extensions",
3
- "version": "0.0.1-prealpha.5",
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
9
  "clean": "rm -rf dist/",
10
- "prepare": "npm run clean && tsc",
11
- "watch": "npm run clean && tsc --watch"
10
+ "build": "npm run clean && tsc",
11
+ "watch": "npm run clean && tsc --watch",
12
+ "prepare": "npm run build"
12
13
  },
13
14
  "files": [
14
15
  "dist/**/*"
@@ -47,5 +48,5 @@
47
48
  "devDependencies": {
48
49
  "typescript": "5.0.4"
49
50
  },
50
- "gitHead": "a4652eb58cbde813dbebc8b7127c36102b9b6ed6"
51
+ "gitHead": "1dfa4048c08a39c6f50a5f87e92eddf1b19dde5c"
51
52
  }