@hubspot/ui-extensions 0.0.1-beta.0 → 0.0.1-beta.2

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
@@ -19,6 +19,7 @@ React components and utilities for extending HubSpot's UI.
19
19
  - [Input](#input)
20
20
  - [Link](#link)
21
21
  - [LoadingSpinner](#loadingspinner)
22
+ - [NumberInput](#numberInput)
22
23
  - [ProgressBar](#progressbar)
23
24
  - [Select](#select)
24
25
  - [Stack](#stack)
@@ -55,7 +56,6 @@ The Alert component accepts the following props:
55
56
  ```typescript
56
57
  export interface AlertProps {
57
58
  title: string;
58
- body?: string;
59
59
  children?: ReactNode;
60
60
  variant?: 'info' | 'warning' | 'success' | 'error' | 'danger';
61
61
  }
@@ -64,7 +64,6 @@ export interface AlertProps {
64
64
  | Prop | Type | Default | Description |
65
65
  | --- | --- | --- | --- |
66
66
  | `title` | `string` | `N/A` | The title text for the alert message. |
67
- | `body` | `string(optional)` | `N/A` | The main content of the alert message. If not provided, the children prop is used. |
68
67
  | `children` | `ReactNode(optional)` | `N/A` | The main content of the alert message when the body prop is not provided. |
69
68
  | `variant` | `'info' \| 'warning' \| 'success' \|'error' \| 'danger'` `(optional)` | `'info'` | Sets the color variation of the alert |
70
69
 
@@ -77,22 +76,18 @@ const Extension = () => {
77
76
  <Alert title="Important Info" variant="info">
78
77
  This is an informative message.
79
78
  </Alert>
80
- <Alert
81
- title="Success"
82
- body="Operation completed successfully."
83
- variant="success"
84
- />
85
- <Alert title="Warning" body="Proceed with caution." variant="warning" />
86
- <Alert
87
- title="Error"
88
- body="Something went wrong. Please try again."
89
- variant="error"
90
- />
91
- <Alert
92
- title="Danger"
93
- body="This action cannot be undone. Be careful."
94
- variant="danger"
95
- />
79
+ <Alert title="Success"variant="success">
80
+ Operation completed successfully.
81
+ </Alert>
82
+ <Alert title="Warning" variant="warning" >
83
+ Proceed with caution.
84
+ </Alert>
85
+ <Alert title="Error" variant="error" >
86
+ Something went wrong. Please try again.
87
+ </Alert>
88
+ <Alert title="Danger" variant="danger" >
89
+ This action cannot be undone. Be careful.
90
+ </Alert>
96
91
  </>
97
92
  );
98
93
  };
@@ -549,6 +544,7 @@ interface ImageProps {
549
544
  onClick?: () => void;
550
545
  src: string;
551
546
  width?: number;
547
+ height?: number;
552
548
  }
553
549
  ```
554
550
 
@@ -559,6 +555,7 @@ interface ImageProps {
559
555
  | `onClick` | `function(optional)` | A function that will be called when the image is clicked on. This function will receive no arguments any returned values will be ignored. |
560
556
  | `src` | `string` | The url to the image to display, similar to [img tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attributes) |
561
557
  | `width` | `number(optional)` | The pixel width of the image |
558
+ | `height` | `number(optional)` | The pixel height of the image |
562
559
 
563
560
  ##### Usage
564
561
 
@@ -681,6 +678,7 @@ export interface LinkProps {
681
678
  href: string;
682
679
  variant?: 'primary' | 'destructive' | 'light' | 'dark';
683
680
  children: ReactNode;
681
+ onClick?: () => void;
684
682
  }
685
683
  ```
686
684
 
@@ -689,6 +687,7 @@ export interface LinkProps {
689
687
  | `href` | `string` | `N/A` | A URL that will be opened when the link is clicked. If the value is a URL external to HubSpot it will be opened in a new tab. |
690
688
  | `variant` | `'primary' \| 'light' \| 'dark' \| 'destructive'` `(optional)` | `'primary'` | Sets the color variation of the link |
691
689
  | `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. |
690
+ | `onClick` | `() => void` `(optional)` | `N/A` | A function that will be invoked when the link is clicked. It receives no arguments and it's return value is ignored |
692
691
 
693
692
  ##### Usage
694
693
 
@@ -712,7 +711,7 @@ import { LoadingSpinner } from '@hubspot/ui-extensions';
712
711
  export interface LoadingSpinnerProps {
713
712
  label: string;
714
713
  showLabel?: boolean;
715
- size?: 'xs' | 'sm' | 'md';
714
+ size?: 'xs' | 'extra-small' | 'sm' | 'small' | 'md' | 'medium';
716
715
  layout?: 'inline' | 'centered';
717
716
  }
718
717
  ```
@@ -721,7 +720,7 @@ export interface LoadingSpinnerProps {
721
720
  | --- | --- | --- | --- |
722
721
  | `label` | `string` | `N/A` | The companion text for the loading spinner. |
723
722
  | `showLabel` | `boolean(optional)` | `false` | if `true`, the label will be visible alongside the loading spinner. |
724
- | `size` | `'xs'\| 'sm' \| 'md'` `(optional)` | `'sm'` | The size of the loading spinner icon. |
723
+ | `size` | `'xs' \| 'sm' \| 'md' \| 'extra-small' \| 'small' \| 'medium'` `(optional)` | `'sm'` | The size of the loading spinner icon. |
725
724
  | `layout` | `'inline'\| 'centered'` `(optional)` | `N/A` | Use the `centered` option for layout as a convenience for the common pattern of filling the space of its parent. |
726
725
 
727
726
  ##### Usage
@@ -731,6 +730,79 @@ const Extension = () => {
731
730
  return <LoadingSpinner label="Loading..." />;
732
731
  };
733
732
  ```
733
+ ### NumberInput
734
+
735
+ ##### Import
736
+
737
+ ```javascript
738
+ import { NumberInput } from '@hubspot/ui-extensions';
739
+ ```
740
+
741
+ ##### Props
742
+
743
+ ```typescript
744
+ export interface NumberInputProps {
745
+ label: string;
746
+ name: string;
747
+ value?: number;
748
+ required?: boolean;
749
+ readOnly?: boolean;
750
+ description?: string;
751
+ tooltip?: string;
752
+ placeholder?: string;
753
+ error?: boolean;
754
+ defaultValue?: number;
755
+ validationMessage?: string;
756
+ onChange?: (value: number) => void;
757
+ onInput?: (value: number) => void;
758
+ onBlur?: (value: number) => void;
759
+ onFocus?: (value: number) => void;
760
+ min?: number;
761
+ max?: number;
762
+ precision?: number;
763
+ formatStyle?: 'decimal' | 'percentage';
764
+ }
765
+ ```
766
+
767
+ | Prop | Type | Default | Description |
768
+ | --- | --- | --- | --- |
769
+ | `label` | `string` | `N/A` | The label text to display for the form input element |
770
+ | `name` | `string` | `N/A` | The unique identifier for the input element, this could be thought of as the HTML5 [Input element's name attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name) |
771
+ | `value` | `number(optional)` | `''` | The value of the input |
772
+ | `required` | `boolean(optional)` | `false` | Determines if the required indicator should be displayed |
773
+ | `readOnly` | `boolean(optional)` | `false` | Determines if the field is editable or not. |
774
+ | `description` | `string(optional)` | `N/A` | Instructional message to display to the user to help understand the purpose of the input. |
775
+ | `tooltip` | `string(optional)` | `N/A` | Text that will appear in a tooltip next to the input label. |
776
+ | `placeholder` | `string(optional)` | `N/A` | Text that appears in the input when it has no value set. |
777
+ | `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. |
778
+ | `validationMessage` | `string(optional)` | `''` | The text to show if the input has an error. |
779
+ | `onChange` | `(value: number) => 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. |
780
+ | `onInput` | `(value: number) => 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. |
781
+ | `onBlur` | `(value: number) => void(optional)` | `N/A` | A function that is called and passed the value every time the field loses focus. |
782
+ | `onFocus` | `(value: number) => void(optional)` | `N/A` | A function that is called and passed the value every time the field gets focused. |
783
+ | `min` | `number(optional)` | `N/A` | Sets the lower bound of your input. |
784
+ | `max` | `number(optional)` | `N/A` | Sets the upper bound of your input. |
785
+ | `precision` | `number(optional)` | `N/A` | Represents the number of digits to the right of the decimal point. |
786
+ | `precision` | `number(optional)` | `N/A` | Represents the number of digits to the right of the decimal point. |
787
+ | `formatStyle` | `'decimal' \| 'percentage'` | `'decimal'` | Formats the input as a decimal point number or a percentage. |
788
+
789
+ ##### Usage
790
+
791
+ ```javascript
792
+ const Extension = () => {
793
+ const [portalCount, setPortalCount] = useState(0);
794
+ return (
795
+ <NumberInput
796
+ label={'HubSpot Portal Count'}
797
+ name="portalsNumber"
798
+ description={'Number of active portals'}
799
+ placeholder={'number of portals'}
800
+ value={portalCount}
801
+ onChange={value => setPortalCount(value)}
802
+ />
803
+ );
804
+ };
805
+ ```
734
806
 
735
807
  ### ProgressBar
736
808
 
@@ -875,7 +947,18 @@ import { Stack } from '@hubspot/ui-extensions';
875
947
 
876
948
  ```typescript
877
949
  interface StackProps {
878
- distance?: 'flush' | 'small' | 'extra-small' | 'medium' | 'large';
950
+ distance?:
951
+ | 'flush'
952
+ | 'small'
953
+ | 'extra-small'
954
+ | 'medium'
955
+ | 'large'
956
+ | 'extra-large'
957
+ | 'xs'
958
+ | 'sm'
959
+ | 'md'
960
+ | 'lg'
961
+ | 'xl';
879
962
  direction?: 'row' | 'column';
880
963
  children?: ReactNode;
881
964
  }
@@ -883,7 +966,7 @@ interface StackProps {
883
966
 
884
967
  | Prop | Type | Default | Description |
885
968
  | --- | --- | --- | --- |
886
- | `distance` | `'flush' \| 'extra-small' \| 'small' \| 'medium' \| 'large'` | `'small'` | Amount of space between each child component passed as children |
969
+ | `distance` | `'flush' \| 'extra-small' \| 'small' \| 'medium' \| 'large' \| 'extra-large' \| 'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl'` | `'small'` | Amount of space between each child component passed as children |
887
970
  | `direction` | `'row' \| 'column'` | `'column'` | Stacks elements in the vertical or horizontal direction. |
888
971
  | `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. |
889
972
 
@@ -1465,29 +1548,36 @@ import { Text } from '@hubspot/ui-extensions';
1465
1548
  ##### Props
1466
1549
 
1467
1550
  ```typescript
1468
- interface TextProps {
1469
- format?: 'plaintext' | 'markdown';
1551
+ export interface TextFormatOptions {
1552
+ fontWeight?: 'regular' | 'bold' | 'demibold';
1553
+ italic?: boolean;
1554
+ lineDecoration?: 'none' | 'underline' | 'strikethrough';
1555
+ }
1556
+
1557
+ export type TextProps = {
1470
1558
  variant?: 'bodytext' | 'microcopy';
1559
+ inline?: boolean;
1471
1560
  children: ReactNode;
1472
- tagName?: 'p' | 'span' | 'small';
1473
- }
1561
+ format?: TextFormatOptions;
1562
+ };
1474
1563
  ```
1475
1564
 
1476
1565
  | Prop | Type | Default | Description |
1477
1566
  | --- | --- | --- | --- |
1478
- | `format` | `'plaintext' \| 'markdown'` `(optional)` | `'plaintext'` | Type of formatting for the display text. |
1567
+ | `format` | `'TextFormatOptions'` `(optional)` | `N/A` | Type of formatting options for the text. |
1479
1568
  | `children` | `string` | `N/A` | Text to be displayed as body text. |
1480
1569
  | `variant` | `'bodytext' \| 'microcopy'` | `'bodytext'` | Type of text to display |
1481
- | `tagName` | `'p' \| 'small' \| 'span'` | `'bodytext'` | Type of text element(tag) to display. |
1570
+ | `inline` | `boolean(optional)` | `false` | If `false` the text component will not insert a line break. |
1482
1571
 
1483
- #### Markdown
1572
+ #### Format Options
1484
1573
 
1485
- Markdown syntax supported in the component:
1574
+ - bold text: `{ fontWeight: 'bold' }`
1575
+ - semibold text: `{ fontWeight: 'demibold' }`
1576
+ - italicized text: `{ italic: true }`
1577
+ - strikethrough text: `{ lineDecoration: 'strikethrough' }`
1578
+ - underlined text: `{ lineDecoration: 'underline' }`
1579
+ - inline text: `<Text inline={true}/>`
1486
1580
 
1487
- - bold text: `**like this**` or `__like this__`
1488
- - italicized text: `*like this*` or `_like this_`
1489
- - inline code: `` `like this` ``
1490
- - links: `[visible anchor text](https://www.hubspot.com/)`
1491
1581
 
1492
1582
  ##### Usage
1493
1583
 
@@ -1495,10 +1585,21 @@ Markdown syntax supported in the component:
1495
1585
  const Extension = () => {
1496
1586
  return (
1497
1587
  <>
1498
- <Text format="markdown">**Bold**</Text>
1499
- <Text format="markdown">*Italics*</Text>
1500
- <Text>**Not Bold because format isn't markdown**</Text>
1501
- <Text variant="microcopy">This is going to be small</Text>
1588
+ <Text>Plain text</Text>
1589
+ <Text format={{ fontWeight: 'bold' }}>Bold</Text>
1590
+ <Text format={{ italic: true }}>Italics</Text>
1591
+ <Text format={{ fontWeight: 'bold', italic: true }}>
1592
+ Bold and Italic text
1593
+ </Text>
1594
+ <Text format={{ lineDecoration: 'strikethrough' }}>
1595
+ Strikethrough Text
1596
+ </Text>
1597
+ <Text variant="microcopy">
1598
+ Microcopy text
1599
+ <Text inline={true} format={{ fontWeight: 'bold' }}>
1600
+ with inner bold
1601
+ </Text>
1602
+ </Text>
1502
1603
  </>
1503
1604
  );
1504
1605
  };
@@ -1,4 +1,4 @@
1
- import type { AlertProps, ButtonProps, ButtonRowProps, CardProps, DescriptionListProps, DescriptionListItemProps, DividerProps, EmptyStateProps, ErrorStateProps, FormProps, HeadingProps, ImageProps, InputProps, TextareaProps, LoadingSpinnerProps, ProgressBarProps, SelectProps, TagProps, TextProps, TileProps, StackProps, StatisticsProps, StatisticsItemProps, StatisticsTrendProps, TableProps, TableElementProps, ToggleGroupProps, LinkProps } from './types';
1
+ import type { AlertProps, ButtonProps, ButtonRowProps, CardProps, DescriptionListProps, DescriptionListItemProps, DividerProps, EmptyStateProps, ErrorStateProps, FormProps, HeadingProps, ImageProps, InputProps, TextareaProps, LoadingSpinnerProps, ProgressBarProps, SelectProps, TagProps, TextProps, TileProps, StackProps, StatisticsProps, StatisticsItemProps, StatisticsTrendProps, TableProps, TableElementProps, ToggleGroupProps, LinkProps, NumberInputProps, BoxProps } from './types';
2
2
  declare const Alert: "Alert" & {
3
3
  readonly type?: "Alert" | undefined;
4
4
  readonly props?: AlertProps | undefined;
@@ -61,9 +61,9 @@ declare const Image: "Image" & {
61
61
  } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Image", ImageProps, true>>;
62
62
  declare const Input: "Input" & {
63
63
  readonly type?: "Input" | undefined;
64
- readonly props?: InputProps | undefined;
64
+ readonly props?: InputProps<string> | undefined;
65
65
  readonly children?: true | undefined;
66
- } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Input", InputProps, true>>;
66
+ } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Input", InputProps<string>, true>>;
67
67
  declare const Textarea: "Textarea" & {
68
68
  readonly type?: "Textarea" | undefined;
69
69
  readonly props?: TextareaProps | undefined;
@@ -164,4 +164,14 @@ declare const Link: "Link" & {
164
164
  readonly props?: LinkProps | undefined;
165
165
  readonly children?: true | undefined;
166
166
  } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Link", LinkProps, true>>;
167
- export { Alert, Button, ButtonRow, Card, DescriptionList, DescriptionListItem, Divider, EmptyState, ErrorState, Form, Heading, Image, Input, Textarea, LoadingSpinner, Link, ProgressBar, Select, Stack, Statistics, StatisticsItem, StatisticsTrend, Table, TableFooter, TableCell, TableRow, TableBody, TableHeader, TableHead, Tag, Text, Tile, ToggleGroup, };
167
+ declare const NumberInput: "NumberInput" & {
168
+ readonly type?: "NumberInput" | undefined;
169
+ readonly props?: NumberInputProps | undefined;
170
+ readonly children?: true | undefined;
171
+ } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"NumberInput", NumberInputProps, true>>;
172
+ declare const Box: "Box" & {
173
+ readonly type?: "Box" | undefined;
174
+ readonly props?: BoxProps | undefined;
175
+ readonly children?: true | undefined;
176
+ } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Box", BoxProps, true>>;
177
+ export { Alert, Box, Button, ButtonRow, Card, DescriptionList, DescriptionListItem, Divider, EmptyState, ErrorState, Form, Heading, Image, Input, Textarea, LoadingSpinner, Link, ProgressBar, Select, Stack, Statistics, StatisticsItem, StatisticsTrend, Table, TableFooter, TableCell, TableRow, TableBody, TableHeader, TableHead, Tag, Text, Tile, ToggleGroup, NumberInput, };
@@ -32,4 +32,6 @@ const TableBody = createRemoteReactComponent('TableBody');
32
32
  const TableHeader = createRemoteReactComponent('TableHeader');
33
33
  const TableHead = createRemoteReactComponent('TableHead');
34
34
  const Link = createRemoteReactComponent('Link');
35
- export { Alert, Button, ButtonRow, Card, DescriptionList, DescriptionListItem, Divider, EmptyState, ErrorState, Form, Heading, Image, Input, Textarea, LoadingSpinner, Link, ProgressBar, Select, Stack, Statistics, StatisticsItem, StatisticsTrend, Table, TableFooter, TableCell, TableRow, TableBody, TableHeader, TableHead, Tag, Text, Tile, ToggleGroup, };
35
+ const NumberInput = createRemoteReactComponent('NumberInput');
36
+ const Box = createRemoteReactComponent('Box');
37
+ export { Alert, Box, Button, ButtonRow, Card, DescriptionList, DescriptionListItem, Divider, EmptyState, ErrorState, Form, Heading, Image, Input, Textarea, LoadingSpinner, Link, ProgressBar, Select, Stack, Statistics, StatisticsItem, StatisticsTrend, Table, TableFooter, TableCell, TableRow, TableBody, TableHeader, TableHead, Tag, Text, Tile, ToggleGroup, NumberInput, };
@@ -1,4 +1,9 @@
1
- import { CrmAssociationPivotProps, CrmAssociationTableProps, CrmDataHighlightProps, CrmPropertyListProps, CrmReportProps } from '../types';
1
+ import { CrmAssociationPivotProps, CrmAssociationTableProps, CrmDataHighlightProps, CrmObjectPropertyProps, CrmPropertyListProps, CrmReportProps, CrmAssociationPropertyListProps } from '../types';
2
+ declare const CrmObjectProperty: "CrmObjectProperty" & {
3
+ readonly type?: "CrmObjectProperty" | undefined;
4
+ readonly props?: CrmObjectPropertyProps | undefined;
5
+ readonly children?: true | undefined;
6
+ } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"CrmObjectProperty", CrmObjectPropertyProps, true>>;
2
7
  declare const CrmPropertyList: "CrmPropertyList" & {
3
8
  readonly type?: "CrmPropertyList" | undefined;
4
9
  readonly props?: CrmPropertyListProps | undefined;
@@ -24,4 +29,9 @@ declare const CrmAssociationPivot: "CrmAssociationPivot" & {
24
29
  readonly props?: CrmAssociationPivotProps | undefined;
25
30
  readonly children?: true | undefined;
26
31
  } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"CrmAssociationPivot", CrmAssociationPivotProps, true>>;
27
- export { CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, };
32
+ declare const CrmAssociationPropertyList: "CrmAssociationPropertyList" & {
33
+ readonly type?: "CrmAssociationPropertyList" | undefined;
34
+ readonly props?: CrmAssociationPropertyListProps | undefined;
35
+ readonly children?: true | undefined;
36
+ } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"CrmAssociationPropertyList", CrmAssociationPropertyListProps, true>>;
37
+ export { CrmObjectProperty, CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmAssociationPropertyList, };
@@ -1,7 +1,9 @@
1
1
  import { createExtensionComponent } from '../utils/createExtensionComponent';
2
+ const CrmObjectProperty = createExtensionComponent('CrmObjectProperty');
2
3
  const CrmPropertyList = createExtensionComponent('CrmPropertyList');
3
4
  const CrmAssociationTable = createExtensionComponent('CrmAssociationTable');
4
5
  const CrmDataHighlight = createExtensionComponent('CrmDataHighlight');
5
6
  const CrmReport = createExtensionComponent('CrmReport');
6
7
  const CrmAssociationPivot = createExtensionComponent('CrmAssociationPivot');
7
- export { CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, };
8
+ const CrmAssociationPropertyList = createExtensionComponent('CrmAssociationPropertyList');
9
+ export { CrmObjectProperty, CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmAssociationPropertyList, };
@@ -1,2 +1,2 @@
1
- import { CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot } from './components';
2
- export { CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, };
1
+ import { CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmObjectProperty, CrmAssociationPropertyList } from './components';
2
+ export { CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmObjectProperty, CrmAssociationPropertyList, };
package/dist/crm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, } from './components';
2
- export { CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, };
1
+ import { CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmObjectProperty, CrmAssociationPropertyList, } from './components';
2
+ export { CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmObjectProperty, CrmAssociationPropertyList, };
package/dist/index.d.ts CHANGED
@@ -1,3 +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, Textarea, Tile, ToggleGroup, Link, } 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, Textarea, Tile, ToggleGroup, Link, NumberInput, Box, } 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, EmptyState, ErrorState, Form, Heading, Image, Input, LoadingSpinner, ProgressBar, Select, Stack, Statistics, StatisticsItem, StatisticsTrend, Table, TableFooter, TableCell, TableRow, TableBody, TableHeader, TableHead, Tag, Text, Textarea, Tile, ToggleGroup, Link, } 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, Textarea, Tile, ToggleGroup, Link, NumberInput, Box, } from './coreComponents';
2
2
  export { hubspot } from './hubspot';
3
3
  export * from './types';
package/dist/types.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { ReactNode, ComponentType } from 'react';
2
2
  export interface AlertProps {
3
3
  title: string;
4
- body?: string;
5
4
  children?: ReactNode;
6
5
  variant?: 'info' | 'warning' | 'success' | 'error' | 'danger';
7
6
  }
@@ -29,7 +28,7 @@ export interface DescriptionListProps {
29
28
  direction?: 'row' | 'column';
30
29
  }
31
30
  export interface DividerProps {
32
- distance?: 'flush' | 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large';
31
+ distance?: AllDistances;
33
32
  }
34
33
  export interface EmptyStateProps {
35
34
  flush?: boolean;
@@ -60,22 +59,24 @@ export interface ImageProps {
60
59
  onClick?: () => void;
61
60
  src: string;
62
61
  width?: number;
62
+ height?: number;
63
63
  }
64
- export interface InputProps {
64
+ export interface InputProps<T = string> {
65
65
  label: string;
66
66
  name: string;
67
- value?: string;
67
+ value?: T;
68
68
  required?: boolean;
69
69
  readOnly?: boolean;
70
70
  description?: string;
71
71
  tooltip?: string;
72
72
  placeholder?: string;
73
73
  error?: boolean;
74
+ defaultValue?: T;
74
75
  validationMessage?: string;
75
- onChange?: (value: string) => void;
76
- onInput?: (value: string) => void;
77
- onBlur?: (value: string) => void;
78
- onFocus?: (value: string) => void;
76
+ onChange?: (value: T) => void;
77
+ onInput?: (value: T) => void;
78
+ onBlur?: (value: T) => void;
79
+ onFocus?: (value: T) => void;
79
80
  }
80
81
  export interface TextareaProps extends InputProps {
81
82
  cols?: number;
@@ -83,6 +84,12 @@ export interface TextareaProps extends InputProps {
83
84
  rows?: number;
84
85
  resize?: 'vertical' | 'horizontal' | 'both' | 'none';
85
86
  }
87
+ export interface NumberInputProps extends InputProps<number> {
88
+ min?: number;
89
+ max?: number;
90
+ precision?: number;
91
+ formatStyle?: 'decimal' | 'percentage';
92
+ }
86
93
  export interface ProgressBarProps {
87
94
  title?: string;
88
95
  showPercentage?: boolean;
@@ -194,9 +201,12 @@ export interface Context {
194
201
  portal: PortalContext;
195
202
  }
196
203
  export interface StackProps {
197
- distance?: 'flush' | 'small' | 'extra-small' | 'medium' | 'large';
204
+ distance?: AllDistances;
198
205
  children?: React.ReactNode;
199
206
  direction?: 'row' | 'column';
207
+ justify?: 'center' | 'end' | 'start';
208
+ align?: 'start' | 'center' | 'baseline' | 'end' | 'stretch';
209
+ width?: 'auto' | '100%';
200
210
  }
201
211
  export interface StatisticsTrendProps {
202
212
  value: string;
@@ -257,6 +267,8 @@ export interface ServerlessExecutionRequest {
257
267
  type: 'SERVERLESS_ACTION_HOOK';
258
268
  payload: JsonValue;
259
269
  };
270
+ objectId?: number;
271
+ objectTypeId?: string;
260
272
  }
261
273
  export interface ServerlessExecutionResponse {
262
274
  logId: string;
@@ -310,10 +322,12 @@ export interface CrmMiddleExtensionPoint extends ExtensionPointContract {
310
322
  CrmDataHighlight: ComponentType<CrmDataHighlightProps>;
311
323
  CrmReport: ComponentType<CrmReportProps>;
312
324
  CrmAssociationPivot: ComponentType<CrmAssociationPivotProps>;
325
+ CrmObjectProperty?: ComponentType<CrmObjectPropertyProps>;
326
+ CrmAssociationPropertyList?: ComponentType<CrmAssociationPropertyListProps>;
313
327
  };
314
328
  }
315
329
  export interface CrmDataHighlightProps {
316
- properties: string[];
330
+ properties: Array<string>;
317
331
  objectTypeId?: string;
318
332
  objectId?: number;
319
333
  }
@@ -321,17 +335,22 @@ export interface CrmReportProps {
321
335
  reportId: string;
322
336
  }
323
337
  export interface CrmPropertyListProps {
324
- properties: string[];
338
+ properties: Array<string>;
325
339
  direction?: string;
326
340
  objectTypeId?: string;
327
341
  objectId?: number;
328
342
  }
343
+ export interface CrmObjectPropertyProps {
344
+ properties: Array<string>;
345
+ objectTypeId?: string;
346
+ objectId?: number;
347
+ }
329
348
  type CrmSortDescriptor = {
330
349
  columnName: string;
331
350
  direction: 1 | -1;
332
351
  };
333
352
  interface CrmSearchFilter {
334
- operator: 'EQ' | 'NEQ' | 'LT' | 'LTE' | 'GT' | 'GTE' | 'BETWEEN' | 'IN' | 'NOT_IN' | 'HAS_PROPERTY' | 'NOT_HAS_PROPERTY' | 'ROLLING_DATE_RANGE' | 'TIME_UNIT_TO_DATE';
353
+ operator: 'EQ' | 'NEQ' | 'LT' | 'LTE' | 'GT' | 'GTE' | 'BETWEEN' | 'IN' | 'NOT_IN' | 'HAS_PROPERTY' | 'NOT_HAS_PROPERTY';
335
354
  value?: string | number;
336
355
  values?: string | number;
337
356
  highValue?: string | number;
@@ -354,6 +373,13 @@ export interface CrmAssociationPivotProps {
354
373
  preFilters?: Array<CrmSearchFilter>;
355
374
  sort?: Array<CrmSortDescriptor>;
356
375
  }
376
+ export interface CrmAssociationPropertyListProps {
377
+ objectTypeId: string;
378
+ properties: Array<string>;
379
+ associationLabels?: Array<string>;
380
+ filters?: Array<CrmSearchFilter>;
381
+ sort?: Array<CrmSortDescriptor>;
382
+ }
357
383
  interface CrmSidebarExtensionPoint extends ExtensionPointContract {
358
384
  actions: {
359
385
  reloadPage: ReloadPageAction;
@@ -391,7 +417,7 @@ interface OpenIframeActionPayload {
391
417
  export interface LoadingSpinnerProps {
392
418
  label: string;
393
419
  showLabel?: boolean;
394
- size?: 'xs' | 'sm' | 'md';
420
+ size?: TShirtSizes['xs'] | TShirtSizes['sm'] | TShirtSizes['md'];
395
421
  layout?: 'inline' | 'centered';
396
422
  }
397
423
  export interface TableElementProps {
@@ -426,8 +452,23 @@ export interface LinkProps {
426
452
  children: ReactNode;
427
453
  href: string;
428
454
  variant?: 'primary' | 'destructive' | 'light' | 'dark';
455
+ onClick?: () => void;
429
456
  }
430
457
  export type JsonValue = string | number | boolean | null | JsonValue[] | {
431
458
  [key: string]: JsonValue;
432
459
  };
460
+ export interface BoxProps {
461
+ children: ReactNode;
462
+ grow?: boolean;
463
+ alignSelf?: 'start' | 'center' | 'baseline' | 'end' | 'stretch' | 'auto';
464
+ }
465
+ interface TShirtSizes {
466
+ xs: 'extra-small' | 'xs';
467
+ sm: 'small' | 'sm';
468
+ md: 'medium' | 'md';
469
+ lg: 'large' | 'lg';
470
+ xl: 'extra-large' | 'xl';
471
+ }
472
+ export type AllSizes = TShirtSizes['xs'] | TShirtSizes['sm'] | TShirtSizes['md'] | TShirtSizes['lg'] | TShirtSizes['xl'];
473
+ export type AllDistances = 'flush' | AllSizes;
433
474
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/ui-extensions",
3
- "version": "0.0.1-beta.0",
3
+ "version": "0.0.1-beta.2",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -48,5 +48,5 @@
48
48
  "devDependencies": {
49
49
  "typescript": "5.0.4"
50
50
  },
51
- "gitHead": "0bfb66cacc456a73f05a40841938e6b42f87aaba"
51
+ "gitHead": "3bad0a556e00ca7c628916da199bb6f6b787ad6f"
52
52
  }