@hubspot/ui-extensions 0.8.3 → 0.8.5
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/experimental/experimentalComponents.d.ts +7 -0
- package/dist/experimental/experimentalComponents.js +5 -0
- package/dist/experimental/index.d.ts +2 -0
- package/dist/experimental/index.js +2 -0
- package/dist/hubspot.d.ts +5 -4
- package/dist/hubspot.js +8 -15
- package/dist/types.d.ts +96 -16
- package/dist/types.js +20 -0
- package/package.json +4 -3
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
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type * as types from '../types';
|
|
2
|
+
/** @experimental This component is experimental. Avoid using it in production due to potential breaking changes. Your feedback is valuable for improvements. Stay tuned for updates. */
|
|
3
|
+
export declare const Panel: "Panel" & {
|
|
4
|
+
readonly type?: "Panel" | undefined;
|
|
5
|
+
readonly props?: types.PanelProps | undefined;
|
|
6
|
+
readonly children?: true | undefined;
|
|
7
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Panel", types.PanelProps, true>>;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createRemoteReactComponent } from '@remote-ui/react';
|
|
2
|
+
/** @experimental This component is experimental. Avoid using it in production due to potential breaking changes. Your feedback is valuable for improvements. Stay tuned for updates. */
|
|
3
|
+
export const Panel = createRemoteReactComponent('Panel', {
|
|
4
|
+
fragmentProps: ['footer'],
|
|
5
|
+
});
|
package/dist/hubspot.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ReactElement } from 'react';
|
|
2
|
-
import type { ExtensionPoints, ExtensionPointApi } from './types';
|
|
2
|
+
import type { ExtensionPoints, ExtensionPointApi, ServerlessRunnerParams } from './types';
|
|
3
|
+
export declare function extend_V2<ExtensionPointName extends keyof ExtensionPoints>(renderExtensionCallback: (api: ExtensionPointApi<ExtensionPointName>) => ReactElement<any>): any;
|
|
4
|
+
export declare function serverless<T = any>(name: ServerlessRunnerParams['name'], options?: Omit<ServerlessRunnerParams, 'name'>): Promise<T>;
|
|
3
5
|
export declare const hubspot: {
|
|
4
|
-
extend: typeof
|
|
6
|
+
extend: typeof extend_V2;
|
|
7
|
+
serverless: typeof serverless;
|
|
5
8
|
};
|
|
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,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
export function extend_V2(renderExtensionCallback) {
|
|
2
|
+
return self.extend_V2(renderExtensionCallback);
|
|
3
|
+
}
|
|
4
|
+
export function serverless(name, options) {
|
|
5
|
+
return self.serverless(name, options);
|
|
6
|
+
}
|
|
4
7
|
export const hubspot = {
|
|
5
|
-
extend:
|
|
8
|
+
extend: extend_V2,
|
|
9
|
+
serverless,
|
|
6
10
|
};
|
|
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,16 @@
|
|
|
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
|
+
}
|
|
13
|
+
export type ReactionsHandler<T> = (event: T, reactions: Reactions) => void | Promise<void>;
|
|
2
14
|
/**
|
|
3
15
|
* The props type for {@link !components.Alert}.
|
|
4
16
|
*
|
|
@@ -29,11 +41,11 @@ export interface AlertProps {
|
|
|
29
41
|
*/
|
|
30
42
|
export interface ButtonProps {
|
|
31
43
|
/**
|
|
32
|
-
* A function that will be invoked when the button is clicked.
|
|
44
|
+
* A function that will be invoked when the button is clicked.
|
|
33
45
|
*
|
|
34
46
|
* @event
|
|
35
47
|
*/
|
|
36
|
-
onClick?:
|
|
48
|
+
onClick?: ReactionsHandler<ExtensionEvent>;
|
|
37
49
|
/**
|
|
38
50
|
* 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
51
|
*/
|
|
@@ -58,6 +70,12 @@ export interface ButtonProps {
|
|
|
58
70
|
* The displayable text for the Button.
|
|
59
71
|
*/
|
|
60
72
|
children: ReactNode;
|
|
73
|
+
/**
|
|
74
|
+
* Sets the size of the button.
|
|
75
|
+
*
|
|
76
|
+
* @defaultValue `"md"`
|
|
77
|
+
*/
|
|
78
|
+
size?: TShirtSizes['xs'] | TShirtSizes['sm'] | TShirtSizes['md'];
|
|
61
79
|
}
|
|
62
80
|
/**
|
|
63
81
|
* The props type for {@link !components.ButtonRow}.
|
|
@@ -214,11 +232,11 @@ export interface FormProps {
|
|
|
214
232
|
*/
|
|
215
233
|
children: ReactNode;
|
|
216
234
|
/**
|
|
217
|
-
* The function that is called when the form is submitted. It will receive a
|
|
235
|
+
* 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
236
|
*
|
|
219
237
|
* @event
|
|
220
238
|
*/
|
|
221
|
-
onSubmit?:
|
|
239
|
+
onSubmit?: ReactionsHandler<FormSubmitExtensionEvent<FormInputValues>>;
|
|
222
240
|
/**
|
|
223
241
|
* When set to `true`, `event.preventDefault()` will be invoked before the `onSubmit` function is called, preventing the default HTML form behavior.
|
|
224
242
|
*
|
|
@@ -261,11 +279,11 @@ export interface ImageProps {
|
|
|
261
279
|
*/
|
|
262
280
|
href?: string;
|
|
263
281
|
/**
|
|
264
|
-
* A function that will be called when the image is clicked.
|
|
282
|
+
* A function that will be called when the image is clicked.
|
|
265
283
|
*
|
|
266
284
|
* @event
|
|
267
285
|
*/
|
|
268
|
-
onClick?:
|
|
286
|
+
onClick?: ReactionsHandler<ExtensionEvent>;
|
|
269
287
|
/**
|
|
270
288
|
* The URL of the image to display.
|
|
271
289
|
*
|
|
@@ -701,11 +719,11 @@ export interface TagProps {
|
|
|
701
719
|
*/
|
|
702
720
|
variant?: 'default' | 'warning' | 'success' | 'error';
|
|
703
721
|
/**
|
|
704
|
-
* A function that will be invoked when the tag is clicked.
|
|
722
|
+
* A function that will be invoked when the tag is clicked.
|
|
705
723
|
*
|
|
706
724
|
* @event
|
|
707
725
|
*/
|
|
708
|
-
onClick?:
|
|
726
|
+
onClick?: ReactionsHandler<ExtensionEvent>;
|
|
709
727
|
}
|
|
710
728
|
/**
|
|
711
729
|
* @internal
|
|
@@ -769,7 +787,24 @@ export type TextProps = {
|
|
|
769
787
|
* - <Text inline={true}>
|
|
770
788
|
*/
|
|
771
789
|
format?: TextFormatOptions;
|
|
790
|
+
/**
|
|
791
|
+
* @interface
|
|
792
|
+
* truncates long strings to a single line. If the full string doesn’t fit in one line,
|
|
793
|
+
* it’s shown in a tooltip on hover.
|
|
794
|
+
*
|
|
795
|
+
* - `false` => no truncation(default).
|
|
796
|
+
* - `true` => truncates the string to a single line. Full-text will show inside the tooltip.
|
|
797
|
+
* - { tooltipText: 'some text' } => truncates the string and lets you control the contents of the tooltip.
|
|
798
|
+
* - { maxWidth: 150 } => sets the width(in pixel) of the line.
|
|
799
|
+
*
|
|
800
|
+
* @defaultValue `false`
|
|
801
|
+
*/
|
|
802
|
+
truncate?: boolean | TruncateOptions;
|
|
772
803
|
};
|
|
804
|
+
export interface TruncateOptions {
|
|
805
|
+
maxWidth?: number;
|
|
806
|
+
tooltipText?: string;
|
|
807
|
+
}
|
|
773
808
|
/**
|
|
774
809
|
* The props type for {@link !components.Tile}.
|
|
775
810
|
*
|
|
@@ -1094,11 +1129,11 @@ export interface StatisticsItemProps {
|
|
|
1094
1129
|
/**
|
|
1095
1130
|
* The string to be displayed as the item's primary number.
|
|
1096
1131
|
*/
|
|
1097
|
-
number: string;
|
|
1132
|
+
number: string | number;
|
|
1098
1133
|
/**
|
|
1099
1134
|
* Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. The children should be {@link !components.StatisticsTrend} or {@link !components.Text}.
|
|
1100
1135
|
*/
|
|
1101
|
-
children
|
|
1136
|
+
children?: ReactNode;
|
|
1102
1137
|
}
|
|
1103
1138
|
/**
|
|
1104
1139
|
* The props type for {@link !components.Statistics}.
|
|
@@ -1473,14 +1508,14 @@ export interface ExampleCrmComponentProps {
|
|
|
1473
1508
|
/** @ignore */
|
|
1474
1509
|
export type PanelAction = (panelId: string) => void;
|
|
1475
1510
|
/** @ignore */
|
|
1476
|
-
export interface
|
|
1511
|
+
export interface Reactions {
|
|
1477
1512
|
openPanel: PanelAction;
|
|
1478
1513
|
closePanel: PanelAction;
|
|
1479
1514
|
}
|
|
1480
1515
|
/** @ignore */
|
|
1481
1516
|
export interface ExtensionPointApi<ExtensionPointName extends keyof ExtensionPoints> {
|
|
1482
1517
|
runServerlessFunction: ServerlessFuncRunner;
|
|
1483
|
-
actions: ExtensionPoints[ExtensionPointName]['actions']
|
|
1518
|
+
actions: ExtensionPoints[ExtensionPointName]['actions'];
|
|
1484
1519
|
context: ExtensionPoints[ExtensionPointName]['context'];
|
|
1485
1520
|
}
|
|
1486
1521
|
/** @ignore */
|
|
@@ -1654,6 +1689,7 @@ export interface TablePaginatedProps extends BaseTableProps {
|
|
|
1654
1689
|
* @category Component Props
|
|
1655
1690
|
*/
|
|
1656
1691
|
export type TableProps = TableNoPaginatedProps | TablePaginatedProps;
|
|
1692
|
+
/** @deprecated use ExtensionEvent/FormSubmitExtensionEvent instead */
|
|
1657
1693
|
export declare class RemoteEvent<V> {
|
|
1658
1694
|
type: string;
|
|
1659
1695
|
bubbles: boolean;
|
|
@@ -1684,11 +1720,11 @@ export interface LinkProps {
|
|
|
1684
1720
|
*/
|
|
1685
1721
|
variant?: 'primary' | 'destructive' | 'light' | 'dark';
|
|
1686
1722
|
/**
|
|
1687
|
-
* A function that will be invoked with the link is clicked.
|
|
1723
|
+
* A function that will be invoked with the link is clicked.
|
|
1688
1724
|
*
|
|
1689
1725
|
* @event
|
|
1690
1726
|
*/
|
|
1691
|
-
onClick?:
|
|
1727
|
+
onClick?: ReactionsHandler<ExtensionEvent>;
|
|
1692
1728
|
/**
|
|
1693
1729
|
* When set to true, `event.preventDefault()` will be invoked before the `onClick` function is called, preventing automatic navigation to the href URL.
|
|
1694
1730
|
*
|
|
@@ -1865,9 +1901,9 @@ export interface ToggleProps {
|
|
|
1865
1901
|
/**
|
|
1866
1902
|
* The size variation of the toggle.
|
|
1867
1903
|
*
|
|
1868
|
-
* @defaultValue `"
|
|
1904
|
+
* @defaultValue `"medium"`
|
|
1869
1905
|
*/
|
|
1870
|
-
size?: TShirtSizes['sm'] | TShirtSizes['
|
|
1906
|
+
size?: TShirtSizes['xs'] | TShirtSizes['sm'] | TShirtSizes['md'] | 'default';
|
|
1871
1907
|
/**
|
|
1872
1908
|
* A function that is called when the `checked` input status changes.
|
|
1873
1909
|
*
|
|
@@ -1958,4 +1994,48 @@ export interface PanelProps {
|
|
|
1958
1994
|
*/
|
|
1959
1995
|
variant?: 'modal' | 'default';
|
|
1960
1996
|
}
|
|
1997
|
+
export interface DropdownOption {
|
|
1998
|
+
/**
|
|
1999
|
+
* Text to be displayed as the menu item text.
|
|
2000
|
+
*
|
|
2001
|
+
*/
|
|
2002
|
+
label: string;
|
|
2003
|
+
/**
|
|
2004
|
+
* A function that will be invoked when the item is clicked.
|
|
2005
|
+
* It receives no arguments and its return value is ignored.
|
|
2006
|
+
*
|
|
2007
|
+
* @event
|
|
2008
|
+
*/
|
|
2009
|
+
onClick?: () => void;
|
|
2010
|
+
}
|
|
2011
|
+
/**
|
|
2012
|
+
* The props type for {@link !components.Dropdown}.
|
|
2013
|
+
*
|
|
2014
|
+
* @category Component Props
|
|
2015
|
+
*/
|
|
2016
|
+
export interface DropdownProps {
|
|
2017
|
+
/**
|
|
2018
|
+
* The list of options to be rendered within the dropdown menu.
|
|
2019
|
+
* Each option represents an entry in the Dropdown.
|
|
2020
|
+
*/
|
|
2021
|
+
options: DropdownOption[];
|
|
2022
|
+
/**
|
|
2023
|
+
* Controls the appearance of the dropdown button
|
|
2024
|
+
*
|
|
2025
|
+
* @defaultValue `"secondary"`
|
|
2026
|
+
*/
|
|
2027
|
+
variant?: 'primary' | 'secondary' | 'transparent';
|
|
2028
|
+
/**
|
|
2029
|
+
* Sets the content for the dropdown button.
|
|
2030
|
+
*
|
|
2031
|
+
* @defaultValue `"More"`
|
|
2032
|
+
*/
|
|
2033
|
+
buttonText?: string;
|
|
2034
|
+
/**
|
|
2035
|
+
* Sets the size of the dropdown button.
|
|
2036
|
+
*
|
|
2037
|
+
* @defaultValue `"md"`
|
|
2038
|
+
*/
|
|
2039
|
+
buttonSize?: TShirtSizes['xs'] | TShirtSizes['sm'] | TShirtSizes['md'];
|
|
2040
|
+
}
|
|
1961
2041
|
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.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -21,7 +21,8 @@
|
|
|
21
21
|
},
|
|
22
22
|
"exports": {
|
|
23
23
|
".": "./dist/index.js",
|
|
24
|
-
"./crm": "./dist/crm/index.js"
|
|
24
|
+
"./crm": "./dist/crm/index.js",
|
|
25
|
+
"./experimental": "./dist/experimental/index.js"
|
|
25
26
|
},
|
|
26
27
|
"license": "MIT",
|
|
27
28
|
"dependencies": {
|
|
@@ -50,5 +51,5 @@
|
|
|
50
51
|
"devDependencies": {
|
|
51
52
|
"typescript": "5.0.4"
|
|
52
53
|
},
|
|
53
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "c9d6a64b37208e4387fa09655c3ada9733dd8602"
|
|
54
55
|
}
|