@hubspot/ui-extensions 0.8.3 → 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.
- package/dist/coreComponents.d.ts +5 -0
- package/dist/coreComponents.js +1 -0
- package/dist/hubspot.d.ts +3 -4
- package/dist/hubspot.js +4 -15
- package/dist/types.d.ts +93 -14
- package/dist/types.js +20 -0
- package/package.json +2 -2
package/dist/coreComponents.d.ts
CHANGED
|
@@ -232,3 +232,8 @@ export declare const Panel: "Panel" & {
|
|
|
232
232
|
readonly props?: types.PanelProps | undefined;
|
|
233
233
|
readonly children?: true | undefined;
|
|
234
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>>;
|
package/dist/coreComponents.js
CHANGED
package/dist/hubspot.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
-
import
|
|
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
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export function extend_V2(renderExtensionCallback) {
|
|
2
|
+
return self.extend_V2(renderExtensionCallback);
|
|
3
|
+
}
|
|
4
4
|
export const hubspot = {
|
|
5
|
-
extend:
|
|
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.
|
|
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
|
|
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:
|
|
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.
|
|
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.
|
|
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
|
*
|
|
@@ -1473,14 +1507,14 @@ export interface ExampleCrmComponentProps {
|
|
|
1473
1507
|
/** @ignore */
|
|
1474
1508
|
export type PanelAction = (panelId: string) => void;
|
|
1475
1509
|
/** @ignore */
|
|
1476
|
-
export interface
|
|
1510
|
+
export interface Reactions {
|
|
1477
1511
|
openPanel: PanelAction;
|
|
1478
1512
|
closePanel: PanelAction;
|
|
1479
1513
|
}
|
|
1480
1514
|
/** @ignore */
|
|
1481
1515
|
export interface ExtensionPointApi<ExtensionPointName extends keyof ExtensionPoints> {
|
|
1482
1516
|
runServerlessFunction: ServerlessFuncRunner;
|
|
1483
|
-
actions: ExtensionPoints[ExtensionPointName]['actions']
|
|
1517
|
+
actions: ExtensionPoints[ExtensionPointName]['actions'];
|
|
1484
1518
|
context: ExtensionPoints[ExtensionPointName]['context'];
|
|
1485
1519
|
}
|
|
1486
1520
|
/** @ignore */
|
|
@@ -1654,6 +1688,7 @@ export interface TablePaginatedProps extends BaseTableProps {
|
|
|
1654
1688
|
* @category Component Props
|
|
1655
1689
|
*/
|
|
1656
1690
|
export type TableProps = TableNoPaginatedProps | TablePaginatedProps;
|
|
1691
|
+
/** @deprecated use ExtensionEvent/FormSubmitExtensionEvent instead */
|
|
1657
1692
|
export declare class RemoteEvent<V> {
|
|
1658
1693
|
type: string;
|
|
1659
1694
|
bubbles: boolean;
|
|
@@ -1684,11 +1719,11 @@ export interface LinkProps {
|
|
|
1684
1719
|
*/
|
|
1685
1720
|
variant?: 'primary' | 'destructive' | 'light' | 'dark';
|
|
1686
1721
|
/**
|
|
1687
|
-
* A function that will be invoked with the link is clicked.
|
|
1722
|
+
* A function that will be invoked with the link is clicked.
|
|
1688
1723
|
*
|
|
1689
1724
|
* @event
|
|
1690
1725
|
*/
|
|
1691
|
-
onClick?: () => void;
|
|
1726
|
+
onClick?: (event: ExtensionEvent, reactions: Reactions) => void;
|
|
1692
1727
|
/**
|
|
1693
1728
|
* When set to true, `event.preventDefault()` will be invoked before the `onClick` function is called, preventing automatic navigation to the href URL.
|
|
1694
1729
|
*
|
|
@@ -1865,9 +1900,9 @@ export interface ToggleProps {
|
|
|
1865
1900
|
/**
|
|
1866
1901
|
* The size variation of the toggle.
|
|
1867
1902
|
*
|
|
1868
|
-
* @defaultValue `"
|
|
1903
|
+
* @defaultValue `"medium"`
|
|
1869
1904
|
*/
|
|
1870
|
-
size?: TShirtSizes['sm'] | TShirtSizes['
|
|
1905
|
+
size?: TShirtSizes['xs'] | TShirtSizes['sm'] | TShirtSizes['md'] | 'default';
|
|
1871
1906
|
/**
|
|
1872
1907
|
* A function that is called when the `checked` input status changes.
|
|
1873
1908
|
*
|
|
@@ -1958,4 +1993,48 @@ export interface PanelProps {
|
|
|
1958
1993
|
*/
|
|
1959
1994
|
variant?: 'modal' | 'default';
|
|
1960
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
|
+
}
|
|
1961
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.
|
|
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": "
|
|
53
|
+
"gitHead": "41e3484343d34136e81540d774a101ccf99642b3"
|
|
54
54
|
}
|