@hubspot/ui-extensions 0.8.2 → 0.8.4

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.
@@ -221,3 +221,19 @@ export declare const List: "List" & {
221
221
  readonly props?: types.ListProps | undefined;
222
222
  readonly children?: true | undefined;
223
223
  } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"List", types.ListProps, true>>;
224
+ export declare const Toggle: "Toggle" & {
225
+ readonly type?: "Toggle" | undefined;
226
+ readonly props?: types.ToggleProps | undefined;
227
+ readonly children?: true | undefined;
228
+ } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Toggle", types.ToggleProps, true>>;
229
+ /** @experimental */
230
+ export declare const Panel: "Panel" & {
231
+ readonly type?: "Panel" | undefined;
232
+ readonly props?: types.PanelProps | undefined;
233
+ readonly children?: true | undefined;
234
+ } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Panel", types.PanelProps, true>>;
235
+ export declare const Dropdown: "Dropdown" & {
236
+ readonly type?: "Dropdown" | undefined;
237
+ readonly props?: types.DropdownProps | undefined;
238
+ readonly children?: true | undefined;
239
+ } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Dropdown", types.DropdownProps, true>>;
@@ -47,3 +47,9 @@ export const DateInput = createRemoteReactComponent('DateInput');
47
47
  export const Checkbox = createRemoteReactComponent('Checkbox');
48
48
  export const RadioButton = createRemoteReactComponent('RadioButton');
49
49
  export const List = createRemoteReactComponent('List');
50
+ export const Toggle = createRemoteReactComponent('Toggle');
51
+ /** @experimental */
52
+ export const Panel = createRemoteReactComponent('Panel', {
53
+ fragmentProps: ['footer'],
54
+ });
55
+ export const Dropdown = createRemoteReactComponent('Dropdown');
@@ -1,4 +1,4 @@
1
- import { CrmAssociationPivotProps, CrmAssociationTableProps, CrmDataHighlightProps, CrmObjectPropertyProps, CrmPropertyListProps, CrmReportProps, CrmAssociationPropertyListProps, CrmStageTrackerProps, CrmActionButtonProps, CrmActionLinkProps, CrmCardActionsProps } from '../types';
1
+ import { CrmAssociationPivotProps, CrmAssociationTableProps, CrmDataHighlightProps, CrmObjectPropertyProps, CrmPropertyListProps, CrmReportProps, CrmAssociationPropertyListProps, CrmStageTrackerProps, CrmStatisticsProps, CrmActionButtonProps, CrmActionLinkProps, CrmCardActionsProps } from '../types';
2
2
  declare const CrmObjectProperty: "CrmObjectProperty" & {
3
3
  readonly type?: "CrmObjectProperty" | undefined;
4
4
  readonly props?: CrmObjectPropertyProps | undefined;
@@ -39,6 +39,11 @@ declare const CrmStageTracker: "CrmStageTracker" & {
39
39
  readonly props?: CrmStageTrackerProps | undefined;
40
40
  readonly children?: true | undefined;
41
41
  } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"CrmStageTracker", CrmStageTrackerProps, true>>;
42
+ declare const CrmStatistics: "CrmStatistics" & {
43
+ readonly type?: "CrmStatistics" | undefined;
44
+ readonly props?: CrmStatisticsProps | undefined;
45
+ readonly children?: true | undefined;
46
+ } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"CrmStatistics", CrmStatisticsProps, true>>;
42
47
  declare const CrmActionButton: "CrmActionButton" & {
43
48
  readonly type?: "CrmActionButton" | undefined;
44
49
  readonly props?: CrmActionButtonProps | undefined;
@@ -54,4 +59,4 @@ declare const CrmCardActions: "CrmCardActions" & {
54
59
  readonly props?: CrmCardActionsProps | undefined;
55
60
  readonly children?: true | undefined;
56
61
  } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"CrmCardActions", CrmCardActionsProps, true>>;
57
- export { CrmObjectProperty, CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmAssociationPropertyList, CrmStageTracker, CrmActionButton, CrmActionLink, CrmCardActions, };
62
+ export { CrmObjectProperty, CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmAssociationPropertyList, CrmStageTracker, CrmStatistics, CrmActionButton, CrmActionLink, CrmCardActions, };
@@ -7,7 +7,8 @@ const CrmReport = createExtensionComponent('CrmReport');
7
7
  const CrmAssociationPivot = createExtensionComponent('CrmAssociationPivot');
8
8
  const CrmAssociationPropertyList = createExtensionComponent('CrmAssociationPropertyList');
9
9
  const CrmStageTracker = createExtensionComponent('CrmStageTracker');
10
+ const CrmStatistics = createExtensionComponent('CrmStatistics');
10
11
  const CrmActionButton = createExtensionComponent('CrmActionButton');
11
12
  const CrmActionLink = createExtensionComponent('CrmActionLink');
12
13
  const CrmCardActions = createExtensionComponent('CrmCardActions');
13
- export { CrmObjectProperty, CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmAssociationPropertyList, CrmStageTracker, CrmActionButton, CrmActionLink, CrmCardActions, };
14
+ export { CrmObjectProperty, CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmAssociationPropertyList, CrmStageTracker, CrmStatistics, CrmActionButton, CrmActionLink, CrmCardActions, };
@@ -1,2 +1,2 @@
1
- import { CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmObjectProperty, CrmAssociationPropertyList, CrmStageTracker, CrmActionButton, CrmActionLink, CrmCardActions } from './components';
2
- export { CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmObjectProperty, CrmAssociationPropertyList, CrmStageTracker, CrmActionButton, CrmActionLink, CrmCardActions, };
1
+ import { CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmObjectProperty, CrmAssociationPropertyList, CrmStageTracker, CrmStatistics, CrmActionButton, CrmActionLink, CrmCardActions } from './components';
2
+ export { CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmObjectProperty, CrmAssociationPropertyList, CrmStageTracker, CrmStatistics, CrmActionButton, CrmActionLink, CrmCardActions, };
package/dist/crm/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import { CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmObjectProperty, CrmAssociationPropertyList, CrmStageTracker, CrmActionButton, CrmActionLink, CrmCardActions, } from './components';
2
- export { CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmObjectProperty, CrmAssociationPropertyList, CrmStageTracker, CrmActionButton, CrmActionLink, CrmCardActions, };
1
+ import { CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmObjectProperty, CrmAssociationPropertyList, CrmStageTracker, CrmStatistics, CrmActionButton, CrmActionLink, CrmCardActions, } from './components';
2
+ export { CrmPropertyList, CrmAssociationTable, CrmDataHighlight, CrmReport, CrmAssociationPivot, CrmObjectProperty, CrmAssociationPropertyList, CrmStageTracker, CrmStatistics, CrmActionButton, CrmActionLink, CrmCardActions, };
package/dist/hubspot.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { ReactElement } from 'react';
2
- import type { ExtensionPoints, ExtensionPointApi } from './types';
2
+ import { ExtensionPoints, ExtensionPointApi } from './types';
3
+ export declare function extend_V2<ExtensionPointName extends keyof ExtensionPoints>(renderExtensionCallback: (api: ExtensionPointApi<ExtensionPointName>) => ReactElement<any>): any;
3
4
  export declare const hubspot: {
4
- extend: typeof render;
5
+ extend: typeof extend_V2;
5
6
  };
6
- declare function render<ExtensionPointName extends keyof ExtensionPoints>(renderCallback: (api: ExtensionPointApi<ExtensionPointName>) => ReactElement<any>): any;
7
- export {};
package/dist/hubspot.js CHANGED
@@ -1,17 +1,6 @@
1
- /* eslint-disable hubspot-dev/no-confusing-browser-globals */
2
- import { createRoot } from '@remote-ui/react';
3
- import { isValidElement } from 'react';
1
+ export function extend_V2(renderExtensionCallback) {
2
+ return self.extend_V2(renderExtensionCallback);
3
+ }
4
4
  export const hubspot = {
5
- extend: render,
5
+ extend: extend_V2,
6
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/types.d.ts CHANGED
@@ -1,4 +1,15 @@
1
1
  import { ReactNode, ComponentType } from 'react';
2
+ export declare class ExtensionEvent {
3
+ type: string;
4
+ bubbles: boolean;
5
+ timeStamp: number;
6
+ id: string;
7
+ constructor(event: Event);
8
+ }
9
+ export declare class FormSubmitExtensionEvent<V> extends ExtensionEvent {
10
+ targetValue: V;
11
+ constructor(value: V, event: Event);
12
+ }
2
13
  /**
3
14
  * The props type for {@link !components.Alert}.
4
15
  *
@@ -29,11 +40,11 @@ export interface AlertProps {
29
40
  */
30
41
  export interface ButtonProps {
31
42
  /**
32
- * A function that will be invoked when the button is clicked. It receives no arguments and its return value is ignored.
43
+ * A function that will be invoked when the button is clicked.
33
44
  *
34
45
  * @event
35
46
  */
36
- onClick?: () => void;
47
+ onClick?: (event: ExtensionEvent, reactions: Reactions) => void;
37
48
  /**
38
49
  * A URL that will be opened when the button is clicked. If the value is a URL external to `hubspot.com` it will be opened in a new tab.
39
50
  */
@@ -58,6 +69,12 @@ export interface ButtonProps {
58
69
  * The displayable text for the Button.
59
70
  */
60
71
  children: ReactNode;
72
+ /**
73
+ * Sets the size of the button.
74
+ *
75
+ * @defaultValue `"md"`
76
+ */
77
+ size?: TShirtSizes['xs'] | TShirtSizes['sm'] | TShirtSizes['md'];
61
78
  }
62
79
  /**
63
80
  * The props type for {@link !components.ButtonRow}.
@@ -214,11 +231,11 @@ export interface FormProps {
214
231
  */
215
232
  children: ReactNode;
216
233
  /**
217
- * The function that is called when the form is submitted. It will receive a RemoteEvent as an argument and its return value will be ignored.
234
+ * The function that is called when the form is submitted. It will receive a FormSubmitExtensionEvent as an argument and its return value will be ignored.
218
235
  *
219
236
  * @event
220
237
  */
221
- onSubmit?: (event: RemoteEvent<FormInputValues>) => void;
238
+ onSubmit?: (event: FormSubmitExtensionEvent<FormInputValues>, reactions: Reactions) => void;
222
239
  /**
223
240
  * When set to `true`, `event.preventDefault()` will be invoked before the `onSubmit` function is called, preventing the default HTML form behavior.
224
241
  *
@@ -261,11 +278,11 @@ export interface ImageProps {
261
278
  */
262
279
  href?: string;
263
280
  /**
264
- * A function that will be called when the image is clicked. This function will receive no arguments and any returned values will be ignored.
281
+ * A function that will be called when the image is clicked.
265
282
  *
266
283
  * @event
267
284
  */
268
- onClick?: () => void;
285
+ onClick?: (event: ExtensionEvent, reactions: Reactions) => void;
269
286
  /**
270
287
  * The URL of the image to display.
271
288
  *
@@ -701,11 +718,11 @@ export interface TagProps {
701
718
  */
702
719
  variant?: 'default' | 'warning' | 'success' | 'error';
703
720
  /**
704
- * A function that will be invoked when the tag is clicked. It receives no argument and its return value is ignored.
721
+ * A function that will be invoked when the tag is clicked.
705
722
  *
706
723
  * @event
707
724
  */
708
- onClick?: () => void;
725
+ onClick?: (event: ExtensionEvent, reactions: Reactions) => void;
709
726
  }
710
727
  /**
711
728
  * @internal
@@ -769,7 +786,24 @@ export type TextProps = {
769
786
  * - <Text inline={true}>
770
787
  */
771
788
  format?: TextFormatOptions;
789
+ /**
790
+ * @interface
791
+ * truncates long strings to a single line. If the full string doesn’t fit in one line,
792
+ * it’s shown in a tooltip on hover.
793
+ *
794
+ * - `false` => no truncation(default).
795
+ * - `true` => truncates the string to a single line. Full-text will show inside the tooltip.
796
+ * - { toolipText: 'some text' } => truncates the string and lets you control the contents of the tooltip.
797
+ * - { maxWidth: 150 } => sets the width(in pixel) of the line.
798
+ *
799
+ * @defaultValue `false`
800
+ */
801
+ truncate?: boolean | TruncateOptions;
772
802
  };
803
+ export interface TruncateOptions {
804
+ maxWidth?: number;
805
+ toolipText?: string;
806
+ }
773
807
  /**
774
808
  * The props type for {@link !components.Tile}.
775
809
  *
@@ -987,10 +1021,24 @@ export interface PortalContext {
987
1021
  timezone: string;
988
1022
  }
989
1023
  /** @ignore */
990
- export interface Context {
1024
+ export interface CrmRecordContext {
1025
+ objectId: number;
1026
+ objectTypeId: string;
1027
+ }
1028
+ /** @ignore */
1029
+ export interface BaseContext {
991
1030
  user: UserContext;
992
1031
  portal: PortalContext;
993
1032
  }
1033
+ /** @ignore */
1034
+ export interface CrmContext extends BaseContext {
1035
+ location: 'crm.record.tab' | 'crm.record.sidebar';
1036
+ crm: CrmRecordContext;
1037
+ }
1038
+ /** @ignore */
1039
+ export interface GenericContext extends BaseContext {
1040
+ location: 'uie.playground.middle';
1041
+ }
994
1042
  export interface StackProps {
995
1043
  distance?: AllDistances;
996
1044
  children?: React.ReactNode;
@@ -1202,6 +1250,7 @@ export interface ExtensionPointContract {
1202
1250
  actions?: {
1203
1251
  [k: string]: ExtensionPointAction;
1204
1252
  } | {};
1253
+ context: BaseContext;
1205
1254
  customComponents: Record<string, ComponentType<any>>;
1206
1255
  }
1207
1256
  /** @ignore */
@@ -1218,22 +1267,27 @@ export type FetchCrmObjectPropertiesAction = (properties: string[]) => Promise<R
1218
1267
  /** @ignore */
1219
1268
  export type OpenIframeModalAction = (action: OpenIframeActionPayload) => void;
1220
1269
  /** @ignore */
1270
+ export type refreshObjectPropertiesAction = () => void;
1271
+ /** @ignore */
1221
1272
  export interface CrmMiddleExtensionPoint extends ExtensionPointContract {
1222
1273
  actions: {
1223
1274
  addAlert: AddAlertAction;
1224
1275
  reloadPage: ReloadPageAction;
1225
1276
  fetchCrmObjectProperties: FetchCrmObjectPropertiesAction;
1226
1277
  openIframeModal: OpenIframeModalAction;
1278
+ refreshObjectProperties?: refreshObjectPropertiesAction;
1227
1279
  };
1280
+ context: CrmContext;
1228
1281
  customComponents: {
1229
1282
  CrmPropertyList: ComponentType<CrmPropertyListProps>;
1230
1283
  CrmAssociationTable: ComponentType<CrmAssociationTableProps>;
1231
1284
  CrmDataHighlight: ComponentType<CrmDataHighlightProps>;
1232
1285
  CrmReport: ComponentType<CrmReportProps>;
1233
1286
  CrmAssociationPivot: ComponentType<CrmAssociationPivotProps>;
1234
- CrmObjectProperty?: ComponentType<CrmObjectPropertyProps>;
1235
- CrmAssociationPropertyList?: ComponentType<CrmAssociationPropertyListProps>;
1236
- CrmStageTracker?: ComponentType<CrmStageTrackerProps>;
1287
+ CrmObjectProperty: ComponentType<CrmObjectPropertyProps>;
1288
+ CrmAssociationPropertyList: ComponentType<CrmAssociationPropertyListProps>;
1289
+ CrmStageTracker: ComponentType<CrmStageTrackerProps>;
1290
+ CrmStatistics?: ComponentType<CrmStatisticsProps>;
1237
1291
  CrmActionButton?: ComponentType<CrmActionButtonProps>;
1238
1292
  CrmActionLink?: ComponentType<CrmActionLinkProps>;
1239
1293
  CrmCardActions?: ComponentType<CrmCardActionsProps>;
@@ -1246,7 +1300,9 @@ export interface CrmSidebarExtensionPoint extends ExtensionPointContract {
1246
1300
  reloadPage: ReloadPageAction;
1247
1301
  fetchCrmObjectProperties: FetchCrmObjectPropertiesAction;
1248
1302
  openIframeModal: OpenIframeModalAction;
1303
+ refreshObjectProperties?: refreshObjectPropertiesAction;
1249
1304
  };
1305
+ context: CrmContext;
1250
1306
  customComponents: {
1251
1307
  [k: string]: never;
1252
1308
  };
@@ -1323,6 +1379,34 @@ export interface CrmStageTrackerProps {
1323
1379
  showProperties?: boolean;
1324
1380
  }
1325
1381
  /** @ignore */
1382
+ interface BaseCrmStatisticItem {
1383
+ label: string;
1384
+ }
1385
+ /** @ignore */
1386
+ interface FilterGroup {
1387
+ filters: Array<CrmSearchFilter>;
1388
+ }
1389
+ /** @ignore */
1390
+ interface BasicMetricItem extends BaseCrmStatisticItem {
1391
+ statisticType: 'SUM' | 'AVG' | 'MIN' | 'MAX' | 'DISTINCT_APPROX' | 'COUNT';
1392
+ propertyName: string;
1393
+ filterGroups?: Array<FilterGroup>;
1394
+ }
1395
+ /** @ignore */
1396
+ interface PercentileMetricItem extends BaseCrmStatisticItem {
1397
+ statisticType: 'PERCENTILES';
1398
+ propertyName: string;
1399
+ percentile: number;
1400
+ filterGroups?: Array<FilterGroup>;
1401
+ }
1402
+ /** @ignore */
1403
+ type CrmStatisticItem = BasicMetricItem | PercentileMetricItem;
1404
+ /** @ignore */
1405
+ export interface CrmStatisticsProps {
1406
+ objectTypeId: string;
1407
+ statistics: Array<CrmStatisticItem>;
1408
+ }
1409
+ /** @ignore */
1326
1410
  interface ObjectCoordinates {
1327
1411
  objectTypeId: string;
1328
1412
  objectId: number;
@@ -1404,6 +1488,7 @@ interface RemotePlaygroundExtensionPoint extends ExtensionPointContract {
1404
1488
  actions: {
1405
1489
  warn: () => void;
1406
1490
  };
1491
+ context: GenericContext;
1407
1492
  customComponents: {
1408
1493
  ExampleCrmComponent: ComponentType<ExampleCrmComponentProps>;
1409
1494
  };
@@ -1420,10 +1505,17 @@ export interface ExampleCrmComponentProps {
1420
1505
  count: number;
1421
1506
  }
1422
1507
  /** @ignore */
1508
+ export type PanelAction = (panelId: string) => void;
1509
+ /** @ignore */
1510
+ export interface Reactions {
1511
+ openPanel: PanelAction;
1512
+ closePanel: PanelAction;
1513
+ }
1514
+ /** @ignore */
1423
1515
  export interface ExtensionPointApi<ExtensionPointName extends keyof ExtensionPoints> {
1424
- context: Context;
1425
1516
  runServerlessFunction: ServerlessFuncRunner;
1426
1517
  actions: ExtensionPoints[ExtensionPointName]['actions'];
1518
+ context: ExtensionPoints[ExtensionPointName]['context'];
1427
1519
  }
1428
1520
  /** @ignore */
1429
1521
  interface OpenIframeActionPayload {
@@ -1596,6 +1688,7 @@ export interface TablePaginatedProps extends BaseTableProps {
1596
1688
  * @category Component Props
1597
1689
  */
1598
1690
  export type TableProps = TableNoPaginatedProps | TablePaginatedProps;
1691
+ /** @deprecated use ExtensionEvent/FormSubmitExtensionEvent instead */
1599
1692
  export declare class RemoteEvent<V> {
1600
1693
  type: string;
1601
1694
  bubbles: boolean;
@@ -1626,11 +1719,11 @@ export interface LinkProps {
1626
1719
  */
1627
1720
  variant?: 'primary' | 'destructive' | 'light' | 'dark';
1628
1721
  /**
1629
- * A function that will be invoked with the link is clicked. The function receives no arguments and its return value is ignored.
1722
+ * A function that will be invoked with the link is clicked.
1630
1723
  *
1631
1724
  * @event
1632
1725
  */
1633
- onClick?: () => void;
1726
+ onClick?: (event: ExtensionEvent, reactions: Reactions) => void;
1634
1727
  /**
1635
1728
  * When set to true, `event.preventDefault()` will be invoked before the `onClick` function is called, preventing automatic navigation to the href URL.
1636
1729
  *
@@ -1786,4 +1879,162 @@ export interface ListProps {
1786
1879
  */
1787
1880
  variant?: 'unordered' | 'unordered-styled' | 'ordered' | 'ordered-styled' | 'inline' | 'inline-divided';
1788
1881
  }
1882
+ /**
1883
+ * The props type for {@link !components.Toggle}.
1884
+ *
1885
+ * @category Component Props
1886
+ */
1887
+ export interface ToggleProps {
1888
+ /**
1889
+ * The current status of the input.
1890
+ */
1891
+ checked?: boolean;
1892
+ /**
1893
+ * When set to `true`, the option cannot be selected.
1894
+ */
1895
+ readonly?: boolean;
1896
+ /**
1897
+ * The unique identifier for the toggle element.
1898
+ */
1899
+ name?: string;
1900
+ /**
1901
+ * The size variation of the toggle.
1902
+ *
1903
+ * @defaultValue `"medium"`
1904
+ */
1905
+ size?: TShirtSizes['xs'] | TShirtSizes['sm'] | TShirtSizes['md'] | 'default';
1906
+ /**
1907
+ * A function that is called when the `checked` input status changes.
1908
+ *
1909
+ * @event
1910
+ */
1911
+ onChange?: (checked: boolean) => void;
1912
+ /**
1913
+ * When set to `true`, the option will be selected by default. Use it to
1914
+ * set the default `checked` state when the component is **uncontrolled**.
1915
+ */
1916
+ initialIsChecked?: boolean;
1917
+ /**
1918
+ * The companion text of for Toggle. It can be displayed on top,
1919
+ * inline, or hidden. When hidden, it will remain usable for screen readers.
1920
+ */
1921
+ label: string;
1922
+ /**
1923
+ * Controls the display setting of the label prop.
1924
+ *
1925
+ * @defaultValue `"inline"`
1926
+ */
1927
+ labelDisplay?: 'inline' | 'top' | 'hidden';
1928
+ /**
1929
+ * The text that appears on the Toggle when `checked={true}`.
1930
+ *
1931
+ * @defaultValue `"ON"`
1932
+ */
1933
+ textChecked?: string;
1934
+ /**
1935
+ * The text that appears on the Toggle when `checked={false}`.
1936
+ *
1937
+ * @defaultValue `"ON"`
1938
+ */
1939
+ textUnchecked?: string;
1940
+ }
1941
+ export interface PanelProps {
1942
+ /**
1943
+ * Accessibility label.
1944
+ *
1945
+ */
1946
+ 'aria-label'?: string;
1947
+ /**
1948
+ * The main content of the panel when it opens.
1949
+ *
1950
+ */
1951
+ children?: React.ReactNode;
1952
+ /**
1953
+ * A unique ID for the panel
1954
+ *
1955
+ */
1956
+ id: string;
1957
+ /**
1958
+ * A function that will be invoked when the panel has finished opening.
1959
+ *
1960
+ */
1961
+ onOpen?: () => void;
1962
+ /**
1963
+ * A function that will be invoked when the panel has finished closing.
1964
+ *
1965
+ */
1966
+ onClose?: () => void;
1967
+ /**
1968
+ * The width of the panel
1969
+ *
1970
+ * @defaultValue `"sm"`
1971
+ */
1972
+ width?: TShirtSizes['sm'] | TShirtSizes['md'] | TShirtSizes['lg'];
1973
+ /**
1974
+ * The title of the panel
1975
+ *
1976
+ */
1977
+ title?: string;
1978
+ /**
1979
+ * The Footer of the panel
1980
+ *
1981
+ */
1982
+ footer?: React.ReactNode;
1983
+ /**
1984
+ * When set to `true`, the table will not have side padding.
1985
+ *
1986
+ * @defaultValue `false`
1987
+ */
1988
+ flush?: boolean;
1989
+ /**
1990
+ * The variant of the panel
1991
+ *
1992
+ * @defaultValue `"default"`
1993
+ */
1994
+ variant?: 'modal' | 'default';
1995
+ }
1996
+ export interface DropdownOption {
1997
+ /**
1998
+ * Text to be displayed as the menu item text.
1999
+ *
2000
+ */
2001
+ label: string;
2002
+ /**
2003
+ * A function that will be invoked when the item is clicked.
2004
+ * It receives no arguments and its return value is ignored.
2005
+ *
2006
+ * @event
2007
+ */
2008
+ onClick?: () => void;
2009
+ }
2010
+ /**
2011
+ * The props type for {@link !components.Dropdown}.
2012
+ *
2013
+ * @category Component Props
2014
+ */
2015
+ export interface DropdownProps {
2016
+ /**
2017
+ * The list of options to be rendered within the dropdown menu.
2018
+ * Each option represents an entry in the Dropdown.
2019
+ */
2020
+ options: DropdownOption[];
2021
+ /**
2022
+ * Controls the appearance of the dropdown button
2023
+ *
2024
+ * @defaultValue `"secondary"`
2025
+ */
2026
+ variant?: 'primary' | 'secondary' | 'transparent';
2027
+ /**
2028
+ * Sets the content for the dropdown button.
2029
+ *
2030
+ * @defaultValue `"More"`
2031
+ */
2032
+ buttonText?: string;
2033
+ /**
2034
+ * Sets the size of the dropdown button.
2035
+ *
2036
+ * @defaultValue `"md"`
2037
+ */
2038
+ buttonSize?: TShirtSizes['xs'] | TShirtSizes['sm'] | TShirtSizes['md'];
2039
+ }
1789
2040
  export {};
package/dist/types.js CHANGED
@@ -1,3 +1,22 @@
1
+ export class ExtensionEvent {
2
+ type;
3
+ bubbles;
4
+ timeStamp;
5
+ id;
6
+ constructor(event) {
7
+ this.bubbles = event.bubbles;
8
+ this.type = event.type;
9
+ this.timeStamp = event.timeStamp;
10
+ this.id = crypto.randomUUID();
11
+ }
12
+ }
13
+ export class FormSubmitExtensionEvent extends ExtensionEvent {
14
+ targetValue;
15
+ constructor(value, event) {
16
+ super(event);
17
+ this.targetValue = value;
18
+ }
19
+ }
1
20
  /**
2
21
  * @category Serverless
3
22
  */
@@ -6,6 +25,7 @@ export var ServerlessExecutionStatus;
6
25
  ServerlessExecutionStatus["Success"] = "SUCCESS";
7
26
  ServerlessExecutionStatus["Error"] = "ERROR";
8
27
  })(ServerlessExecutionStatus || (ServerlessExecutionStatus = {}));
28
+ /** @deprecated use ExtensionEvent/FormSubmitExtensionEvent instead */
9
29
  export class RemoteEvent {
10
30
  type;
11
31
  bubbles;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/ui-extensions",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -50,5 +50,5 @@
50
50
  "devDependencies": {
51
51
  "typescript": "5.0.4"
52
52
  },
53
- "gitHead": "19c43b6956e7a2397e0b4435b3829bd3e3b5e5bc"
53
+ "gitHead": "41e3484343d34136e81540d774a101ccf99642b3"
54
54
  }