@hubspot/ui-extensions 0.3.1 → 0.5.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.
- package/README.md +110 -6
- package/dist/coreComponents.d.ts +5 -0
- package/dist/coreComponents.js +1 -0
- package/dist/types.d.ts +21 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -6,12 +6,14 @@ React components and utilities for extending HubSpot's UI.
|
|
|
6
6
|
|
|
7
7
|
- [Accordion](#accordion)
|
|
8
8
|
- [Alert](#alert)
|
|
9
|
+
- [Box](#box)
|
|
9
10
|
- [Button](#button)
|
|
10
11
|
- [ButtonRow](#buttonrow)
|
|
11
12
|
- [Card](#card)
|
|
12
13
|
- [DescriptionList](#descriptionlist)
|
|
13
14
|
- [DescriptionListItem](#descriptionlistitem)
|
|
14
15
|
- [Divider](#divider)
|
|
16
|
+
- [Flex](#flex)
|
|
15
17
|
- [Form](#form)
|
|
16
18
|
- [EmptyState](#emptystate)
|
|
17
19
|
- [ErrorState](#errorstate)
|
|
@@ -154,6 +156,51 @@ const Extension = () => {
|
|
|
154
156
|
};
|
|
155
157
|
```
|
|
156
158
|
|
|
159
|
+
### Box
|
|
160
|
+
|
|
161
|
+
##### Import
|
|
162
|
+
|
|
163
|
+
```javascript
|
|
164
|
+
import { Box } from '@hubspot/ui-extensions';
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
##### Props
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
export interface BoxProps {
|
|
171
|
+
children: ReactNode;
|
|
172
|
+
alignSelf?: 'start' | 'center' | 'baseline' | 'end' | 'stretch' | 'auto';
|
|
173
|
+
flex?: 'initial' | 'auto' | 'none' | number;
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
| Prop | Type | Default | Description |
|
|
178
|
+
| --- | --- | --- | --- |
|
|
179
|
+
| `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. |
|
|
180
|
+
| `alignSelf` | `'start' \| 'center' \| 'baseline' \| 'end' \| 'stretch' \| 'auto'` `(optional)` | `'auto'` | Overrides flex's align item value for this element. |
|
|
181
|
+
| `flex` | `'initial' \| 'auto' \| 'none' \| number` `(optional)` | `'initial'` | Sets how the item will grow or shrink when it's a direct ancestor of the Flex component. |
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
#### flex prop Options
|
|
185
|
+
|
|
186
|
+
- `initial`: The item is sized according to its width and height properties. It shrinks to its minimum size to fit the container, but does not grow to absorb any extra free space in the flex container.
|
|
187
|
+
- `auto`: The item is sized according to its width and height properties, but grows to absorb any extra free space in the flex container, and shrinks to its minimum size to fit the container.
|
|
188
|
+
- `none`: The item is sized according to its width and height properties. It is fully inflexible: it neither shrinks nor grows in relation to the flex container.
|
|
189
|
+
- `number`: Tells a component to fill all available space, shared evenly amongst other components with the same parent. The larger the flex given, the higher the ratio of space a component will take compared to its siblings.
|
|
190
|
+
|
|
191
|
+
##### Usage
|
|
192
|
+
|
|
193
|
+
```javascript
|
|
194
|
+
const Extension = () => {
|
|
195
|
+
return (
|
|
196
|
+
<Box>
|
|
197
|
+
<Text>Hello</Text>
|
|
198
|
+
</Box>
|
|
199
|
+
);
|
|
200
|
+
};
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
|
|
157
204
|
### Button
|
|
158
205
|
|
|
159
206
|
##### Import
|
|
@@ -411,6 +458,63 @@ const Extension = () => {
|
|
|
411
458
|
};
|
|
412
459
|
```
|
|
413
460
|
|
|
461
|
+
### Flex
|
|
462
|
+
|
|
463
|
+
##### Import
|
|
464
|
+
|
|
465
|
+
```javascript
|
|
466
|
+
import { Flex } from '@hubspot/ui-extensions';
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
##### Props
|
|
470
|
+
|
|
471
|
+
```typescript
|
|
472
|
+
export interface FlexProps {
|
|
473
|
+
children?: React.ReactNode;
|
|
474
|
+
direction?: 'row' | 'column';
|
|
475
|
+
justify?: 'center' | 'end' | 'start' | 'around' | 'between';
|
|
476
|
+
align?: 'start' | 'center' | 'baseline' | 'end' | 'stretch';
|
|
477
|
+
alignSelf?: 'start' | 'center' | 'baseline' | 'end' | 'stretch';
|
|
478
|
+
wrap?: boolean;
|
|
479
|
+
gap?:
|
|
480
|
+
| 'flush'
|
|
481
|
+
| 'small'
|
|
482
|
+
| 'extra-small'
|
|
483
|
+
| 'medium'
|
|
484
|
+
| 'large'
|
|
485
|
+
| 'extra-large'
|
|
486
|
+
| 'xs'
|
|
487
|
+
| 'sm'
|
|
488
|
+
| 'md'
|
|
489
|
+
| 'lg'
|
|
490
|
+
| 'xl';
|
|
491
|
+
}
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
| Prop | Type | Default | Description |
|
|
495
|
+
| --- | --- | --- | --- |
|
|
496
|
+
| `direction` | `'row' \| 'column'` | `'column'` | Sets the direction in which elements are placed. |
|
|
497
|
+
| `justify` | `'start' \| 'center' \|'end' \|'around' \| 'between'` | `'start'` | Defines how to distribute space between and around children on main axis. |
|
|
498
|
+
| `align` | `'start' \| 'center' \|'baseline' \| 'end' \| 'stretch' \|'between'` | `'start'` | Controls the aligment of children in the cross axis. |
|
|
499
|
+
| `alignSelf` | `'start' \| 'center' \| 'baseline' \| 'end' \| 'stretch' \| 'auto'` `(optional)` | `'auto'` | Overrides flex's align item value for this element. Useful when `Flex` is the child of another `Flex` component. |
|
|
500
|
+
| `wrap` | `boolean(optional)` | `false` | If set to `false`, children are forced onto one line. If set to `true`, they can wrap into multiple lines. |
|
|
501
|
+
| `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. |
|
|
502
|
+
| `gap` | `'flush' \| 'extra-small' \| 'small' \| 'medium' \| 'large' \| 'extra-large' \| 'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl'` | `'small'` | Amount of space between each child component passed as children. |
|
|
503
|
+
|
|
504
|
+
##### Usage
|
|
505
|
+
|
|
506
|
+
```javascript
|
|
507
|
+
const Extension = () => {
|
|
508
|
+
return (
|
|
509
|
+
<Flex direction="column" distance="large">
|
|
510
|
+
<Tile>Tile 1</Tile>
|
|
511
|
+
<Tile>Tile 2</Tile>
|
|
512
|
+
<Tile>Tile 3</Tile>
|
|
513
|
+
</Flex>
|
|
514
|
+
);
|
|
515
|
+
};
|
|
516
|
+
```
|
|
517
|
+
|
|
414
518
|
### Form
|
|
415
519
|
|
|
416
520
|
##### Import
|
|
@@ -947,7 +1051,7 @@ export interface ProgressBarProps {
|
|
|
947
1051
|
aria-label?: string;
|
|
948
1052
|
showPercentage?: boolean;
|
|
949
1053
|
value?: number;
|
|
950
|
-
|
|
1054
|
+
maxValue?: number;
|
|
951
1055
|
valueDescription?: string;
|
|
952
1056
|
variant?: 'success' | 'danger' | 'warning';
|
|
953
1057
|
}
|
|
@@ -958,7 +1062,7 @@ export interface ProgressBarProps {
|
|
|
958
1062
|
| `title` | `string(optional)` | `N/A` | Text to be displayed in the progressbar title. |
|
|
959
1063
|
| `showPercentage` | `boolean(optional)` | `false` | Toggles the display of the completion percentage. |
|
|
960
1064
|
| `value` | `number(optional)` | `0` | The value of the progress indicator. |
|
|
961
|
-
| `
|
|
1065
|
+
| `maxValue` | `number(optional)` | `100` | The maximum value of the progress bar. |
|
|
962
1066
|
| `valueDescription` | `string(optional)` | `N/A` | Text that explains the current state of the `value` prop. Renders to the right of `title`. **Example: "10,000 of 7,500"** |
|
|
963
1067
|
| `variant` | `'success' \| 'danger' \| 'warning'` | `'success'` | The type of progressbar to display. Defaults to success. |
|
|
964
1068
|
| `aria-label` | `string(optional)` | `N/A` | Indicates the content of the ProgressBar to screen readers. Should be used if there's no title. |
|
|
@@ -971,7 +1075,7 @@ const Extension = () => {
|
|
|
971
1075
|
<ProgressBar
|
|
972
1076
|
variant="warning"
|
|
973
1077
|
value={50}
|
|
974
|
-
|
|
1078
|
+
maxValue={200}
|
|
975
1079
|
showPercentage={true}
|
|
976
1080
|
/>
|
|
977
1081
|
);
|
|
@@ -1624,14 +1728,14 @@ const Extension = () => {
|
|
|
1624
1728
|
<Table bordered={true}>
|
|
1625
1729
|
<TableHead>
|
|
1626
1730
|
<TableRow>
|
|
1627
|
-
<TableHeader>Name</TableHeader>
|
|
1628
|
-
<TableHeader>
|
|
1731
|
+
<TableHeader width={150} align="left">Name</TableHeader>
|
|
1732
|
+
<TableHeader>Price</TableHeader>
|
|
1629
1733
|
</TableRow>
|
|
1630
1734
|
</TableHead>
|
|
1631
1735
|
<TableBody>
|
|
1632
1736
|
<TableRow>
|
|
1633
1737
|
<TableCell>Roger Federer</TableCell>
|
|
1634
|
-
<TableCell
|
|
1738
|
+
<TableCell align="right">$1.50</TableCell>
|
|
1635
1739
|
</TableRow>
|
|
1636
1740
|
</TableBody>
|
|
1637
1741
|
</Table>
|
package/dist/coreComponents.d.ts
CHANGED
|
@@ -194,3 +194,8 @@ export declare const MultiSelect: "MultiSelect" & {
|
|
|
194
194
|
readonly props?: types.MultiSelectProps | undefined;
|
|
195
195
|
readonly children?: true | undefined;
|
|
196
196
|
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"MultiSelect", types.MultiSelectProps, true>>;
|
|
197
|
+
export declare const Flex: "Flex" & {
|
|
198
|
+
readonly type?: "Flex" | undefined;
|
|
199
|
+
readonly props?: types.FlexProps | undefined;
|
|
200
|
+
readonly children?: true | undefined;
|
|
201
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Flex", types.FlexProps, true>>;
|
package/dist/coreComponents.js
CHANGED
|
@@ -40,3 +40,4 @@ export const Box = createRemoteReactComponent('Box');
|
|
|
40
40
|
export const StepIndicator = createRemoteReactComponent('StepIndicator');
|
|
41
41
|
export const Accordion = createRemoteReactComponent('Accordion');
|
|
42
42
|
export const MultiSelect = createRemoteReactComponent('MultiSelect');
|
|
43
|
+
export const Flex = createRemoteReactComponent('Flex');
|
package/dist/types.d.ts
CHANGED
|
@@ -96,7 +96,9 @@ export interface ProgressBarProps {
|
|
|
96
96
|
'aria-label'?: string;
|
|
97
97
|
showPercentage?: boolean;
|
|
98
98
|
value?: number;
|
|
99
|
+
/** @deprecated use maxValue instead */
|
|
99
100
|
valueMax?: number;
|
|
101
|
+
maxValue?: number;
|
|
100
102
|
valueDescription?: string;
|
|
101
103
|
variant?: 'success' | 'danger' | 'warning';
|
|
102
104
|
}
|
|
@@ -216,6 +218,15 @@ export interface StackProps {
|
|
|
216
218
|
align?: 'start' | 'center' | 'baseline' | 'end' | 'stretch';
|
|
217
219
|
width?: 'auto' | '100%';
|
|
218
220
|
}
|
|
221
|
+
export interface FlexProps {
|
|
222
|
+
gap?: AllDistances;
|
|
223
|
+
children?: ReactNode;
|
|
224
|
+
direction?: 'row' | 'column';
|
|
225
|
+
justify?: 'center' | 'end' | 'start' | 'around' | 'between';
|
|
226
|
+
align?: 'start' | 'center' | 'baseline' | 'end' | 'stretch';
|
|
227
|
+
alignSelf?: 'start' | 'center' | 'baseline' | 'end' | 'stretch';
|
|
228
|
+
wrap?: boolean;
|
|
229
|
+
}
|
|
219
230
|
export interface StatisticsTrendProps {
|
|
220
231
|
value: string;
|
|
221
232
|
direction: 'increase' | 'decrease';
|
|
@@ -394,6 +405,7 @@ export interface CrmStageTrackerProps {
|
|
|
394
405
|
objectId?: number;
|
|
395
406
|
objectTypeId?: string;
|
|
396
407
|
properties: Array<string>;
|
|
408
|
+
showProperties?: boolean;
|
|
397
409
|
}
|
|
398
410
|
interface CrmSidebarExtensionPoint extends ExtensionPointContract {
|
|
399
411
|
actions: {
|
|
@@ -435,9 +447,17 @@ export interface LoadingSpinnerProps {
|
|
|
435
447
|
size?: TShirtSizes['xs'] | TShirtSizes['sm'] | TShirtSizes['md'];
|
|
436
448
|
layout?: 'inline' | 'centered';
|
|
437
449
|
}
|
|
450
|
+
interface AlignmentProps {
|
|
451
|
+
align?: 'left' | 'center' | 'right';
|
|
452
|
+
}
|
|
453
|
+
interface WidthProps {
|
|
454
|
+
width?: 'min' | 'max' | 'auto' | number;
|
|
455
|
+
}
|
|
438
456
|
export interface TableElementProps {
|
|
439
457
|
children: React.ReactNode;
|
|
440
458
|
}
|
|
459
|
+
export type TableHeaderProps = TableElementProps & AlignmentProps & WidthProps;
|
|
460
|
+
export type TableCellProps = TableElementProps & AlignmentProps & WidthProps;
|
|
441
461
|
interface BaseTableProps {
|
|
442
462
|
bordered?: boolean;
|
|
443
463
|
flush?: boolean;
|
|
@@ -475,8 +495,8 @@ export type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
|
475
495
|
};
|
|
476
496
|
export interface BoxProps {
|
|
477
497
|
children: ReactNode;
|
|
478
|
-
grow?: boolean;
|
|
479
498
|
alignSelf?: 'start' | 'center' | 'baseline' | 'end' | 'stretch' | 'auto';
|
|
499
|
+
flex?: 'initial' | 'auto' | 'none' | number;
|
|
480
500
|
}
|
|
481
501
|
interface TShirtSizes {
|
|
482
502
|
xs: 'extra-small' | 'xs';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/ui-extensions",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"typescript": "5.0.4"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "d11a7bb73cf91ed44279b041f17778833948839f"
|
|
52
52
|
}
|