@hubspot/ui-extensions 0.3.1 → 0.4.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 +104 -0
- package/dist/coreComponents.d.ts +5 -0
- package/dist/coreComponents.js +1 -0
- package/dist/types.d.ts +10 -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
|
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
|
@@ -216,6 +216,15 @@ export interface StackProps {
|
|
|
216
216
|
align?: 'start' | 'center' | 'baseline' | 'end' | 'stretch';
|
|
217
217
|
width?: 'auto' | '100%';
|
|
218
218
|
}
|
|
219
|
+
export interface FlexProps {
|
|
220
|
+
gap?: AllDistances;
|
|
221
|
+
children?: ReactNode;
|
|
222
|
+
direction?: 'row' | 'column';
|
|
223
|
+
justify?: 'center' | 'end' | 'start' | 'around' | 'between';
|
|
224
|
+
align?: 'start' | 'center' | 'baseline' | 'end' | 'stretch';
|
|
225
|
+
alignSelf?: 'start' | 'center' | 'baseline' | 'end' | 'stretch';
|
|
226
|
+
wrap?: boolean;
|
|
227
|
+
}
|
|
219
228
|
export interface StatisticsTrendProps {
|
|
220
229
|
value: string;
|
|
221
230
|
direction: 'increase' | 'decrease';
|
|
@@ -475,8 +484,8 @@ export type JsonValue = string | number | boolean | null | JsonValue[] | {
|
|
|
475
484
|
};
|
|
476
485
|
export interface BoxProps {
|
|
477
486
|
children: ReactNode;
|
|
478
|
-
grow?: boolean;
|
|
479
487
|
alignSelf?: 'start' | 'center' | 'baseline' | 'end' | 'stretch' | 'auto';
|
|
488
|
+
flex?: 'initial' | 'auto' | 'none' | number;
|
|
480
489
|
}
|
|
481
490
|
interface TShirtSizes {
|
|
482
491
|
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.4.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": "1269fb86282dd5f6b9686d064b6c652f00cb863f"
|
|
52
52
|
}
|