@hubspot/ui-extensions 0.8.1 → 0.8.3

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.
@@ -211,3 +211,24 @@ export declare const Checkbox: "Checkbox" & {
211
211
  readonly props?: types.CheckboxProps | undefined;
212
212
  readonly children?: true | undefined;
213
213
  } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Checkbox", types.CheckboxProps, true>>;
214
+ export declare const RadioButton: "RadioButton" & {
215
+ readonly type?: "RadioButton" | undefined;
216
+ readonly props?: types.RadioButtonProps | undefined;
217
+ readonly children?: true | undefined;
218
+ } & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"RadioButton", types.RadioButtonProps, true>>;
219
+ export declare const List: "List" & {
220
+ readonly type?: "List" | undefined;
221
+ readonly props?: types.ListProps | undefined;
222
+ readonly children?: true | undefined;
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>>;
@@ -45,3 +45,10 @@ export const MultiSelect = createRemoteReactComponent('MultiSelect');
45
45
  export const Flex = createRemoteReactComponent('Flex');
46
46
  export const DateInput = createRemoteReactComponent('DateInput');
47
47
  export const Checkbox = createRemoteReactComponent('Checkbox');
48
+ export const RadioButton = createRemoteReactComponent('RadioButton');
49
+ export const List = createRemoteReactComponent('List');
50
+ export const Toggle = createRemoteReactComponent('Toggle');
51
+ /** @experimental */
52
+ export const Panel = createRemoteReactComponent('Panel', {
53
+ fragmentProps: ['footer'],
54
+ });
@@ -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/types.d.ts CHANGED
@@ -365,10 +365,16 @@ interface BaseInputProps<T = string, V = string> {
365
365
  /**
366
366
  * The props type for {@link !components.Input}.
367
367
  *
368
- * @interface
369
368
  * @category Component Props
370
369
  */
371
- export type InputProps = BaseInputProps;
370
+ export interface InputProps extends BaseInputProps {
371
+ /**
372
+ * Sets the type of input to render.
373
+ *
374
+ * @defaultValue `"text"`
375
+ */
376
+ type?: 'text' | 'password';
377
+ }
372
378
  /**
373
379
  * The props type for {@link !components.TextArea}.
374
380
  *
@@ -787,14 +793,19 @@ interface Team {
787
793
  name: string;
788
794
  teammates: number[];
789
795
  }
796
+ /**
797
+ * The props type for {@link !components.Checkbox}.
798
+ *
799
+ * @category Component Props
800
+ */
790
801
  export interface CheckboxProps {
791
802
  /**
792
- * A string representing the value of the checkbox. This is not displayed on the client-side,
803
+ * A string representing the value of the input. This is not displayed on the client-side,
793
804
  * but on the server this is the value given to the data submitted with the checkbox's name.
794
805
  */
795
806
  value?: string;
796
807
  /**
797
- * The current status of the checkbox.
808
+ * The current status of the input.
798
809
  */
799
810
  checked?: boolean;
800
811
  /**
@@ -816,7 +827,7 @@ export interface CheckboxProps {
816
827
  */
817
828
  variant?: 'default' | 'small';
818
829
  /**
819
- * A function that is called with the checkbox status changes.
830
+ * A function that is called when the `checked` input status changes.
820
831
  *
821
832
  * @event
822
833
  */
@@ -828,7 +839,8 @@ export interface CheckboxProps {
828
839
  */
829
840
  inline?: boolean;
830
841
  /**
831
- * When set to `true`, the option will be selected by default.
842
+ * When set to `true`, the option will be selected by default. Use it to
843
+ * set the default `checked` state when the component is **uncontrolled**.
832
844
  */
833
845
  initialIsChecked?: boolean;
834
846
  /**
@@ -836,6 +848,12 @@ export interface CheckboxProps {
836
848
  */
837
849
  'aria-label'?: string;
838
850
  }
851
+ /**
852
+ * The props type for {@link !components.RadioButton}.
853
+ * @category Component Props
854
+ * @interface
855
+ */
856
+ export type RadioButtonProps = Omit<CheckboxProps, 'aria-label'>;
839
857
  export type ToggleGroupOption = {
840
858
  /** The text that displays in the dropdown menu. */
841
859
  label: string;
@@ -969,10 +987,24 @@ export interface PortalContext {
969
987
  timezone: string;
970
988
  }
971
989
  /** @ignore */
972
- export interface Context {
990
+ export interface CrmRecordContext {
991
+ objectId: number;
992
+ objectTypeId: string;
993
+ }
994
+ /** @ignore */
995
+ export interface BaseContext {
973
996
  user: UserContext;
974
997
  portal: PortalContext;
975
998
  }
999
+ /** @ignore */
1000
+ export interface CrmContext extends BaseContext {
1001
+ location: 'crm.record.tab' | 'crm.record.sidebar';
1002
+ crm: CrmRecordContext;
1003
+ }
1004
+ /** @ignore */
1005
+ export interface GenericContext extends BaseContext {
1006
+ location: 'uie.playground.middle';
1007
+ }
976
1008
  export interface StackProps {
977
1009
  distance?: AllDistances;
978
1010
  children?: React.ReactNode;
@@ -1184,6 +1216,7 @@ export interface ExtensionPointContract {
1184
1216
  actions?: {
1185
1217
  [k: string]: ExtensionPointAction;
1186
1218
  } | {};
1219
+ context: BaseContext;
1187
1220
  customComponents: Record<string, ComponentType<any>>;
1188
1221
  }
1189
1222
  /** @ignore */
@@ -1200,22 +1233,27 @@ export type FetchCrmObjectPropertiesAction = (properties: string[]) => Promise<R
1200
1233
  /** @ignore */
1201
1234
  export type OpenIframeModalAction = (action: OpenIframeActionPayload) => void;
1202
1235
  /** @ignore */
1236
+ export type refreshObjectPropertiesAction = () => void;
1237
+ /** @ignore */
1203
1238
  export interface CrmMiddleExtensionPoint extends ExtensionPointContract {
1204
1239
  actions: {
1205
1240
  addAlert: AddAlertAction;
1206
1241
  reloadPage: ReloadPageAction;
1207
1242
  fetchCrmObjectProperties: FetchCrmObjectPropertiesAction;
1208
1243
  openIframeModal: OpenIframeModalAction;
1244
+ refreshObjectProperties?: refreshObjectPropertiesAction;
1209
1245
  };
1246
+ context: CrmContext;
1210
1247
  customComponents: {
1211
1248
  CrmPropertyList: ComponentType<CrmPropertyListProps>;
1212
1249
  CrmAssociationTable: ComponentType<CrmAssociationTableProps>;
1213
1250
  CrmDataHighlight: ComponentType<CrmDataHighlightProps>;
1214
1251
  CrmReport: ComponentType<CrmReportProps>;
1215
1252
  CrmAssociationPivot: ComponentType<CrmAssociationPivotProps>;
1216
- CrmObjectProperty?: ComponentType<CrmObjectPropertyProps>;
1217
- CrmAssociationPropertyList?: ComponentType<CrmAssociationPropertyListProps>;
1218
- CrmStageTracker?: ComponentType<CrmStageTrackerProps>;
1253
+ CrmObjectProperty: ComponentType<CrmObjectPropertyProps>;
1254
+ CrmAssociationPropertyList: ComponentType<CrmAssociationPropertyListProps>;
1255
+ CrmStageTracker: ComponentType<CrmStageTrackerProps>;
1256
+ CrmStatistics?: ComponentType<CrmStatisticsProps>;
1219
1257
  CrmActionButton?: ComponentType<CrmActionButtonProps>;
1220
1258
  CrmActionLink?: ComponentType<CrmActionLinkProps>;
1221
1259
  CrmCardActions?: ComponentType<CrmCardActionsProps>;
@@ -1228,7 +1266,9 @@ export interface CrmSidebarExtensionPoint extends ExtensionPointContract {
1228
1266
  reloadPage: ReloadPageAction;
1229
1267
  fetchCrmObjectProperties: FetchCrmObjectPropertiesAction;
1230
1268
  openIframeModal: OpenIframeModalAction;
1269
+ refreshObjectProperties?: refreshObjectPropertiesAction;
1231
1270
  };
1271
+ context: CrmContext;
1232
1272
  customComponents: {
1233
1273
  [k: string]: never;
1234
1274
  };
@@ -1305,6 +1345,34 @@ export interface CrmStageTrackerProps {
1305
1345
  showProperties?: boolean;
1306
1346
  }
1307
1347
  /** @ignore */
1348
+ interface BaseCrmStatisticItem {
1349
+ label: string;
1350
+ }
1351
+ /** @ignore */
1352
+ interface FilterGroup {
1353
+ filters: Array<CrmSearchFilter>;
1354
+ }
1355
+ /** @ignore */
1356
+ interface BasicMetricItem extends BaseCrmStatisticItem {
1357
+ statisticType: 'SUM' | 'AVG' | 'MIN' | 'MAX' | 'DISTINCT_APPROX' | 'COUNT';
1358
+ propertyName: string;
1359
+ filterGroups?: Array<FilterGroup>;
1360
+ }
1361
+ /** @ignore */
1362
+ interface PercentileMetricItem extends BaseCrmStatisticItem {
1363
+ statisticType: 'PERCENTILES';
1364
+ propertyName: string;
1365
+ percentile: number;
1366
+ filterGroups?: Array<FilterGroup>;
1367
+ }
1368
+ /** @ignore */
1369
+ type CrmStatisticItem = BasicMetricItem | PercentileMetricItem;
1370
+ /** @ignore */
1371
+ export interface CrmStatisticsProps {
1372
+ objectTypeId: string;
1373
+ statistics: Array<CrmStatisticItem>;
1374
+ }
1375
+ /** @ignore */
1308
1376
  interface ObjectCoordinates {
1309
1377
  objectTypeId: string;
1310
1378
  objectId: number;
@@ -1386,6 +1454,7 @@ interface RemotePlaygroundExtensionPoint extends ExtensionPointContract {
1386
1454
  actions: {
1387
1455
  warn: () => void;
1388
1456
  };
1457
+ context: GenericContext;
1389
1458
  customComponents: {
1390
1459
  ExampleCrmComponent: ComponentType<ExampleCrmComponentProps>;
1391
1460
  };
@@ -1402,10 +1471,17 @@ export interface ExampleCrmComponentProps {
1402
1471
  count: number;
1403
1472
  }
1404
1473
  /** @ignore */
1474
+ export type PanelAction = (panelId: string) => void;
1475
+ /** @ignore */
1476
+ export interface GlobalActions {
1477
+ openPanel: PanelAction;
1478
+ closePanel: PanelAction;
1479
+ }
1480
+ /** @ignore */
1405
1481
  export interface ExtensionPointApi<ExtensionPointName extends keyof ExtensionPoints> {
1406
- context: Context;
1407
1482
  runServerlessFunction: ServerlessFuncRunner;
1408
- actions: ExtensionPoints[ExtensionPointName]['actions'];
1483
+ actions: ExtensionPoints[ExtensionPointName]['actions'] & GlobalActions;
1484
+ context: ExtensionPoints[ExtensionPointName]['context'];
1409
1485
  }
1410
1486
  /** @ignore */
1411
1487
  interface OpenIframeActionPayload {
@@ -1751,4 +1827,135 @@ export interface AccordionProps {
1751
1827
  */
1752
1828
  onClick?: () => void;
1753
1829
  }
1830
+ /**
1831
+ * The props type for {@link !components.List}.
1832
+ *
1833
+ * @category Component Props
1834
+ */
1835
+ export interface ListProps {
1836
+ /**
1837
+ * The content of the list. Each child will be wrapped in an `li` tag.
1838
+ */
1839
+ children: ReactNode;
1840
+ /**
1841
+ * The type of list to render.
1842
+ *
1843
+ * @defaultValue `"unordered"`
1844
+ */
1845
+ variant?: 'unordered' | 'unordered-styled' | 'ordered' | 'ordered-styled' | 'inline' | 'inline-divided';
1846
+ }
1847
+ /**
1848
+ * The props type for {@link !components.Toggle}.
1849
+ *
1850
+ * @category Component Props
1851
+ */
1852
+ export interface ToggleProps {
1853
+ /**
1854
+ * The current status of the input.
1855
+ */
1856
+ checked?: boolean;
1857
+ /**
1858
+ * When set to `true`, the option cannot be selected.
1859
+ */
1860
+ readonly?: boolean;
1861
+ /**
1862
+ * The unique identifier for the toggle element.
1863
+ */
1864
+ name?: string;
1865
+ /**
1866
+ * The size variation of the toggle.
1867
+ *
1868
+ * @defaultValue `"default"`
1869
+ */
1870
+ size?: TShirtSizes['sm'] | TShirtSizes['xs'] | 'default';
1871
+ /**
1872
+ * A function that is called when the `checked` input status changes.
1873
+ *
1874
+ * @event
1875
+ */
1876
+ onChange?: (checked: boolean) => void;
1877
+ /**
1878
+ * When set to `true`, the option will be selected by default. Use it to
1879
+ * set the default `checked` state when the component is **uncontrolled**.
1880
+ */
1881
+ initialIsChecked?: boolean;
1882
+ /**
1883
+ * The companion text of for Toggle. It can be displayed on top,
1884
+ * inline, or hidden. When hidden, it will remain usable for screen readers.
1885
+ */
1886
+ label: string;
1887
+ /**
1888
+ * Controls the display setting of the label prop.
1889
+ *
1890
+ * @defaultValue `"inline"`
1891
+ */
1892
+ labelDisplay?: 'inline' | 'top' | 'hidden';
1893
+ /**
1894
+ * The text that appears on the Toggle when `checked={true}`.
1895
+ *
1896
+ * @defaultValue `"ON"`
1897
+ */
1898
+ textChecked?: string;
1899
+ /**
1900
+ * The text that appears on the Toggle when `checked={false}`.
1901
+ *
1902
+ * @defaultValue `"ON"`
1903
+ */
1904
+ textUnchecked?: string;
1905
+ }
1906
+ export interface PanelProps {
1907
+ /**
1908
+ * Accessibility label.
1909
+ *
1910
+ */
1911
+ 'aria-label'?: string;
1912
+ /**
1913
+ * The main content of the panel when it opens.
1914
+ *
1915
+ */
1916
+ children?: React.ReactNode;
1917
+ /**
1918
+ * A unique ID for the panel
1919
+ *
1920
+ */
1921
+ id: string;
1922
+ /**
1923
+ * A function that will be invoked when the panel has finished opening.
1924
+ *
1925
+ */
1926
+ onOpen?: () => void;
1927
+ /**
1928
+ * A function that will be invoked when the panel has finished closing.
1929
+ *
1930
+ */
1931
+ onClose?: () => void;
1932
+ /**
1933
+ * The width of the panel
1934
+ *
1935
+ * @defaultValue `"sm"`
1936
+ */
1937
+ width?: TShirtSizes['sm'] | TShirtSizes['md'] | TShirtSizes['lg'];
1938
+ /**
1939
+ * The title of the panel
1940
+ *
1941
+ */
1942
+ title?: string;
1943
+ /**
1944
+ * The Footer of the panel
1945
+ *
1946
+ */
1947
+ footer?: React.ReactNode;
1948
+ /**
1949
+ * When set to `true`, the table will not have side padding.
1950
+ *
1951
+ * @defaultValue `false`
1952
+ */
1953
+ flush?: boolean;
1954
+ /**
1955
+ * The variant of the panel
1956
+ *
1957
+ * @defaultValue `"default"`
1958
+ */
1959
+ variant?: 'modal' | 'default';
1960
+ }
1754
1961
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/ui-extensions",
3
- "version": "0.8.1",
3
+ "version": "0.8.3",
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": "5fd5fe43bc0b09750653dd7121d56bf0d60788bb"
53
+ "gitHead": "ab25629916c542f19bf8cde83a10ad8bd225078f"
54
54
  }