@hubspot/ui-extensions 0.11.5 → 0.12.0

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.
Files changed (61) hide show
  1. package/dist/__tests__/crm/hooks/useAssociations.spec.js +96 -0
  2. package/dist/__tests__/crm/hooks/useCrmProperties.spec.js +170 -1
  3. package/dist/crm/hooks/useAssociations.d.ts +2 -0
  4. package/dist/crm/hooks/useAssociations.js +87 -0
  5. package/dist/crm/hooks/useCrmProperties.d.ts +5 -1
  6. package/dist/crm/hooks/useCrmProperties.js +81 -2
  7. package/dist/hs-internal/__tests__/createRemoteComponentInternal.spec.d.ts +1 -0
  8. package/dist/hs-internal/__tests__/createRemoteComponentInternal.spec.js +139 -0
  9. package/dist/hs-internal/index.d.ts +35 -0
  10. package/dist/hs-internal/index.js +20 -0
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.js +1 -1
  13. package/dist/shared/remoteComponents.d.ts +9 -0
  14. package/dist/shared/remoteComponents.js +9 -0
  15. package/dist/shared/types/components/accordion.d.ts +5 -5
  16. package/dist/shared/types/components/alert.d.ts +2 -2
  17. package/dist/shared/types/components/button-row.d.ts +5 -2
  18. package/dist/shared/types/components/button.d.ts +16 -10
  19. package/dist/shared/types/components/chart.d.ts +3 -3
  20. package/dist/shared/types/components/description-list.d.ts +2 -2
  21. package/dist/shared/types/components/dropdown.d.ts +8 -8
  22. package/dist/shared/types/components/empty-state.d.ts +5 -7
  23. package/dist/shared/types/components/error-state.d.ts +2 -2
  24. package/dist/shared/types/components/form.d.ts +2 -2
  25. package/dist/shared/types/components/heading.d.ts +1 -1
  26. package/dist/shared/types/components/icon.d.ts +4 -5
  27. package/dist/shared/types/components/illustration.d.ts +12 -0
  28. package/dist/shared/types/components/image.d.ts +9 -4
  29. package/dist/shared/types/components/index.d.ts +1 -0
  30. package/dist/shared/types/components/inputs.d.ts +61 -63
  31. package/dist/shared/types/components/layouts.d.ts +17 -24
  32. package/dist/shared/types/components/link.d.ts +8 -5
  33. package/dist/shared/types/components/loading-spinner.d.ts +3 -3
  34. package/dist/shared/types/components/modal.d.ts +5 -5
  35. package/dist/shared/types/components/panel.d.ts +7 -7
  36. package/dist/shared/types/components/progress-bar.d.ts +4 -4
  37. package/dist/shared/types/components/score.d.ts +13 -0
  38. package/dist/shared/types/components/score.js +1 -0
  39. package/dist/shared/types/components/selects.d.ts +11 -20
  40. package/dist/shared/types/components/statistics.d.ts +2 -2
  41. package/dist/shared/types/components/status-tag.d.ts +5 -5
  42. package/dist/shared/types/components/step-indicator.d.ts +5 -7
  43. package/dist/shared/types/components/table.d.ts +22 -12
  44. package/dist/shared/types/components/tabs.d.ts +10 -10
  45. package/dist/shared/types/components/tag.d.ts +2 -2
  46. package/dist/shared/types/components/text.d.ts +15 -21
  47. package/dist/shared/types/components/tile.d.ts +2 -2
  48. package/dist/shared/types/components/toggle.d.ts +12 -14
  49. package/dist/shared/types/components/toggleInputs.d.ts +26 -19
  50. package/dist/shared/types/components/tooltip.d.ts +1 -1
  51. package/dist/shared/types/crm.d.ts +52 -0
  52. package/dist/shared/types/http-requests.d.ts +2 -2
  53. package/dist/shared/types/index.d.ts +1 -1
  54. package/dist/shared/types/index.js +1 -0
  55. package/dist/shared/types/shared.d.ts +128 -78
  56. package/dist/shared/types/shared.js +123 -78
  57. package/dist/shared/types/worker-globals.d.ts +11 -10
  58. package/dist/testing/__tests__/mocks.useAssociations.spec.js +92 -4
  59. package/dist/testing/__tests__/mocks.useCrmProperties.spec.js +55 -7
  60. package/dist/testing/internal/mocks/mock-hooks.js +4 -0
  61. package/package.json +4 -3
@@ -0,0 +1,139 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { describe, expect, it } from 'vitest';
3
+ import { createRenderer } from "../../testing/index.js";
4
+ import { createRemoteComponentInternal } from "../index.js";
5
+ import { __hubSpotComponentRegistry } from "../../shared/remoteComponents.js";
6
+ import { Button, Text } from "../../index.js";
7
+ import { InvalidComponentsError } from "../../testing/internal/errors.js";
8
+ import { useState } from 'react';
9
+ // Create custom components once at the top level
10
+ const CustomButton = createRemoteComponentInternal('TestCustomButton');
11
+ const CustomCard = createRemoteComponentInternal('TestCustomCard', {
12
+ fragmentProps: ['content'],
13
+ });
14
+ describe('createRemoteComponentInternal', () => {
15
+ it('should create a component that can be rendered', () => {
16
+ const { render, find } = createRenderer('crm.record.tab');
17
+ render(_jsx(CustomButton, { label: "Click me", onClick: () => { }, testId: "my-button" }));
18
+ const button = find(CustomButton);
19
+ expect(button.props.label).toBe('Click me');
20
+ expect(button.props.testId).toBe('my-button');
21
+ });
22
+ it('should register component in the registry', () => {
23
+ expect(__hubSpotComponentRegistry.isAllowedComponentName('TestCustomButton')).toBe(true);
24
+ });
25
+ it('should be findable using renderer.find()', () => {
26
+ const { render, find } = createRenderer('crm.record.tab');
27
+ render(_jsx(CustomButton, { label: "Find me", onClick: () => { } }));
28
+ const button = find(CustomButton);
29
+ expect(button).toBeDefined();
30
+ expect(button.props.label).toBe('Find me');
31
+ });
32
+ it('should work with find() using prop matchers', () => {
33
+ const { render, find } = createRenderer('crm.record.tab');
34
+ render(_jsxs(_Fragment, { children: [_jsx(CustomButton, { label: "Button 1", onClick: () => { }, variant: "primary" }), _jsx(CustomButton, { label: "Button 2", onClick: () => { }, variant: "secondary" })] }));
35
+ const primaryButton = find(CustomButton, { variant: 'primary' });
36
+ expect(primaryButton.props.label).toBe('Button 1');
37
+ const secondaryButton = find(CustomButton, { variant: 'secondary' });
38
+ expect(secondaryButton.props.label).toBe('Button 2');
39
+ });
40
+ it('should work with findAll()', () => {
41
+ const { render, findAll } = createRenderer('crm.record.tab');
42
+ render(_jsxs(_Fragment, { children: [_jsx(CustomButton, { label: "Button 1", onClick: () => { } }), _jsx(CustomButton, { label: "Button 2", onClick: () => { } }), _jsx(CustomButton, { label: "Button 3", onClick: () => { } })] }));
43
+ const buttons = findAll(CustomButton);
44
+ expect(buttons).toHaveLength(3);
45
+ expect(buttons[0].props.label).toBe('Button 1');
46
+ expect(buttons[1].props.label).toBe('Button 2');
47
+ expect(buttons[2].props.label).toBe('Button 3');
48
+ });
49
+ it('should work with findByTestId()', () => {
50
+ const { render, findByTestId } = createRenderer('crm.record.tab');
51
+ render(_jsx(CustomButton, { label: "Find by ID", onClick: () => { }, testId: "my-custom-button" }));
52
+ const button = findByTestId(CustomButton, 'my-custom-button');
53
+ expect(button.props.label).toBe('Find by ID');
54
+ });
55
+ it('should work with maybeFind()', () => {
56
+ const { render, maybeFind } = createRenderer('crm.record.tab');
57
+ render(_jsx(CustomButton, { label: "Maybe", onClick: () => { } }));
58
+ const button = maybeFind(CustomButton);
59
+ expect(button).not.toBeNull();
60
+ expect(button?.props.label).toBe('Maybe');
61
+ const nonExistent = maybeFind(Button);
62
+ expect(nonExistent).toBeNull();
63
+ });
64
+ it('should support fragment props', () => {
65
+ const { render, find } = createRenderer('crm.record.tab');
66
+ render(_jsx(CustomCard, { title: "My Card", content: _jsx(Text, { children: "Card content" }), testId: "my-card" }));
67
+ const card = find(CustomCard);
68
+ expect(card.props.title).toBe('My Card');
69
+ expect(card.props.testId).toBe('my-card');
70
+ expect(card.props.content?.find(Text).text).toBe('Card content');
71
+ });
72
+ it('should support event triggering via trigger()', () => {
73
+ const { render, find } = createRenderer('crm.record.tab');
74
+ let clicked = false;
75
+ const handleClick = () => {
76
+ clicked = true;
77
+ };
78
+ render(_jsx(CustomButton, { label: "Click me", onClick: handleClick }));
79
+ const button = find(CustomButton);
80
+ button.trigger('onClick');
81
+ expect(clicked).toBe(true);
82
+ });
83
+ it('should not throw InvalidComponentsError during rendering', () => {
84
+ const { render } = createRenderer('crm.record.tab');
85
+ expect(() => render(_jsx(CustomButton, { label: "Valid", onClick: () => { } }))).not.toThrow(InvalidComponentsError);
86
+ });
87
+ it('should work with state updates', () => {
88
+ const { render, find } = createRenderer('crm.record.tab');
89
+ function Counter() {
90
+ const [count, setCount] = useState(0);
91
+ const handleClick = () => {
92
+ setCount(count + 1);
93
+ };
94
+ return (_jsx(CustomButton, { label: `Count: ${count}`, onClick: handleClick, testId: "counter" }));
95
+ }
96
+ render(_jsx(Counter, {}));
97
+ const button = find(CustomButton);
98
+ expect(button.props.label).toBe('Count: 0');
99
+ button.trigger('onClick');
100
+ const updatedButton = find(CustomButton);
101
+ expect(updatedButton.props.label).toBe('Count: 1');
102
+ });
103
+ it('should work with nested components', () => {
104
+ const { render, find } = createRenderer('crm.record.tab');
105
+ render(_jsx(CustomCard, { title: "Card with button", content: _jsx(CustomButton, { label: "Nested button", onClick: () => { } }) }));
106
+ const card = find(CustomCard);
107
+ expect(card.props.title).toBe('Card with button');
108
+ // Fragment prop children are found globally, not as direct children
109
+ const nestedButton = find(CustomButton);
110
+ expect(nestedButton.props.label).toBe('Nested button');
111
+ });
112
+ it('should work with findChild() and findAllChildren()', () => {
113
+ const { render, findAll, find } = createRenderer('crm.record.tab');
114
+ render(_jsx(CustomCard, { title: "Card with buttons", content: _jsxs(_Fragment, { children: [_jsx(CustomButton, { label: "Button 1", onClick: () => { } }), _jsx(CustomButton, { label: "Button 2", onClick: () => { } })] }) }));
115
+ const card = find(CustomCard);
116
+ expect(card.props.title).toBe('Card with buttons');
117
+ // Fragment prop children are found globally, not as direct children
118
+ const buttons = findAll(CustomButton);
119
+ expect(buttons).toHaveLength(2);
120
+ expect(buttons[0].props.label).toBe('Button 1');
121
+ expect(buttons[1].props.label).toBe('Button 2');
122
+ });
123
+ it('should allow multiple custom components to coexist', () => {
124
+ const { render, find } = createRenderer('crm.record.tab');
125
+ render(_jsxs(_Fragment, { children: [_jsx(CustomButton, { label: "Button", onClick: () => { } }), _jsx(CustomCard, { title: "Card" })] }));
126
+ const button = find(CustomButton);
127
+ const card = find(CustomCard);
128
+ expect(button.props.label).toBe('Button');
129
+ expect(card.props.title).toBe('Card');
130
+ });
131
+ it('should work alongside built-in HubSpot components', () => {
132
+ const { render, find } = createRenderer('crm.record.tab');
133
+ render(_jsxs(_Fragment, { children: [_jsx(CustomButton, { label: "Custom", onClick: () => { } }), _jsx(Button, { variant: "primary", children: "Built-in" })] }));
134
+ const customButton = find(CustomButton);
135
+ const builtInButton = find(Button);
136
+ expect(customButton.props.label).toBe('Custom');
137
+ expect(builtInButton.props.variant).toBe('primary');
138
+ });
139
+ });
@@ -0,0 +1,35 @@
1
+ import type { HubSpotReactComponent, HubSpotReactFragmentProp, UnknownComponentProps } from '../shared/types/shared.ts';
2
+ /**
3
+ * Utility type for filtering out all of the prop names where the value is a ReactNode.
4
+ * We use this to know which props are allowed to be used as fragment props.
5
+ */
6
+ type ComponentFragmentPropName<TProps extends UnknownComponentProps> = {
7
+ [K in keyof TProps]: HubSpotReactFragmentProp extends Required<TProps>[K] ? K : never;
8
+ }[keyof TProps & string];
9
+ /**
10
+ * Options for creating a custom remote component.
11
+ */
12
+ export interface CreateRemoteComponentInternalOptions<TProps extends UnknownComponentProps = UnknownComponentProps> {
13
+ /**
14
+ * An array of prop names that are allowed to be used as fragment props (props that accept ReactNode children).
15
+ */
16
+ fragmentProps?: ComponentFragmentPropName<TProps>[];
17
+ }
18
+ /**
19
+ * Creates and registers a custom remote component for internal HubSpot use.
20
+ *
21
+ * This function is intended for HubSpot internal teams who need to create
22
+ * custom remote components that work with the UI Extensions testing utilities.
23
+ *
24
+ * Components created with this function will:
25
+ * - Be registered in the global component registry
26
+ * - Pass validation in testing utilities (isAllowedComponentName)
27
+ * - Work with renderer.find(), renderer.findAll(), and other testing utilities
28
+ *
29
+ * @param componentName - Unique name for the component (e.g., "FlywheelCustomButton").
30
+ * Recommended to prefix with team name to avoid collisions.
31
+ * @param options - Optional configuration including fragment props
32
+ * @returns A typed remote React component that can be rendered in a remote environment
33
+ */
34
+ export declare function createRemoteComponentInternal<TProps extends UnknownComponentProps>(componentName: string, options?: CreateRemoteComponentInternalOptions<TProps>): HubSpotReactComponent<TProps>;
35
+ export {};
@@ -0,0 +1,20 @@
1
+ import { __hubSpotComponentRegistry } from "../shared/remoteComponents.js";
2
+ /**
3
+ * Creates and registers a custom remote component for internal HubSpot use.
4
+ *
5
+ * This function is intended for HubSpot internal teams who need to create
6
+ * custom remote components that work with the UI Extensions testing utilities.
7
+ *
8
+ * Components created with this function will:
9
+ * - Be registered in the global component registry
10
+ * - Pass validation in testing utilities (isAllowedComponentName)
11
+ * - Work with renderer.find(), renderer.findAll(), and other testing utilities
12
+ *
13
+ * @param componentName - Unique name for the component (e.g., "FlywheelCustomButton").
14
+ * Recommended to prefix with team name to avoid collisions.
15
+ * @param options - Optional configuration including fragment props
16
+ * @returns A typed remote React component that can be rendered in a remote environment
17
+ */
18
+ export function createRemoteComponentInternal(componentName, options = {}) {
19
+ return __hubSpotComponentRegistry.createAndRegisterRemoteReactComponent(componentName, options);
20
+ }
package/dist/index.d.ts CHANGED
@@ -2,6 +2,6 @@ import './clientTypes.ts';
2
2
  export { hubspot } from './hubspot.ts';
3
3
  export { logger } from './logger.ts';
4
4
  export * from './shared/types/index.ts';
5
- export { Accordion, Alert, AutoGrid, BarChart, Box, Button, ButtonRow, Card, Checkbox, CurrencyInput, DateInput, DescriptionList, DescriptionListItem, Divider, Dropdown, EmptyState, ErrorState, Flex, Form, Heading, Icon, Illustration, Image, Inline, Input, LineChart, Link, List, LoadingButton, LoadingSpinner, Modal, ModalBody, ModalFooter, MultiSelect, NumberInput, Panel, PanelBody, PanelFooter, PanelSection, ProgressBar, RadioButton, SearchInput, Select, Stack, Statistics, StatisticsItem, StatisticsTrend, StatusTag, StepIndicator, StepperInput, Tab, Table, TableBody, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, Tag, Text, TextArea, Textarea, Tile, TimeInput, Toggle, ToggleGroup, Tooltip, } from './shared/remoteComponents.tsx';
5
+ export { Accordion, Alert, AutoGrid, BarChart, Box, Button, ButtonRow, Card, Checkbox, CurrencyInput, DateInput, DescriptionList, DescriptionListItem, Divider, Dropdown, EmptyState, ErrorState, Flex, Form, Heading, Icon, Illustration, Image, Inline, Input, LineChart, Link, List, LoadingButton, LoadingSpinner, Modal, ModalBody, ModalFooter, MultiSelect, NumberInput, Panel, PanelBody, PanelFooter, PanelSection, ProgressBar, RadioButton, ScoreCircle, SearchInput, Select, Stack, Statistics, StatisticsItem, StatisticsTrend, StatusTag, StepIndicator, StepperInput, Tab, Table, TableBody, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, Tag, Text, TextArea, Textarea, Tile, TimeInput, Toggle, ToggleGroup, Tooltip, } from './shared/remoteComponents.tsx';
6
6
  export { useExtensionContext } from './hooks/useExtensionContext.tsx';
7
7
  export { useExtensionActions } from './hooks/useExtensionActions.tsx';
package/dist/index.js CHANGED
@@ -3,6 +3,6 @@ import "./clientTypes.js";
3
3
  export { hubspot } from "./hubspot.js";
4
4
  export { logger } from "./logger.js";
5
5
  export * from "./shared/types/index.js";
6
- export { Accordion, Alert, AutoGrid, BarChart, Box, Button, ButtonRow, Card, Checkbox, CurrencyInput, DateInput, DescriptionList, DescriptionListItem, Divider, Dropdown, EmptyState, ErrorState, Flex, Form, Heading, Icon, Illustration, Image, Inline, Input, LineChart, Link, List, LoadingButton, LoadingSpinner, Modal, ModalBody, ModalFooter, MultiSelect, NumberInput, Panel, PanelBody, PanelFooter, PanelSection, ProgressBar, RadioButton, SearchInput, Select, Stack, Statistics, StatisticsItem, StatisticsTrend, StatusTag, StepIndicator, StepperInput, Tab, Table, TableBody, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, Tag, Text, TextArea, Textarea, Tile, TimeInput, Toggle, ToggleGroup, Tooltip, } from "./shared/remoteComponents.js";
6
+ export { Accordion, Alert, AutoGrid, BarChart, Box, Button, ButtonRow, Card, Checkbox, CurrencyInput, DateInput, DescriptionList, DescriptionListItem, Divider, Dropdown, EmptyState, ErrorState, Flex, Form, Heading, Icon, Illustration, Image, Inline, Input, LineChart, Link, List, LoadingButton, LoadingSpinner, Modal, ModalBody, ModalFooter, MultiSelect, NumberInput, Panel, PanelBody, PanelFooter, PanelSection, ProgressBar, RadioButton, ScoreCircle, SearchInput, Select, Stack, Statistics, StatisticsItem, StatisticsTrend, StatusTag, StepIndicator, StepperInput, Tab, Table, TableBody, TableCell, TableFooter, TableHead, TableHeader, TableRow, Tabs, Tag, Text, TextArea, Textarea, Tile, TimeInput, Toggle, ToggleGroup, Tooltip, } from "./shared/remoteComponents.js";
7
7
  export { useExtensionContext } from "./hooks/useExtensionContext.js";
8
8
  export { useExtensionActions } from "./hooks/useExtensionActions.js";
@@ -494,6 +494,15 @@ export declare const BarChart: import("./types/shared.ts").HubSpotReactComponent
494
494
  * - {@link https://github.com/HubSpot/ui-extensions-examples/tree/main/charts-example Charts Example}
495
495
  */
496
496
  export declare const LineChart: import("./types/shared.ts").HubSpotReactComponent<componentTypes.ChartProps>;
497
+ /**
498
+ * The `ScoreCircle` component displays a score value (0-100) as a circular progress indicator with color-coded bands.
499
+ * Scores are color-coded: 0-32 (alert/red), 33-65 (warning/yellow), 66-100 (success/green).
500
+ * @example
501
+ * ```tsx
502
+ * <ScoreCircle score={75} />
503
+ * ```
504
+ */
505
+ export declare const ScoreCircle: import("./types/shared.ts").HubSpotReactComponent<componentTypes.ScoreProps>;
497
506
  /**
498
507
  * `Tabs` allow you to group related content in a compact space, allowing users to switch between views without leaving the page.
499
508
  * @example
@@ -504,6 +504,15 @@ export const BarChart = createAndRegisterRemoteReactComponent('BarChart');
504
504
  * - {@link https://github.com/HubSpot/ui-extensions-examples/tree/main/charts-example Charts Example}
505
505
  */
506
506
  export const LineChart = createAndRegisterRemoteReactComponent('LineChart');
507
+ /**
508
+ * The `ScoreCircle` component displays a score value (0-100) as a circular progress indicator with color-coded bands.
509
+ * Scores are color-coded: 0-32 (alert/red), 33-65 (warning/yellow), 66-100 (success/green).
510
+ * @example
511
+ * ```tsx
512
+ * <ScoreCircle score={75} />
513
+ * ```
514
+ */
515
+ export const ScoreCircle = createAndRegisterRemoteReactComponent('ScoreCircle');
507
516
  /**
508
517
  * `Tabs` allow you to group related content in a compact space, allowing users to switch between views without leaving the page.
509
518
  * @example
@@ -7,7 +7,7 @@ import { TShirtSizes, BaseComponentProps } from '../shared.ts';
7
7
  */
8
8
  export interface AccordionProps extends BaseComponentProps {
9
9
  /**
10
- * The title text for the accordion.
10
+ * The accordion's title text.
11
11
  *
12
12
  */
13
13
  title: string;
@@ -17,19 +17,19 @@ export interface AccordionProps extends BaseComponentProps {
17
17
  */
18
18
  children: ReactNode;
19
19
  /**
20
- * Defines default open behavior on page load. When set to `true`, the accordion will be open by default on initial load.
20
+ * When set to `true`, the accordion will be open on initial page load. The `open` prop takes precedence over this prop.
21
21
  *
22
22
  * @defaultValue `false`
23
23
  */
24
24
  defaultOpen?: boolean;
25
25
  /**
26
- * When set to `true`, the accordion's open state cannot be changed.
26
+ * When set to `true`, the accordion's state cannot be changed.
27
27
  *
28
28
  * @defaultValue `false`
29
29
  */
30
30
  disabled?: boolean;
31
31
  /**
32
- * For controlling the accordion's open state programmatically. When set to `true`, the accordion will open. Takes precedence over `defaultOpen`.
32
+ * Controls the accordion's open state programmatically. When set to `true`, the accordion will open. Takes precedence over `defaultOpen`.
33
33
  *
34
34
  */
35
35
  open?: boolean;
@@ -40,7 +40,7 @@ export interface AccordionProps extends BaseComponentProps {
40
40
  */
41
41
  size?: TShirtSizes['xs'] | TShirtSizes['sm'] | TShirtSizes['md'];
42
42
  /**
43
- * A function that will be invoked when the title is clicked. It receives no arguments and its return value is ignored.
43
+ * A function that will be invoked when the accordion title is clicked. This function receives no arguments and its returned value is ignored.
44
44
  *
45
45
  * @event
46
46
  */
@@ -7,7 +7,7 @@ import { BaseComponentProps } from '../shared.ts';
7
7
  */
8
8
  export interface AlertProps extends BaseComponentProps {
9
9
  /**
10
- * The bolded title text of the alert.
10
+ * The bolded text of the alert.
11
11
  *
12
12
  */
13
13
  title: string;
@@ -17,7 +17,7 @@ export interface AlertProps extends BaseComponentProps {
17
17
  */
18
18
  children?: ReactNode;
19
19
  /**
20
- * The color of the alert.
20
+ * The color of the alert. See [variants](https://developers.hubspot.com/docs/apps/developer-platform/add-features/ui-extensibility/ui-components/standard-components/alert#variants) for more information.
21
21
  *
22
22
  * @defaultValue `"info"`
23
23
  */
@@ -11,13 +11,16 @@ export interface ButtonRowProps extends BaseComponentProps {
11
11
  */
12
12
  children: ReactNode;
13
13
  /**
14
- * Disables the dropdown list of buttons that appears when the children expand beyond the horizontal space.
14
+ * By default, when the number of buttons exceeds the available horizontal space, the extra buttons will collapse into a single dropdown menu button. Set this prop to `true` to prevent the dropdown button from being interacted with.
15
15
  *
16
16
  * @defaultValue `false`
17
17
  */
18
18
  disableDropdown?: boolean;
19
19
  /**
20
- * Controls the appearance and text content of the dropdown button.
20
+ * When the included buttons exceed the available space, use this prop to customize the dropdown button. This prop takes an object containing the following `key: 'value'` pairs:
21
+ * - `size`: the size of the button. Can be `'xs'`, `'sm'`, or `'md'` (default).
22
+ * - `text`: the button's text. By default, is set to `More`. If set to an empty value, will display a gear icon.
23
+ * - `variant`: the button variation. Can be `'primary'`, `'secondary'` (default), or `'transparent'`.
21
24
  */
22
25
  dropDownButtonOptions?: ButtonRownDropDownButtonOptionsProps;
23
26
  }
@@ -3,27 +3,33 @@ import { OverlayComponentProps, HrefProp, TShirtSizes, IconNames, ExtensionEvent
3
3
  import { ReactionsHandler } from '../reactions.ts';
4
4
  export interface BaseButtonProps extends BaseComponentProps {
5
5
  /**
6
- * A function that will be invoked when the button is clicked. Do not use this function for submitting a form; use Form's `onSubmit` function instead.
6
+ * A function that will be invoked when the button is clicked. It receives no arguments and its return value is ignored.
7
7
  *
8
8
  * @event
9
9
  */
10
10
  onClick?: ReactionsHandler<ExtensionEvent>;
11
11
  /**
12
- * 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.
12
+ * Include this prop to open a URL on click. Contains the following fields:
13
+ * - `url` (string): the URL that will open on click.
14
+ * - `external` (boolean): set to `true` to open the URL in a new tab and display an external link icon. By default:
15
+ * - Links to HubSpot app pages will open in the same tab and will not include an icon.
16
+ * - Links to non-HubSpot app pages will open in a new tab and include the icon.
17
+ *
18
+ * When a button includes both `href` and an `onClick` action, both will be executed on button click.
13
19
  */
14
20
  href?: HrefProp;
15
21
  /**
16
- * Determines whether or not the button should be disabled.
22
+ * When set to `true`, the button will render in a greyed-out state and cannot be clicked.
17
23
  */
18
24
  disabled?: boolean;
19
25
  /**
20
- * Sets the color variation of the button.
26
+ * Sets the color of the button.
21
27
  *
22
28
  * @defaultValue `"secondary"`
23
29
  */
24
30
  variant?: 'primary' | 'secondary' | 'destructive' | 'transparent';
25
31
  /**
26
- * Sets the HTML attribute "role" of the button.
32
+ * Sets the `role` HTML attribute of the button.
27
33
  *
28
34
  * @defaultValue `"button"`
29
35
  */
@@ -33,13 +39,13 @@ export interface BaseButtonProps extends BaseComponentProps {
33
39
  */
34
40
  children: ReactNode;
35
41
  /**
36
- * Sets the size of the button.
42
+ * The size of the button.
37
43
  *
38
44
  * @defaultValue `"md"`
39
45
  */
40
46
  size?: TShirtSizes['xs'] | TShirtSizes['sm'] | TShirtSizes['md'];
41
47
  /**
42
- * When set to `true`, long button text will be truncated with an ellipsis (`...`) and the full text will appear in a tooltip on hover.
48
+ * When set to `true`, long button text will be truncated with an ellipsis (`...`), with the full text displayed in a tooltip on hover.
43
49
  *
44
50
  * @defaultValue `false`
45
51
  */
@@ -71,13 +77,13 @@ export interface LoadingButtonOverlayOptions {
71
77
  */
72
78
  export interface LoadingButtonProps extends BaseButtonProps, OverlayComponentProps {
73
79
  /**
74
- * Sets the color variation of the button.
80
+ * Sets the color of the button.
75
81
  *
76
82
  * @defaultValue `"secondary"`
77
83
  */
78
84
  variant?: 'primary' | 'secondary' | 'destructive';
79
85
  /**
80
- * If true, the loading indicator is shown and the button becomes disabled.
86
+ * Set to `true` to display the loading indicator and disable the button. Default is `false`.
81
87
  *
82
88
  * @defaultValue `false`
83
89
  */
@@ -87,7 +93,7 @@ export interface LoadingButtonProps extends BaseButtonProps, OverlayComponentPro
87
93
  */
88
94
  overlayOptions?: LoadingButtonOverlayOptions;
89
95
  /**
90
- * Controls the icon that's shown after loading is done.
96
+ * Set to an icon name to display an icon after loading. By default, will display a check mark.
91
97
  *
92
98
  * @defaultValue `"success"`
93
99
  */
@@ -13,18 +13,18 @@ export type BarChartProps = ChartProps;
13
13
  export type LineChartProps = ChartProps;
14
14
  export interface ChartProps extends BaseComponentProps {
15
15
  /**
16
- * The data used to render the chart. You can optionally provide configuration options.
16
+ * An object containing the chart's data in an array.
17
17
  */
18
18
  data: ChartDataRow[] | {
19
19
  data: ChartDataRow[];
20
20
  options?: ChartDataOptions;
21
21
  };
22
22
  /**
23
- * The configuration for the axes of the chart.
23
+ * Configures the chart's axes.
24
24
  */
25
25
  axes: ChartAxisPair;
26
26
  /**
27
- * Configuration options for the chart as a whole.
27
+ * Additional chart configuration options.
28
28
  */
29
29
  options?: ChartOptions;
30
30
  }
@@ -12,7 +12,7 @@ export interface DescriptionListItemProps extends BaseComponentProps {
12
12
  */
13
13
  children: ReactNode;
14
14
  /**
15
- * Text to be displayed as the label.
15
+ * Text to display as the label.
16
16
  *
17
17
  */
18
18
  label: string;
@@ -29,7 +29,7 @@ export interface DescriptionListProps extends BaseComponentProps {
29
29
  */
30
30
  children: ReactNode;
31
31
  /**
32
- * The direction the label/value pairs are placed in the description list container.
32
+ * The direction that the label and value pairs are displayed.
33
33
  *
34
34
  * @defaultValue `"column"`
35
35
  */
@@ -31,8 +31,7 @@ export interface DropdownButtonItemProps extends OverlayComponentProps, BaseComp
31
31
  */
32
32
  children: ReactNode;
33
33
  /**
34
- * A function that will be invoked when the item is clicked.
35
- * It receives no arguments and its return value is ignored.
34
+ * The function invoked when the item is clicked.
36
35
  *
37
36
  * @event
38
37
  */
@@ -45,8 +44,9 @@ export interface DropdownButtonItemProps extends OverlayComponentProps, BaseComp
45
44
  */
46
45
  export interface DropdownProps extends BaseComponentProps {
47
46
  /**
48
- * The list of options to be rendered within the dropdown menu.
49
- * Each option represents an entry in the Dropdown.
47
+ * The options included in the dropdown menu. Each option includes:
48
+ * - `label`: the text label for the option.
49
+ * - `onClick`: the function that gets invoked when the option is selected.
50
50
  *
51
51
  * @deprecated This prop is deprecated and will be removed in a future release.
52
52
  * Use child components instead to define dropdown menu items. For example,
@@ -54,25 +54,25 @@ export interface DropdownProps extends BaseComponentProps {
54
54
  */
55
55
  options?: DropdownOption[];
56
56
  /**
57
- * Controls the appearance of the dropdown button
57
+ * The type of dropdown button to display. `'primary'` and `'secondary'` will display a blue and grey button, respectively, while `'transparent'` will display a blue hyperlink.
58
58
  *
59
59
  * @defaultValue `"secondary"`
60
60
  */
61
61
  variant?: 'primary' | 'secondary' | 'transparent';
62
62
  /**
63
- * Sets the content for the dropdown button.
63
+ * The button text.
64
64
  *
65
65
  * @defaultValue `"More"`
66
66
  */
67
67
  buttonText?: string;
68
68
  /**
69
- * Sets the size of the dropdown button.
69
+ * The size of the button.
70
70
  *
71
71
  * @defaultValue `"md"`
72
72
  */
73
73
  buttonSize?: TShirtSizes['xs'] | TShirtSizes['sm'] | TShirtSizes['md'];
74
74
  /**
75
- * Disables the ability to focus and click-to-expand of the dropdown button
75
+ * When set to `true`, the dropdown button cannot be focused or clicked.
76
76
  *
77
77
  * @defaultValue `false`
78
78
  */
@@ -8,7 +8,7 @@ export type EmptyStateImageName = 'addOnReporting' | 'announcement' | 'api' | 'a
8
8
  */
9
9
  export interface EmptyStateProps extends BaseComponentProps {
10
10
  /**
11
- * When set to `true`, removes the default vertical margins in the component.
11
+ * When set to `true`, removes the default vertical margins for the component.
12
12
  *
13
13
  * @defaultValue `false`
14
14
  */
@@ -21,30 +21,28 @@ export interface EmptyStateProps extends BaseComponentProps {
21
21
  /**
22
22
  * The text for the title header.
23
23
  *
24
- * @defaultValue `"All is not lost."`
25
- *
26
24
  */
27
25
  title?: string;
28
26
  /**
29
- * Sets the layout direction for the content. Can be either `horizontal` or `vertical`.
27
+ * The layout direction of the content.
30
28
  *
31
29
  * @defaultValue `"horizontal"`
32
30
  */
33
31
  layout?: 'horizontal' | 'vertical';
34
32
  /**
35
- * When set to `true`, swaps the visual order of the text (primary) and image (secondary) content. This ensures the primary content is still presented first to assistive technology.
33
+ * When set to `true`, swaps out the visual order of the text (primary) and image (secondary) content. This ensures that the primary content is presented first to screen readers.
36
34
  *
37
35
  * @defaultValue `false`
38
36
  */
39
37
  reverseOrder?: boolean;
40
38
  /**
41
- * The max-width(in pixels) for the image container.
39
+ * The max-width for the image container.
42
40
  *
43
41
  * @defaultValue `250`
44
42
  */
45
43
  imageWidth?: number;
46
44
  /**
47
- * The name of the image to display.
45
+ * The name of the image.
48
46
  *
49
47
  * @defaultValue `"emptyStateCharts"`
50
48
  */
@@ -12,12 +12,12 @@ export interface ErrorStateProps extends BaseComponentProps {
12
12
  */
13
13
  children: ReactNode;
14
14
  /**
15
- * The text of the title header.
15
+ * The text of the component header.
16
16
  *
17
17
  */
18
18
  title?: string;
19
19
  /**
20
- * The type of error image that will be shown.
20
+ * The type of image that will be displayed.
21
21
  *
22
22
  * @defaultValue `"error"`
23
23
  */
@@ -14,7 +14,7 @@ export interface FormProps extends BaseComponentProps {
14
14
  */
15
15
  children: ReactNode;
16
16
  /**
17
- * 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. This function should be used instead of Button's `onClick` for the Form's submit button.
17
+ * 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.
18
18
  *
19
19
  * @event
20
20
  */
@@ -22,7 +22,7 @@ export interface FormProps extends BaseComponentProps {
22
22
  /** @deprecated the value for `preventDefault` is now always `true`, use `onSubmit` to handle all form submission behavior */
23
23
  preventDefault?: boolean;
24
24
  /**
25
- * Specifies how autcomplete behaves in the entire form.
25
+ * Set this field to `'off'` to prevent autocompletion software (e.g., browser, password managers) from auto-filling form fields.
26
26
  * @defaultValue `"on"`
27
27
  */
28
28
  autoComplete?: 'off' | 'on';
@@ -12,7 +12,7 @@ export interface HeadingProps extends BaseComponentProps {
12
12
  */
13
13
  children: ReactNode;
14
14
  /**
15
- * When set to true, text will not line break.
15
+ * When set to `true`, text will not line break.
16
16
  *
17
17
  * @defaultValue `false`
18
18
  */
@@ -7,23 +7,22 @@ export type IconColor = 'alert' | 'warning' | 'success' | 'inherit';
7
7
  */
8
8
  export interface IconProps extends BaseComponentProps {
9
9
  /**
10
- * Sets the icon color. By default, the icon will use `inherit`, which inherits the color from its parent element.
10
+ * The color of the icon.
11
11
  *
12
12
  * @defaultValue `"inherit"`
13
13
  */
14
14
  color?: IconColor;
15
15
  /**
16
- * Sets the specific icon to display.
16
+ * Sets the icon to display.
17
17
  */
18
18
  name: IconNames;
19
19
  /**
20
- * Sets the size of the icon. If this prop is not provided, the icon will default to the size of its parent.
20
+ * By default, the size of the icon is set automatically based on the parent component. If you need to override the default size, you can specify one to use instead.
21
21
  *
22
- * @defaultValue `"medium"`
23
22
  */
24
23
  size?: TShirtSizes['sm'] | TShirtSizes['md'] | TShirtSizes['lg'];
25
24
  /**
26
- * Sets the text that a screenreader will read for this icon.
25
+ * Sets the text that screen readers will read for the icon.
27
26
  */
28
27
  screenReaderText?: string;
29
28
  }