@hubspot/ui-extensions 0.0.1-prealpha.7 → 0.2.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 CHANGED
@@ -1,40 +1,106 @@
1
- # ui-extensions-components
1
+ # UI Extensions
2
+
3
+ React components and utilities for extending HubSpot's UI.
2
4
 
3
5
  ## TOC
4
6
 
7
+ - [Accordion](#accordion)
5
8
  - [Alert](#alert)
6
9
  - [Button](#button)
7
10
  - [ButtonRow](#buttonrow)
8
11
  - [Card](#card)
9
12
  - [DescriptionList](#descriptionlist)
10
- - [DescriptionListItem](#descriptionlistitem)
13
+ - [DescriptionListItem](#descriptionlistitem)
11
14
  - [Divider](#divider)
12
15
  - [Form](#form)
16
+ - [EmptyState](#emptystate)
17
+ - [ErrorState](#errorstate)
13
18
  - [Heading](#heading)
14
19
  - [Image](#image)
15
20
  - [Input](#input)
16
21
  - [Link](#link)
17
22
  - [LoadingSpinner](#loadingspinner)
23
+ - [NumberInput](#numberInput)
18
24
  - [ProgressBar](#progressbar)
19
25
  - [Select](#select)
20
26
  - [Stack](#stack)
21
27
  - [Statistics](#statistics)
22
- - [StatisticsItem](#statisticsitem)
23
- - [StatisticsTrend](#statisticstrend)
28
+ - [StatisticsItem](#statisticsitem)
29
+ - [StatisticsTrend](#statisticstrend)
30
+ - [StepIndicator](#StepIndicator)
24
31
  - [Table](#table)
25
- - [TableBody](#tablebody)
26
- - [TableCell](#tablecell)
27
- - [TableFooter](#tablefooter)
28
- - [TableHead](#tablehead)
29
- - [TableHeader](#tableheader)
30
- - [TableRow](#tablerow)
32
+ - [TableBody](#tablebody)
33
+ - [TableCell](#tablecell)
34
+ - [TableFooter](#tablefooter)
35
+ - [TableHead](#tablehead)
36
+ - [TableHeader](#tableheader)
37
+ - [TableRow](#tablerow)
31
38
  - [Tag](#tag)
32
39
  - [Text](#text)
33
40
  - [Textarea](#textarea)
34
41
  - [Tile](#tile)
42
+ - [ToggleGroup](#togglegroup)
35
43
 
36
44
  ## Components
37
45
 
46
+ ### Accordion
47
+
48
+ ##### Import
49
+
50
+ ```javascript
51
+ import { Accordion } from '@hubspot/ui-extensions';
52
+ ```
53
+
54
+ ##### Props
55
+
56
+ The Accordion component accepts the following props:
57
+
58
+ ```typescript
59
+ export interface AccordionProps {
60
+ title: string;
61
+ children: ReactNode;
62
+ defaultOpen?: boolean;
63
+ disabled?: boolean;
64
+ open?: boolean;
65
+ onClick?: () => void;
66
+ size?:
67
+ | 'small'
68
+ | 'extra-small'
69
+ | 'medium'
70
+ | 'xs'
71
+ | 'sm'
72
+ | 'md';
73
+ }
74
+ ```
75
+
76
+ | Prop | Type | Default | Description |
77
+ | --- | --- | --- | --- |
78
+ | `title` | `string` | `N/A` | The title text for the accordion. |
79
+ | `children` | `ReactNode(optional)` | `N/A` | The main content of the accordion when it opens. |
80
+ | `defaultOpen` | `boolean(optional)` | `false` | If `true`, the accordion will be open by default. |
81
+ | `disabled` | `boolean(optional)` | `false` | If `true`, users cannot change the open state of the accordion. |
82
+ | `open` | `boolean(optional)` | `N/A` | Use it when you want to control the open state programatically. If true, the accordion will open. |
83
+ | `onClick` | `() => void` `(optional)` | `N/A` | A function that will be invoked when the title is clicked. It receives no arguments and it's return value is ignored. |
84
+ | `size` | `'extra-small' \| 'small' \| 'medium' \| 'xs' \| 'sm' \| 'md'` | `'small'` | The size of the accordion title.|
85
+
86
+
87
+ ##### Usage
88
+
89
+ ```javascript
90
+ function Extension() {
91
+ return (
92
+ <>
93
+ <Accordion title="Item One">
94
+ <Text>first inner text</Text>
95
+ </Accordion>
96
+ <Accordion title="Item Two">
97
+ <Text>second inner text</Text>
98
+ </Accordion>
99
+ </>
100
+ );
101
+ }
102
+ ```
103
+
38
104
  ### Alert
39
105
 
40
106
  ##### Import
@@ -50,7 +116,6 @@ The Alert component accepts the following props:
50
116
  ```typescript
51
117
  export interface AlertProps {
52
118
  title: string;
53
- body?: string;
54
119
  children?: ReactNode;
55
120
  variant?: 'info' | 'warning' | 'success' | 'error' | 'danger';
56
121
  }
@@ -59,7 +124,6 @@ export interface AlertProps {
59
124
  | Prop | Type | Default | Description |
60
125
  | --- | --- | --- | --- |
61
126
  | `title` | `string` | `N/A` | The title text for the alert message. |
62
- | `body` | `string(optional)` | `N/A` | The main content of the alert message. If not provided, the children prop is used. |
63
127
  | `children` | `ReactNode(optional)` | `N/A` | The main content of the alert message when the body prop is not provided. |
64
128
  | `variant` | `'info' \| 'warning' \| 'success' \|'error' \| 'danger'` `(optional)` | `'info'` | Sets the color variation of the alert |
65
129
 
@@ -72,22 +136,18 @@ const Extension = () => {
72
136
  <Alert title="Important Info" variant="info">
73
137
  This is an informative message.
74
138
  </Alert>
75
- <Alert
76
- title="Success"
77
- body="Operation completed successfully."
78
- variant="success"
79
- />
80
- <Alert title="Warning" body="Proceed with caution." variant="warning" />
81
- <Alert
82
- title="Error"
83
- body="Something went wrong. Please try again."
84
- variant="error"
85
- />
86
- <Alert
87
- title="Danger"
88
- body="This action cannot be undone. Be careful."
89
- variant="danger"
90
- />
139
+ <Alert title="Success"variant="success">
140
+ Operation completed successfully.
141
+ </Alert>
142
+ <Alert title="Warning" variant="warning" >
143
+ Proceed with caution.
144
+ </Alert>
145
+ <Alert title="Error" variant="error" >
146
+ Something went wrong. Please try again.
147
+ </Alert>
148
+ <Alert title="Danger" variant="danger" >
149
+ This action cannot be undone. Be careful.
150
+ </Alert>
91
151
  </>
92
152
  );
93
153
  };
@@ -96,14 +156,16 @@ const Extension = () => {
96
156
  ### Button
97
157
 
98
158
  ##### Import
159
+
99
160
  ```javascript
100
161
  import { Button } from '@hubspot/ui-extensions';
101
162
  ```
102
163
 
103
164
  ##### Props
165
+
104
166
  ```typescript
105
167
  interface ButtonProps {
106
- text: string;
168
+ children: string;
107
169
  onClick?: () => void;
108
170
  href?: string;
109
171
  disabled?: boolean;
@@ -111,194 +173,219 @@ interface ButtonProps {
111
173
  type?: 'button' | 'reset' | 'submit';
112
174
  }
113
175
  ```
176
+
114
177
  | Prop | Type | Default | Description |
115
- | - | - | - | - |
116
- | `text` | `string` | `N/A` | The displayable text for the Button |
117
- | `onClick` | `() => void` `(optional)` | `N/A` | A function that will be invoked when the button is clicked. It receives no arguments and it's return value is ignored|
118
- | `href` | `string(optional)`| `N/A` | A URL that will be opened when the button is clicked. If the value is a URL external to HubSpot it will be opened in a new tab. |
119
- | `disabled` | `boolean(optional)` | `N/A` | Determines if the button should be disabled or not.|
178
+ | --- | --- | --- | --- |
179
+ | `children` | `string` | `N/A` | The displayable text for the Button |
180
+ | `onClick` | `() => void` `(optional)` | `N/A` | A function that will be invoked when the button is clicked. It receives no arguments and it's return value is ignored |
181
+ | `href` | `string(optional)` | `N/A` | A URL that will be opened when the button is clicked. If the value is a URL external to HubSpot it will be opened in a new tab. |
182
+ | `disabled` | `boolean(optional)` | `N/A` | Determines if the button should be disabled or not. |
120
183
  | `variant` | `'primary' \| 'secondary' \| 'destructive'` `(optional)` | `'secondary'` | Sets the color variation of the button |
121
184
  | `type` | `'button' \| 'reset' \| 'submit'` `(optional)` | `'button'` | Sets the HTML attribute "role" of the button |
122
185
 
123
186
  ##### Usage
187
+
124
188
  ```javascript
125
189
  const Extension = () => {
126
190
  return (
127
191
  <Button
128
- text="Click me!"
129
192
  onClick={() => {
130
193
  console.log('Someone clicked on the button!');
131
194
  }}
132
195
  href="https://hubspot.com"
133
196
  variant="destructive"
134
197
  type="button"
135
- />
198
+ >
199
+ Click me!
200
+ </Button>
136
201
  );
137
- }
202
+ };
138
203
  ```
139
204
 
140
205
  ### ButtonRow
141
206
 
142
207
  ##### Import
208
+
143
209
  ```javascript
144
210
  import { ButtonRow } from '@hubspot/ui-extensions';
145
211
  ```
146
212
 
147
213
  ##### Props
214
+
148
215
  ```typescript
149
216
  interface ButtonRowProps {
150
217
  children: ReactNode;
151
218
  disableDropdown?: boolean;
152
219
  }
153
220
  ```
221
+
154
222
  | Prop | Type | Default | Description |
155
- | - | - | - | - |
156
- | `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. |
223
+ | --- | --- | --- | --- |
224
+ | `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. |
157
225
  | `disableDropdown` | `boolean(optional)` | `false` | Disables the dropdown list of buttons that appears the the children expand beyond the horizontal space |
158
226
 
159
227
  ##### Usage
228
+
160
229
  ```javascript
161
230
  const Extension = () => {
162
231
  return (
163
232
  <ButtonRow disableDropdown={false}>
164
233
  <Button
165
- text="Regular Button"
166
234
  onClick={() => {
167
235
  console.log('Regular button clicked');
168
236
  }}
169
- />
237
+ >
238
+ Regular Button
239
+ </Button>
170
240
  <Button
171
- text="Reset"
172
241
  onClick={() => {
173
242
  console.log('Reset button clicked');
174
243
  }}
175
244
  variant="destructive"
176
245
  type="reset"
177
- />
246
+ >
247
+ Reset
248
+ </Button>
178
249
  <Button
179
- text="Submit"
180
250
  onClick={() => {
181
251
  console.log('Submit button clicked');
182
252
  }}
183
253
  variant="primary"
184
254
  type="submit"
185
- />
255
+ >
256
+ Submit
257
+ </Button>
186
258
  </ButtonRow>
187
259
  );
188
- }
260
+ };
189
261
  ```
190
262
 
191
263
  ### Card
192
264
 
193
265
  ##### Import
266
+
194
267
  ```javascript
195
268
  import { Card } from '@hubspot/ui-extensions';
196
269
  ```
197
270
 
198
271
  ##### Props
272
+
199
273
  ```typescript
200
274
  interface CardProps {
201
275
  children: ReactNode;
202
276
  }
203
277
  ```
278
+
204
279
  | Prop | Type | Default | Description |
205
- | - | - | - | - |
206
- | `children` | `ReactNode`| `N/A`| Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. |
280
+ | --- | --- | --- | --- |
281
+ | `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. |
207
282
 
208
283
  ##### Usage
284
+
209
285
  ```javascript
210
286
  const Extension = () => {
211
287
  return (
212
288
  <Card>
213
289
  <Button
214
- text="Regular Button"
215
290
  onClick={() => {
216
291
  console.log('Regular button clicked');
217
292
  }}
218
- />
293
+ >
294
+ Regular Button
295
+ </Button>
219
296
  </Card>
220
297
  );
221
- }
298
+ };
222
299
  ```
223
300
 
224
301
  ### DescriptionList
225
302
 
226
303
  ##### Import
304
+
227
305
  ```javascript
228
306
  import { DescriptionList } from '@hubspot/ui-extensions';
229
307
  ```
230
308
 
231
309
  ##### Props
310
+
232
311
  ```typescript
233
312
  interface DescriptionListProps {
234
313
  children: ReactNode;
235
314
  direction?: 'row' | 'column';
236
315
  }
237
316
  ```
317
+
238
318
  | Prop | Type | Default | Description |
239
- | - | - | - | - |
240
- | `children` | `ReactNode` | `N/A`| Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. The children should be [DescriptionListItem](#descriptionlistitem) |
241
- | `direction` | `'row' \| 'column'` `(optional)` | `'column'`| The direction the label/value pairs are placed in the description list container. |
319
+ | --- | --- | --- | --- |
320
+ | `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. The children should be [DescriptionListItem](#descriptionlistitem) |
321
+ | `direction` | `'row' \| 'column'` `(optional)` | `'column'` | The direction the label/value pairs are placed in the description list container. |
242
322
 
243
323
  ##### Usage
324
+
244
325
  ```javascript
245
326
  const Extension = () => {
246
327
  return (
247
328
  <DescriptionList direction="row">
248
- <DescriptionListItem label={"First Name"}>
249
- <Text text="Alan" />
329
+ <DescriptionListItem label={'First Name'}>
330
+ <Text>Alan</Text>
250
331
  </DescriptionListItem>
251
- <DescriptionListItem label={"Last Name"}>
252
- <Text text="Turing" />
332
+ <DescriptionListItem label={'Last Name'}>
333
+ <Text>Turing</Text>
253
334
  </DescriptionListItem>
254
335
  </DescriptionList>
255
336
  );
256
- }
337
+ };
257
338
  ```
258
339
 
259
340
  #### DescriptionListItem
260
341
 
261
342
  ##### Import
343
+
262
344
  ```javascript
263
345
  import { DescriptionListItem } from '@hubspot/ui-extensions';
264
346
  ```
265
347
 
266
348
  ##### Props
349
+
267
350
  ```typescript
268
351
  interface DescriptionListItemProps {
269
352
  children: ReactNode;
270
353
  label: string;
271
354
  }
272
355
  ```
356
+
273
357
  | Prop | Type | Default | Description |
274
- | - | - | - | - |
275
- | `children` | `ReactNode`| `N/A`| Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. |
276
- | `label` | `string` | `N/A` | Text to be displayed as the label |
358
+ | --- | --- | --- | --- |
359
+ | `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. |
360
+ | `label` | `string` | `N/A` | Text to be displayed as the label |
277
361
 
278
362
  ##### Usage
363
+
279
364
  ```javascript
280
365
  const Extension = () => {
281
366
  return (
282
367
  <DescriptionList direction="row">
283
- <DescriptionListItem label={"First Name"}>
284
- <Text text="Alan" />
368
+ <DescriptionListItem label={'First Name'}>
369
+ <Text>Alan</Text>
285
370
  </DescriptionListItem>
286
- <DescriptionListItem label={"Last Name"}>
287
- <Text text="Turing" />
371
+ <DescriptionListItem label={'Last Name'}>
372
+ <Text>Turing</Text>
288
373
  </DescriptionListItem>
289
374
  </DescriptionList>
290
375
  );
291
- }
376
+ };
292
377
  ```
293
378
 
294
379
  ### Divider
295
380
 
296
381
  ##### Import
382
+
297
383
  ```javascript
298
384
  import { Divider } from '@hubspot/ui-extensions';
299
385
  ```
300
386
 
301
387
  ##### Props
388
+
302
389
  ```typescript
303
390
  interface DividerProps {
304
391
  distance?:
@@ -310,27 +397,29 @@ interface DividerProps {
310
397
  | 'extra-large';
311
398
  }
312
399
  ```
400
+
313
401
  | Prop | Type | Default | Description |
314
- | - | - | - | - |
315
- | `distance` | `'flush'\| 'extra-small' \| 'small' \| 'medium' \| 'large'\| 'extra-large'` `(optional)`| `'small'` | The size of the padding above and below the divider. |
402
+ | --- | --- | --- | --- |
403
+ | `distance` | `'flush'\| 'extra-small' \| 'small' \| 'medium' \| 'large'\| 'extra-large'` `(optional)` | `'small'` | The size of the padding above and below the divider. |
316
404
 
317
405
  ##### Usage
406
+
318
407
  ```javascript
319
408
  const Extension = () => {
320
- return (
321
- <Divider distance="extra-large"/>
322
- );
323
- }
409
+ return <Divider distance="extra-large" />;
410
+ };
324
411
  ```
325
412
 
326
413
  ### Form
327
414
 
328
415
  ##### Import
416
+
329
417
  ```javascript
330
418
  import { Form } from '@hubspot/ui-extensions';
331
419
  ```
332
420
 
333
421
  ##### Props
422
+
334
423
  ```typescript
335
424
  interface FormProps {
336
425
  children: ReactNode;
@@ -338,13 +427,15 @@ interface FormProps {
338
427
  preventDefault?: boolean;
339
428
  }
340
429
  ```
430
+
341
431
  | Prop | Type | Default | Description |
342
- | - | - | - | - |
343
- | `children` | `ReactNode` | `N/A`| Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. |
344
- | `onSubmit` | `function(optional)` | `N/A`| A function that will be called when the form is submitted. It will receive a `RemoteEvent` as argument and it's return value will be ignored. |
345
- | `preventDefault` | `boolean(optional)` | `false`| If set to `true` `event.preventDefault()` will be invoked before your `onSubmit` function is called, preventing the default html form behavior. |
432
+ | --- | --- | --- | --- |
433
+ | `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. |
434
+ | `onSubmit` | `function(optional)` | `N/A` | A function that will be called when the form is submitted. It will receive a `RemoteEvent` as argument and it's return value will be ignored. |
435
+ | `preventDefault` | `boolean(optional)` | `false` | If set to `true` `event.preventDefault()` will be invoked before your `onSubmit` function is called, preventing the default html form behavior. |
346
436
 
347
437
  ##### Usage
438
+
348
439
  ```javascript
349
440
  const Extension = () => {
350
441
  return (
@@ -352,13 +443,14 @@ const Extension = () => {
352
443
  <Input {...} />
353
444
  <Select {...} />
354
445
  <Button
355
- text="Submit"
356
446
  onClick={() => {
357
447
  console.log('Submit button clicked');
358
448
  }}
359
449
  variant="primary"
360
450
  type="submit"
361
- />
451
+ >
452
+ Submit
453
+ </Button>
362
454
  </Form>
363
455
  );
364
456
  }
@@ -367,11 +459,13 @@ const Extension = () => {
367
459
  ### EmptyState
368
460
 
369
461
  ##### Import
462
+
370
463
  ```javascript
371
464
  import { EmptyState } from '@hubspot/ui-extensions';
372
465
  ```
373
466
 
374
467
  ##### Props
468
+
375
469
  ```typescript
376
470
  interface EmptyStateProps {
377
471
  children: ReactNode;
@@ -382,22 +476,24 @@ interface EmptyStateProps {
382
476
  title?: string;
383
477
  }
384
478
  ```
479
+
385
480
  | Prop | Type | Default | Description |
386
- | - | - | - | - |
387
- | `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. |
481
+ | --- | --- | --- | --- |
482
+ | `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. |
388
483
  | `flush` | `boolean(optional)` | `false` | Removes the default vertical margins for the component. |
389
- | `imageWidth` | `number(optional)` | `250`| The max-width for the image container. |
484
+ | `imageWidth` | `number(optional)` | `250` | The max-width for the image container. |
390
485
  | `layout` | `'horizontal' \| 'vertical'` `(optional)` | `'horizontal'` | Sets the layout direction for the content. |
391
486
  | `reverseOrder` | `boolean(optional)` | `false` | Swaps the visual order of the text (primary) and image (secondary) content. This ensures the primary content is still presented first to assistive technology. |
392
- | `title` | `string(optional)` | `Intl("All is not lost.")` | The text for the title header rendered above the `children`. |
487
+ | `title` | `string(optional)` | `Intl('All is not lost.')` | The text for the title header rendered above the `children`. |
393
488
 
394
489
  ##### Usage
490
+
395
491
  ```javascript
396
492
  const Extension = ({ data }) => {
397
493
  if (!data || !data.length) {
398
494
  return (
399
495
  <EmptyState title="Nothing here yet" layout="vertical" reverseOrder={true}>
400
- <Text text="Go out there and get some leads!" />
496
+ <Text>Go out there and get some leads!</Text>
401
497
  </EmptyState>
402
498
  )
403
499
  }
@@ -413,11 +509,13 @@ const Extension = ({ data }) => {
413
509
  ### ErrorState
414
510
 
415
511
  ##### Import
512
+
416
513
  ```javascript
417
514
  import { ErrorState } from '@hubspot/ui-extensions';
418
515
  ```
419
516
 
420
517
  ##### Props
518
+
421
519
  ```typescript
422
520
  interface ErrorStateProps {
423
521
  children: ReactNode;
@@ -425,21 +523,27 @@ interface ErrorStateProps {
425
523
  type?: 'error' | 'support' | 'lock';
426
524
  }
427
525
  ```
526
+
428
527
  | Prop | Type | Default | Description |
429
- | - | - | - | - |
430
- | `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. |
431
- | `title` | `string(optional)` | `Intl("All is not lost.")` | The text for the title header rendered above the `children`. |
528
+ | --- | --- | --- | --- |
529
+ | `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. |
530
+ | `title` | `string(optional)` | `Intl('All is not lost.')` | The text for the title header rendered above the `children`. |
432
531
  | `type` | `'error' \| 'support' \| 'lock'` `(optional)` | `'error'` | Sets the type of error image that will be shown. |
433
532
 
434
533
  ##### Usage
534
+
435
535
  ```javascript
436
536
  const Extension = ({ data, error, fetchData }) => {
437
537
  if (error) {
438
538
  return (
439
539
  <ErrorState title="Trouble fetching properties." layout="vertical" reverseOrder={true}>
440
540
  <Stack>
441
- <Text text="Please try again in a few moments." />
442
- <Button text="Try again" onClick={fetchData} />
541
+ <Text>
542
+ Please try again in a few moments.
543
+ </Text>
544
+ <Button onClick={fetchData}>
545
+ Try again
546
+ </Button>
443
547
  </Stack>
444
548
  </ErrorState>
445
549
  )
@@ -456,78 +560,65 @@ const Extension = ({ data, error, fetchData }) => {
456
560
  ### Heading
457
561
 
458
562
  ##### Import
563
+
459
564
  ```javascript
460
565
  import { Heading } from '@hubspot/ui-extensions';
461
566
  ```
462
567
 
463
568
  ##### Props
569
+
464
570
  ```typescript
465
571
  interface HeadingProps {
466
- text: string;
467
- format?: 'plaintext' | 'markdown';
572
+ children: ReactNode;
573
+ inline?: boolean;
468
574
  }
469
575
  ```
470
- | Prop | Type | Default | Description |
471
- | - | - | - | - |
472
- | `text` | `string` | `N/A`| Text to be displayed as heading text. If format is `"markdown"`, inline markdown elements (i.e. bold, italics, code, links) are supported|
473
- | `format` | `'plaintext' \| 'markdown'` `(optional)` | `'plaintext'`| Type of formatting for the display text. |
474
-
475
- #### Markdown
476
- Markdown syntax supported in the component:
477
576
 
478
- - bold text: `**like this**` or `__like this__`
479
- - italicized text: `*like this*` or `_like this_`
480
- - inline code: `` `like this` ``
481
- - links: `[visible anchor text](https://www.hubspot.com/)`
577
+ | Prop | Type | Default | Description |
578
+ | --- | --- | --- | --- |
579
+ | `children` | `string` | `N/A` | Text to be displayed as heading text. |
580
+ | `inline` | `boolean(optional)` | `false` | Determines if the text will break line or share the space. |
482
581
 
483
582
  ##### Usage
583
+
484
584
  ```javascript
485
585
  const Extension = () => {
486
- return (
487
- <>
488
- <Heading text="Plain text, nothing special here"/>
489
- <Heading text="**It's a Bold Strategy Cotton, lets see if it pays off for them.**" format="markdown"/>
490
- </>
491
- );
492
- }
586
+ return <Heading>Plain text, nothing special here</Heading>;
587
+ };
493
588
  ```
494
589
 
495
590
  ### Image
496
- ##### Import
497
591
 
592
+ ##### Import
498
593
 
499
594
  ```javascript
500
595
  import { Image } from '@hubspot/ui-extensions';
501
596
  ```
502
597
 
503
598
  ##### Props
599
+
504
600
  ```typescript
505
- interface ImageProps {
601
+ interface ImageProps {
506
602
  alt?: string;
507
603
  href?: string;
508
604
  onClick?: () => void;
509
605
  src: string;
510
606
  width?: number;
607
+ height?: number;
511
608
  }
512
609
  ```
513
610
 
514
- | Prop | Type | Description |
515
- | - | - | - |
516
- | `alt` | `string(optional)` | The alt text for the image, similar to the `alt` attribute for the html [img tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attributes) |
517
- | `href` | `string(optional)` | If provided, it will be used as a href that will be opened in a new tag when the image is clicked |
518
- | `onClick` | `function(optional)` | A function that will be called when the image is clicked on. This function will receive no arguments any returned values will be ignored. |
519
- | `src` | | `string` | The url to the image to display, similar to [img tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attributes)|
520
- | `width` | `number(optional)` | The pixel width of the image |
521
-
522
- | Prop | Type | Description |
523
- | - | - | - |
611
+ | Prop | Type | Description |
612
+ | --- | --- | --- |
524
613
  | `alt` | `string(optional)` | The alt text for the image, similar to the `alt` attribute for the html [img tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attributes) |
525
614
  | `href` | `string(optional)` | If provided, it will be used as a href that will be opened in a new tag when the image is clicked |
526
615
  | `onClick` | `function(optional)` | A function that will be called when the image is clicked on. This function will receive no arguments any returned values will be ignored. |
527
- | `src` | | `string` | The url to the image to display, similar to [img tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attributes)|
616
+ | `src` | `string` | The url to the image to display, similar to [img tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img#attributes) |
528
617
  | `width` | `number(optional)` | The pixel width of the image |
618
+ | `height` | `number(optional)` | The pixel height of the image |
529
619
 
530
620
  ##### Usage
621
+
531
622
  ```javascript
532
623
  const Extension = () => {
533
624
  return (
@@ -536,22 +627,24 @@ const Extension = () => {
536
627
  src="https://picsum.photos/id/237/200/300"
537
628
  href="https://picsum.photos/id/237"
538
629
  onClick={() => {
539
- console.log('Someone clicked on the image!')
630
+ console.log('Someone clicked on the image!');
540
631
  }}
541
632
  width={200}
542
633
  />
543
634
  );
544
- }
635
+ };
545
636
  ```
546
637
 
547
638
  ### Input
548
639
 
549
640
  ##### Import
641
+
550
642
  ```javascript
551
643
  import { Input } from '@hubspot/ui-extensions';
552
644
  ```
553
645
 
554
646
  ##### Props
647
+
555
648
  ```typescript
556
649
  interface InputProps {
557
650
  label: string;
@@ -570,31 +663,33 @@ interface InputProps {
570
663
  onFocus?: (value: string) => void;
571
664
  }
572
665
  ```
666
+
573
667
  | Prop | Type | Default | Description |
574
- | - | - | - | - |
575
- | `label` | `string` | `N/A`| The label text to display for the form input element |
576
- | `name` | `string` | `N/A`| The unique identifier for the input element, this could be thought of as the HTML5 [Input element's name attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name) |
577
- | `value` | `string(optional)` | `''`| The value of the input |
578
- | `required` | `boolean(optional)` | `false`| Determines if the required indicator should be displayed |
579
- | `readOnly` | `boolean(optional)` | `false`| Determines if the field is editable or not. |
580
- | `description` | `string(optional)` | `N/A`| Instructional message to display to the user to help understand the purpose of the input. |
581
- | `tooltip` | `string(optional)` | `N/A`| Text that will appear in a tooltip next to the input label. |
582
- | `placeholder` | `string(optional)` | `N/A`| Text that appears in the input when it has no value set. |
583
- | `error` | `boolean(optional)` | `false`| If set to true, `validationMessage` is displayed as an error message, if it was provided. The input will also render it's error state to let the user know there is an error. If false, `validationMessage` is displayed as a success message. |
584
- | `validationMessage` | `string(optional)` | `''`| The text to show if the input has an error. |
585
- | `onChange` | `(value: string) => void(optional)` | `N/A`| A callback function that is invoked when the value is committed. Currently these times are `onBlur` of the input and when the user submits the form. |
586
- | `onInput` | `(value: string) => void(optional)` | `N/A`| A function that is called and passed the value every time the field is edited by the user. It is recommended that you do not use this value to update state, that is what `onChange` should be used for. Instead this should be used for validation. |
587
- | `onBlur` | `(value: string) => void(optional)` | `N/A`| A function that is called and passed the value every time the field loses focus. |
588
- | `onFocus` | `(value: string) => void(optional)` | `N/A`| A function that is called and passed the value every time the field gets focused. |
668
+ | --- | --- | --- | --- |
669
+ | `label` | `string` | `N/A` | The label text to display for the form input element |
670
+ | `name` | `string` | `N/A` | The unique identifier for the input element, this could be thought of as the HTML5 [Input element's name attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name) |
671
+ | `value` | `string(optional)` | `''` | The value of the input |
672
+ | `required` | `boolean(optional)` | `false` | Determines if the required indicator should be displayed |
673
+ | `readOnly` | `boolean(optional)` | `false` | Determines if the field is editable or not. |
674
+ | `description` | `string(optional)` | `N/A` | Instructional message to display to the user to help understand the purpose of the input. |
675
+ | `tooltip` | `string(optional)` | `N/A` | Text that will appear in a tooltip next to the input label. |
676
+ | `placeholder` | `string(optional)` | `N/A` | Text that appears in the input when it has no value set. |
677
+ | `error` | `boolean(optional)` | `false` | If set to true, `validationMessage` is displayed as an error message, if it was provided. The input will also render it's error state to let the user know there is an error. If false, `validationMessage` is displayed as a success message. |
678
+ | `validationMessage` | `string(optional)` | `''` | The text to show if the input has an error. |
679
+ | `onChange` | `(value: string) => void(optional)` | `N/A` | A callback function that is invoked when the value is committed. Currently these times are `onBlur` of the input and when the user submits the form. |
680
+ | `onInput` | `(value: string) => void(optional)` | `N/A` | A function that is called and passed the value every time the field is edited by the user. It is recommended that you do not use this value to update state, that is what `onChange` should be used for. Instead this should be used for validation. |
681
+ | `onBlur` | `(value: string) => void(optional)` | `N/A` | A function that is called and passed the value every time the field loses focus. |
682
+ | `onFocus` | `(value: string) => void(optional)` | `N/A` | A function that is called and passed the value every time the field gets focused. |
589
683
 
590
684
  ##### Usage
685
+
591
686
  ```javascript
592
687
  import { useState } from 'react';
593
688
 
594
689
  const Extension = () => {
595
- const [ name, setName ] = useState('');
596
- const [ validationMessage, setValidationMessage ] = useState('');
597
- const [ isValid, setIsValid ] = useState(true);
690
+ const [name, setName] = useState('');
691
+ const [validationMessage, setValidationMessage] = useState('');
692
+ const [isValid, setIsValid] = useState(true);
598
693
 
599
694
  return (
600
695
  <Form>
@@ -607,96 +702,184 @@ const Extension = () => {
607
702
  required={true}
608
703
  error={!isValid}
609
704
  validationMessage={validationMessage}
610
- onChange={(value) => {
611
- setName(value)
705
+ onChange={value => {
706
+ setName(value);
612
707
  }}
613
- onInput={(value) => {
614
- if(value !== 'Bill') {
708
+ onInput={value => {
709
+ if (value !== 'Bill') {
615
710
  setValidationMessage('This form only works for people named Bill');
616
711
  setIsValid(false);
617
712
  } else if (value === '') {
618
- setValidationMessage('First name is required')
713
+ setValidationMessage('First name is required');
619
714
  setIsValid(false);
620
715
  } else {
621
- setValidationMessage('Valid first name!')
716
+ setValidationMessage('Valid first name!');
622
717
  setIsValid(true);
623
718
  }
624
719
  }}
625
720
  />
626
721
  </Form>
627
722
  );
628
- }
723
+ };
629
724
  ```
630
725
 
631
726
  ### Link
632
727
 
633
728
  ##### Import
729
+
634
730
  ```javascript
635
731
  import { Link } from '@hubspot/ui-extensions';
636
732
  ```
637
733
 
638
734
  ##### Props
735
+
639
736
  ```typescript
640
737
  export interface LinkProps {
641
738
  href: string;
642
739
  variant?: 'primary' | 'destructive' | 'light' | 'dark';
643
740
  children: ReactNode;
741
+ onClick?: () => void;
742
+ preventDefault?: boolean;
644
743
  }
645
744
  ```
745
+
646
746
  | Prop | Type | Default | Description |
647
747
  | --- | --- | --- | --- |
648
- | `href` | `string`| `N/A` | A URL that will be opened when the link is clicked. If the value is a URL external to HubSpot it will be opened in a new tab. |
748
+ | `href` | `string` | `N/A` | A URL that will be opened when the link is clicked. If the value is a URL external to HubSpot it will be opened in a new tab. |
649
749
  | `variant` | `'primary' \| 'light' \| 'dark' \| 'destructive'` `(optional)` | `'primary'` | Sets the color variation of the link |
650
- | `children` | `ReactNode` | `N/A`| Sets the content that will render inside the component. |
750
+ | `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. |
751
+ | `onClick` | `() => void` `(optional)` | `N/A` | A function that will be invoked when the link is clicked. It receives no arguments and it's return value is ignored |
752
+ | `preventDefault` | `boolean(optional)` | `false` | If set to `true` `event.preventDefault()` will be invoked before your `onClick` function is called, preventing automatic navigation to the anchor's href url. |
651
753
 
652
754
  ##### Usage
755
+
653
756
  ```javascript
654
757
  const Extension = () => {
655
- return <Link href="https://app.hubspot.com/">HubSpot</Link>
656
- }
758
+ return <Link href="https://app.hubspot.com/">HubSpot</Link>;
759
+ };
657
760
  ```
761
+
658
762
  ### LoadingSpinner
659
763
 
660
764
  ##### Import
765
+
661
766
  ```javascript
662
767
  import { LoadingSpinner } from '@hubspot/ui-extensions';
663
768
  ```
664
769
 
665
770
  ##### Props
771
+
666
772
  ```typescript
667
773
  export interface LoadingSpinnerProps {
668
774
  label: string;
669
775
  showLabel?: boolean;
670
- size?: 'xs' | 'sm' | 'md';
776
+ size?: 'xs' | 'extra-small' | 'sm' | 'small' | 'md' | 'medium';
671
777
  layout?: 'inline' | 'centered';
672
- grow?: boolean;
673
778
  }
674
779
  ```
780
+
675
781
  | Prop | Type | Default | Description |
676
782
  | --- | --- | --- | --- |
677
- | `label` | `string` | `N/A`| The companion text for the loading spinner. |
783
+ | `label` | `string` | `N/A` | The companion text for the loading spinner. |
678
784
  | `showLabel` | `boolean(optional)` | `false` | if `true`, the label will be visible alongside the loading spinner. |
679
- | `size` | `'xs'\| 'sm' \| 'md'` `(optional)`| `'sm'` | The size of the loading spinner icon. |
680
- | `layout` | `'inline'\| 'centered'` `(optional)`| `N/A` | Use the `centered` option for layout as a convenience for the common pattern of filling the space of its parent. |
681
- | `grow` | `boolean(optional)` | `false` | if `true`, sets the height and width of the loading spinner to 100%.|
785
+ | `size` | `'xs' \| 'sm' \| 'md' \| 'extra-small' \| 'small' \| 'medium'` `(optional)` | `'sm'` | The size of the loading spinner icon. |
786
+ | `layout` | `'inline'\| 'centered'` `(optional)` | `N/A` | Use the `centered` option for layout as a convenience for the common pattern of filling the space of its parent. |
682
787
 
683
788
  ##### Usage
789
+
684
790
  ```javascript
685
791
  const Extension = () => {
686
792
  return <LoadingSpinner label="Loading..." />;
793
+ };
794
+ ```
795
+ ### NumberInput
796
+
797
+ ##### Import
798
+
799
+ ```javascript
800
+ import { NumberInput } from '@hubspot/ui-extensions';
801
+ ```
802
+
803
+ ##### Props
804
+
805
+ ```typescript
806
+ export interface NumberInputProps {
807
+ label: string;
808
+ name: string;
809
+ value?: number;
810
+ required?: boolean;
811
+ readOnly?: boolean;
812
+ description?: string;
813
+ tooltip?: string;
814
+ placeholder?: string;
815
+ error?: boolean;
816
+ defaultValue?: number;
817
+ validationMessage?: string;
818
+ onChange?: (value: number) => void;
819
+ onInput?: (value: number) => void;
820
+ onBlur?: (value: number) => void;
821
+ onFocus?: (value: number) => void;
822
+ min?: number;
823
+ max?: number;
824
+ precision?: number;
825
+ formatStyle?: 'decimal' | 'percentage';
687
826
  }
688
827
  ```
828
+
829
+ | Prop | Type | Default | Description |
830
+ | --- | --- | --- | --- |
831
+ | `label` | `string` | `N/A` | The label text to display for the form input element |
832
+ | `name` | `string` | `N/A` | The unique identifier for the input element, this could be thought of as the HTML5 [Input element's name attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#name) |
833
+ | `value` | `number(optional)` | `''` | The value of the input |
834
+ | `required` | `boolean(optional)` | `false` | Determines if the required indicator should be displayed |
835
+ | `readOnly` | `boolean(optional)` | `false` | Determines if the field is editable or not. |
836
+ | `description` | `string(optional)` | `N/A` | Instructional message to display to the user to help understand the purpose of the input. |
837
+ | `tooltip` | `string(optional)` | `N/A` | Text that will appear in a tooltip next to the input label. |
838
+ | `placeholder` | `string(optional)` | `N/A` | Text that appears in the input when it has no value set. |
839
+ | `error` | `boolean(optional)` | `false` | If set to true, `validationMessage` is displayed as an error message, if it was provided. The input will also render it's error state to let the user know there is an error. If false, `validationMessage` is displayed as a success message. |
840
+ | `validationMessage` | `string(optional)` | `''` | The text to show if the input has an error. |
841
+ | `onChange` | `(value: number) => void(optional)` | `N/A` | A callback function that is invoked when the value is committed. Currently these times are `onBlur` of the input and when the user submits the form. |
842
+ | `onInput` | `(value: number) => void(optional)` | `N/A` | A function that is called and passed the value every time the field is edited by the user. It is recommended that you do not use this value to update state, that is what `onChange` should be used for. Instead this should be used for validation. |
843
+ | `onBlur` | `(value: number) => void(optional)` | `N/A` | A function that is called and passed the value every time the field loses focus. |
844
+ | `onFocus` | `(value: number) => void(optional)` | `N/A` | A function that is called and passed the value every time the field gets focused. |
845
+ | `min` | `number(optional)` | `N/A` | Sets the lower bound of your input. |
846
+ | `max` | `number(optional)` | `N/A` | Sets the upper bound of your input. |
847
+ | `precision` | `number(optional)` | `N/A` | Represents the number of digits to the right of the decimal point. |
848
+ | `precision` | `number(optional)` | `N/A` | Represents the number of digits to the right of the decimal point. |
849
+ | `formatStyle` | `'decimal' \| 'percentage'` | `'decimal'` | Formats the input as a decimal point number or a percentage. |
850
+
851
+ ##### Usage
852
+
853
+ ```javascript
854
+ const Extension = () => {
855
+ const [portalCount, setPortalCount] = useState(0);
856
+ return (
857
+ <NumberInput
858
+ label={'HubSpot Portal Count'}
859
+ name="portalsNumber"
860
+ description={'Number of active portals'}
861
+ placeholder={'number of portals'}
862
+ value={portalCount}
863
+ onChange={value => setPortalCount(value)}
864
+ />
865
+ );
866
+ };
867
+ ```
868
+
689
869
  ### ProgressBar
690
870
 
691
871
  ##### Import
872
+
692
873
  ```javascript
693
874
  import { ProgressBar } from '@hubspot/ui-extensions';
694
875
  ```
695
876
 
696
877
  ##### Props
878
+
697
879
  ```typescript
698
- export interface ProgressBarProps {
880
+ export interface ProgressBarProps {
699
881
  title?: string;
882
+ aria-label?: string;
700
883
  showPercentage?: boolean;
701
884
  value?: number;
702
885
  valueMax?: number;
@@ -704,16 +887,19 @@ import { ProgressBar } from '@hubspot/ui-extensions';
704
887
  variant?: 'success' | 'danger' | 'warning';
705
888
  }
706
889
  ```
890
+
707
891
  | Prop | Type | Default | Description |
708
892
  | --- | --- | --- | --- |
709
893
  | `title` | `string(optional)` | `N/A` | Text to be displayed in the progressbar title. |
710
- | `showPercentage` | `boolean(optional)` | `false` | Toggles the display of the completion percentage. |
711
- | `value` | `number(optional)` | `0` | The value of the progress indicator.
712
- | `valueMax` | `number(optional)` | `100` | The maximum value of the progress.
713
- | `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"**
714
- | `variant` | `'success' \| 'danger' \| 'warning'` | `'success'` | The type of progressbar to display. Defaults to success.
894
+ | `showPercentage` | `boolean(optional)` | `false` | Toggles the display of the completion percentage. |
895
+ | `value` | `number(optional)` | `0` | The value of the progress indicator. |
896
+ | `valueMax` | `number(optional)` | `100` | The maximum value of the progress. |
897
+ | `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"** |
898
+ | `variant` | `'success' \| 'danger' \| 'warning'` | `'success'` | The type of progressbar to display. Defaults to success. |
899
+ | `aria-label` | `string(optional)` | `N/A` | Indicates the content of the ProgressBar to screen readers. Should be used if there's no title. |
715
900
 
716
901
  ##### Usage
902
+
717
903
  ```javascript
718
904
  const Extension = () => {
719
905
  return (
@@ -723,18 +909,20 @@ const Extension = () => {
723
909
  valueMax={200}
724
910
  showPercentage={true}
725
911
  />
726
- );
727
- }
912
+ );
913
+ };
728
914
  ```
729
915
 
730
916
  ### Select
731
917
 
732
918
  ##### Import
919
+
733
920
  ```javascript
734
921
  import { Select } from '@hubspot/ui-extensions';
735
922
  ```
736
923
 
737
924
  ##### Props
925
+
738
926
  ```typescript
739
927
  interface SelectProps {
740
928
  label: string;
@@ -753,33 +941,34 @@ interface SelectProps {
753
941
  value: string | number | boolean;
754
942
  }[];
755
943
  }
756
-
757
944
  ```
945
+
758
946
  | Prop | Type | Default | Description |
759
- | - | - | - | - |
760
- | `label` | `string` | `N/A`| The label text to display for the select element |
761
- | `name` | `string` | `N/A`| The unique identifier for the select element. |
762
- | `value` | `string \| number \| boolean` | `''`| The value of the select input. |
763
- | `required` | `boolean` | `false`| Determines if the required indicator should be displayed |
764
- | `readOnly` | `boolean` | `false`| Determines if the field is editable or not. |
765
- | `description` | `string` | `N/A`| Instructional message to display to the user to help understand the purpose of the input. |
766
- | `tooltip` | `string` | `N/A`| Text that will appear in a tooltip next to the input label. |
767
- | `placeholder` | `string` | `N/A`| Text that appears in the input when it has no value set. |
768
- | `error` | `boolean(optional)` | `false`| If set to true, `validationMessage` is displayed as an error message, if it was provided. The input will also render it's error state to let the user know there is an error. If false, `validationMessage` is displayed as a success message. |
769
- | `validationMessage` | `string(optional)` | `''`| The text to show if the input has an error. |
770
- | `onChange` | `(value: string) => void` | `N/A`| Function that is called with the new value when it is updated. |
771
- | `options` | `Array<{label: string; value: string \| number \| boolean}>` | `N/A`| Array of options to be displayed in the select. `label` will be used as the display text in the dropdown list and `value` should be a **unique** identifier. `value` is the data that will be submitted with the form. |
947
+ | --- | --- | --- | --- |
948
+ | `label` | `string` | `N/A` | The label text to display for the select element |
949
+ | `name` | `string` | `N/A` | The unique identifier for the select element. |
950
+ | `value` | `string \| number \| boolean` | `''` | The value of the select input. |
951
+ | `required` | `boolean` | `false` | Determines if the required indicator should be displayed |
952
+ | `readOnly` | `boolean` | `false` | Determines if the field is editable or not. |
953
+ | `description` | `string` | `N/A` | Instructional message to display to the user to help understand the purpose of the input. |
954
+ | `tooltip` | `string` | `N/A` | Text that will appear in a tooltip next to the input label. |
955
+ | `placeholder` | `string` | `N/A` | Text that appears in the input when it has no value set. |
956
+ | `error` | `boolean(optional)` | `false` | If set to true, `validationMessage` is displayed as an error message, if it was provided. The input will also render it's error state to let the user know there is an error. If false, `validationMessage` is displayed as a success message. |
957
+ | `validationMessage` | `string(optional)` | `''` | The text to show if the input has an error. |
958
+ | `onChange` | `(value: string) => void` | `N/A` | Function that is called with the new value when it is updated. |
959
+ | `options` | `Array<{label: string; value: string \| number \| boolean}>` | `N/A` | Array of options to be displayed in the select. `label` will be used as the display text in the dropdown list and `value` should be a **unique** identifier. `value` is the data that will be submitted with the form. |
772
960
 
773
961
  ##### Usage
962
+
774
963
  ```javascript
775
964
  const Extension = () => {
776
- const [ name, setName ] = useState(null);
777
- const [ validationMessage, setValidationMessage ] = useState('');
778
- const [ isValid, setIsValid ] = useState(true);
965
+ const [name, setName] = useState(null);
966
+ const [validationMessage, setValidationMessage] = useState('');
967
+ const [isValid, setIsValid] = useState(true);
779
968
 
780
969
  const options = [
781
- {label: 'Bill', value: 42},
782
- {label: 'Ted', value: 43}
970
+ { label: 'Bill', value: 42 },
971
+ { label: 'Ted', value: 43 },
783
972
  ];
784
973
 
785
974
  return (
@@ -793,9 +982,9 @@ const Extension = () => {
793
982
  required={true}
794
983
  error={!isValid}
795
984
  validationMessage={validationMessage}
796
- onChange={(value) => {
797
- setName(value)
798
- if(!value) {
985
+ onChange={value => {
986
+ setName(value);
987
+ if (!value) {
799
988
  setValidationMessage('This is required');
800
989
  setIsValid(false);
801
990
  } else {
@@ -807,31 +996,46 @@ const Extension = () => {
807
996
  />
808
997
  </Form>
809
998
  );
810
- }
999
+ };
811
1000
  ```
812
1001
 
813
1002
  ### Stack
814
1003
 
815
1004
  ##### Import
1005
+
816
1006
  ```javascript
817
1007
  import { Stack } from '@hubspot/ui-extensions';
818
1008
  ```
819
1009
 
820
1010
  ##### Props
1011
+
821
1012
  ```typescript
822
1013
  interface StackProps {
823
- distance?: 'flush' | 'small' | 'extra-small' | 'medium' | 'large';
1014
+ distance?:
1015
+ | 'flush'
1016
+ | 'small'
1017
+ | 'extra-small'
1018
+ | 'medium'
1019
+ | 'large'
1020
+ | 'extra-large'
1021
+ | 'xs'
1022
+ | 'sm'
1023
+ | 'md'
1024
+ | 'lg'
1025
+ | 'xl';
824
1026
  direction?: 'row' | 'column';
825
1027
  children?: ReactNode;
826
1028
  }
827
1029
  ```
1030
+
828
1031
  | Prop | Type | Default | Description |
829
- | - | - | - | - |
830
- | `distance` | `'flush' \| 'extra-small' \| 'small' \| 'medium' \| 'large'` | `'small'`| Amount of space between each child component passed as children |
831
- | `direction` | `'row' \| 'column'` | `'column'`| Stacks elements in the vertical or horizontal direction. |
832
- | `children` | `ReactNode` | `N/A`| Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. |
1032
+ | --- | --- | --- | --- |
1033
+ | `distance` | `'flush' \| 'extra-small' \| 'small' \| 'medium' \| 'large' \| 'extra-large' \| 'xs' \| 'sm' \| 'md' \| 'lg' \| 'xl'` | `'small'` | Amount of space between each child component passed as children |
1034
+ | `direction` | `'row' \| 'column'` | `'column'` | Stacks elements in the vertical or horizontal direction. |
1035
+ | `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. |
833
1036
 
834
1037
  ##### Usage
1038
+
835
1039
  ```javascript
836
1040
  const Extension = () => {
837
1041
  return (
@@ -846,21 +1050,25 @@ const Extension = () => {
846
1050
  ### Statistics
847
1051
 
848
1052
  ##### Import
1053
+
849
1054
  ```javascript
850
1055
  import { Statistics } from '@hubspot/ui-extensions';
851
1056
  ```
852
1057
 
853
1058
  ##### Props
1059
+
854
1060
  ```typescript
855
1061
  interface StatisticsProps {
856
1062
  children: ReactNode;
857
1063
  }
858
1064
  ```
1065
+
859
1066
  | Prop | Type | Default | Description |
860
- | - | - | - | - |
861
- | `children` | `ReactNode` | `N/A`| Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. These children should be [StatisticsItem](#statisticsitem) or [StatisticsTrend](#statisticstrend) |
1067
+ | --- | --- | --- | --- |
1068
+ | `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. These children should be [StatisticsItem](#statisticsitem) or [StatisticsTrend](#statisticstrend) |
862
1069
 
863
1070
  ##### Usage
1071
+
864
1072
  ```javascript
865
1073
  const Extension = () => {
866
1074
  return (
@@ -875,11 +1083,13 @@ const Extension = () => {
875
1083
  #### StatisticsItem
876
1084
 
877
1085
  ##### Import
1086
+
878
1087
  ```javascript
879
1088
  import { StatisticsItem } from '@hubspot/ui-extensions';
880
1089
  ```
881
1090
 
882
1091
  ##### Props
1092
+
883
1093
  ```typescript
884
1094
  interface StatisticsItemProps {
885
1095
  id?: string;
@@ -888,46 +1098,52 @@ interface StatisticsItemProps {
888
1098
  children: ReactNode;
889
1099
  }
890
1100
  ```
1101
+
891
1102
  | Prop | Type | Default | Description |
892
- | - | - | - | - |
893
- | `id` | `string(optional)` | `N/A`| The unique identifier |
894
- | `label` | `string` | `N/A`| The text to be used as a label |
895
- | `number` | `string` | `N/A`| Fully formatted string to be displayed as the item's primary number |
896
- | `children` | `ReactNode` | `N/A`| Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. These children should be [Text](#text) or [StatisticsTrend](#statisticstrend) |
1103
+ | --- | --- | --- | --- |
1104
+ | `id` | `string(optional)` | `N/A` | The unique identifier |
1105
+ | `label` | `string` | `N/A` | The text to be used as a label |
1106
+ | `number` | `string` | `N/A` | Fully formatted string to be displayed as the item's primary number |
1107
+ | `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. These children should be [Text](#text) or [StatisticsTrend](#statisticstrend) |
897
1108
 
898
1109
  ##### Usage
1110
+
899
1111
  ```javascript
900
1112
  const Extension = () => {
901
1113
  return (
902
1114
  <Statistics>
903
1115
  <StatisticsItem label="Sales" number={'30000'}>
904
- <Text text="Big Numbers" />
1116
+ <Text>Big Numbers</Text>
905
1117
  </StatisticsItem>
906
1118
  </Statistics>
907
1119
  );
908
- }
1120
+ };
909
1121
  ```
910
1122
 
911
1123
  #### StatisticsTrend
912
1124
 
913
1125
  ##### Import
1126
+
914
1127
  ```javascript
915
1128
  import { StatisticsTrend } from '@hubspot/ui-extensions';
916
1129
  ```
917
1130
 
918
1131
  ##### Props
1132
+
919
1133
  ```typescript
920
1134
  interface StatisticsTrendProps {
921
1135
  value: string;
922
1136
  direction: 'increase' | 'decrease';
923
1137
  }
924
1138
  ```
1139
+
925
1140
  | Prop | Type | Default | Description |
926
- | - | - | - | - |
927
- | `value` | `string` | `N/A`| Formatted string to be displayed as trend value |
928
- | `direction` | `'increase' \| 'decrease'` | `N/A`| Direction in which the trend arrow should be displayed |
1141
+ | --- | --- | --- | --- |
1142
+ | `value` | `string` | `N/A` | Formatted string to be displayed as trend value |
1143
+ | `direction` | `'increase' \| 'decrease'` | `N/A` | Direction in which the trend arrow should be displayed |
929
1144
 
930
1145
  ##### Usage
1146
+
931
1147
  ```javascript
932
1148
  const Extension = () => {
933
1149
  return (
@@ -940,18 +1156,76 @@ const Extension = () => {
940
1156
  </StatisticsItem>
941
1157
  </Statistics>
942
1158
  );
1159
+ };
1160
+ ```
1161
+
1162
+
1163
+ ### StepIndicator
1164
+
1165
+ ##### Import
1166
+
1167
+ ```javascript
1168
+ import { StepIndicator } from '@hubspot/ui-extensions';
1169
+ ```
1170
+
1171
+ ##### Props
1172
+
1173
+ ```typescript
1174
+ export interface StepIndicatorProps {
1175
+ stepNames: string[];
1176
+ direction?: 'horizontal' | 'vertical';
1177
+ onClick?: (stepIndex: number) => void;
1178
+ circleSize?: AllSizes;
1179
+ currentStep?: number;
1180
+ variant?: 'default' | 'compact' | 'flush';
943
1181
  }
944
1182
  ```
945
1183
 
1184
+ | Prop | Type | Default | Description |
1185
+ | --- | --- | --- | --- |
1186
+ | `stepNames` | `Array<string>` | `N/A` | Sets the name of the available steps. |
1187
+ | `direction` | `'horizontal' \| 'vertical'` `(optional)` | `N/A` | Determines whether the step indicator is laid out on a horizontal or vertical axis. |
1188
+ | `onClick` | `() => void` `(optional)` | `N/A` | A function that will be invoked when a step is clicked. It receives the current step index as an argument(zero based). Use this to update the active step.|
1189
+ | `circleSize` | `'extra-small' \| 'small' \| 'medium' \| 'large'\| 'extra-large'` `(optional)` | `'small'` | Determines the size of the circle of an individual step. |
1190
+ | `currentStep` | `number(optional)` | `N/A` | Determines which step is visually active in the step indicator. |
1191
+ | `variant` | `'default' \| 'compact' \| 'flush'` `(optional)` | `'default'` | Changes the visual styling of the component. compact only shows the title of the active step. flush does the same thing, but also removes the left and right margins. |
1192
+
1193
+ ##### Usage
1194
+
1195
+ ```javascript
1196
+ function Extension() {
1197
+ const [currentStep, setCurrentStep] = useState(0);
1198
+
1199
+ return (
1200
+ <Stack>
1201
+ <StepIndicator
1202
+ currentStep={currentStep}
1203
+ stepNames={['First', 'Second', 'Third']}
1204
+ />
1205
+ <Stack>
1206
+ <Button onClick={() => setCurrentStep(currentStep - 1)}>
1207
+ Previous
1208
+ </Button>
1209
+ <Button onClick={() => setCurrentStep(currentStep + 1)}>
1210
+ Next
1211
+ </Button>
1212
+ </Stack>
1213
+ </Stack>
1214
+ );
1215
+ }
1216
+ ```
1217
+
946
1218
 
947
1219
  ### Table
948
1220
 
949
1221
  ##### Import
1222
+
950
1223
  ```javascript
951
1224
  import { Table } from '@hubspot/ui-extensions';
952
1225
  ```
953
1226
 
954
1227
  ##### Props
1228
+
955
1229
  ```typescript
956
1230
  interface TableProps {
957
1231
  children: ReactNode;
@@ -967,26 +1241,27 @@ interface TableProps {
967
1241
  page?: number;
968
1242
  }
969
1243
  ```
1244
+
970
1245
  | Prop | Type | Default | Description |
971
- | - | - | - | - |
972
- | `children` | `ReactNode` | `N/A`| Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. These children should be [TableHead](#tablehead), [TableFooter](#tablefooter), or [TableBody](#tablebody) |
973
- | `flush` | `boolean(optional)` | `false`| If true the table will not have bottom margin. |
974
- | `bordered` | `boolean(optional)` | `true`| If false the table will not haver borders around its content. |
975
- | `paginated` | `boolean(optional)` | `false`| If true, the table will display the paginator component and consumer will have to provide extra pagination props. |
1246
+ | --- | --- | --- | --- |
1247
+ | `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. These children should be [TableHead](#tablehead), [TableFooter](#tablefooter), or [TableBody](#tablebody) |
1248
+ | `flush` | `boolean(optional)` | `false` | If true the table will not have bottom margin. |
1249
+ | `bordered` | `boolean(optional)` | `true` | If false the table will not haver borders around its content. |
1250
+ | `paginated` | `boolean(optional)` | `false` | If true, the table will display the paginator component and consumer will have to provide extra pagination props. |
976
1251
 
977
1252
  **Props for paginated=true**
978
1253
 
979
1254
  | Prop | Type | Default | Description |
980
- | - | - | - | - |
981
- | `pageCount` | `number` | `N/A`| The total number of pages available |
982
- | `onPageChange` | `onPageChange: (pageNumber: number) => void` |`N/A`| A function that will be invoked when the pagination button is clicked. It receives the new page number as argument. |
1255
+ | --- | --- | --- | --- |
1256
+ | `pageCount` | `number` | `N/A` | The total number of pages available |
1257
+ | `onPageChange` | `onPageChange: (pageNumber: number) => void` | `N/A` | A function that will be invoked when the pagination button is clicked. It receives the new page number as argument. |
983
1258
  | `showButtonLabels` | `boolean(optional)` | `true` | if `false`, it hides the text labels for the First/Prev/Next/Last buttons. The button labels will still be accessible for screen readers. |
984
1259
  | `showFirstLastButtons` | `boolean(optional)` | `false` | if `true`, it displays the First page and Last page buttons. |
985
1260
  | `maxVisiblePageButtons` | `number(optional)` | `5` | Changes how many page buttons are shown. |
986
1261
  | `page` | `number(optional)` | `N/A` | Denotes the current page. |
987
1262
 
988
-
989
1263
  ##### Usage
1264
+
990
1265
  ```javascript
991
1266
  const Extension = () => {
992
1267
  return (
@@ -1005,8 +1280,7 @@ const Extension = () => {
1005
1280
  </TableBody>
1006
1281
  </Table>
1007
1282
  );
1008
- }
1009
-
1283
+ };
1010
1284
 
1011
1285
  // Paginated example
1012
1286
 
@@ -1065,24 +1339,29 @@ function PaginatedTable() {
1065
1339
  );
1066
1340
  }
1067
1341
  ```
1342
+
1068
1343
  ### TableBody
1069
1344
 
1070
1345
  ##### Import
1346
+
1071
1347
  ```javascript
1072
1348
  import { TableBody } from '@hubspot/ui-extensions';
1073
1349
  ```
1074
1350
 
1075
1351
  ##### Props
1352
+
1076
1353
  ```typescript
1077
1354
  interface TableBodyProps {
1078
1355
  children: ReactNode;
1079
1356
  }
1080
1357
  ```
1358
+
1081
1359
  | Prop | Type | Default | Description |
1082
- | - | - | - | - |
1083
- | `children` | `ReactNode` | `N/A`| Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. These children should be [TableRow](#tablerow). |
1360
+ | --- | --- | --- | --- |
1361
+ | `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. These children should be [TableRow](#tablerow). |
1084
1362
 
1085
1363
  ##### Usage
1364
+
1086
1365
  ```javascript
1087
1366
  const Extension = () => {
1088
1367
  return (
@@ -1101,26 +1380,31 @@ const Extension = () => {
1101
1380
  </TableBody>
1102
1381
  </Table>
1103
1382
  );
1104
- }
1383
+ };
1105
1384
  ```
1385
+
1106
1386
  ### TableCell
1107
1387
 
1108
1388
  ##### Import
1389
+
1109
1390
  ```javascript
1110
1391
  import { TableCell } from '@hubspot/ui-extensions';
1111
1392
  ```
1112
1393
 
1113
1394
  ##### Props
1395
+
1114
1396
  ```typescript
1115
1397
  interface TableCellProps {
1116
1398
  children: ReactNode;
1117
1399
  }
1118
1400
  ```
1401
+
1119
1402
  | Prop | Type | Default | Description |
1120
- | - | - | - | - |
1121
- | `children` | `ReactNode` | `N/A`| Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components.|
1403
+ | --- | --- | --- | --- |
1404
+ | `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. |
1122
1405
 
1123
1406
  ##### Usage
1407
+
1124
1408
  ```javascript
1125
1409
  const Extension = () => {
1126
1410
  return (
@@ -1139,26 +1423,31 @@ const Extension = () => {
1139
1423
  </TableBody>
1140
1424
  </Table>
1141
1425
  );
1142
- }
1426
+ };
1143
1427
  ```
1428
+
1144
1429
  ### TableFooter
1145
1430
 
1146
1431
  ##### Import
1432
+
1147
1433
  ```javascript
1148
1434
  import { TableFooter } from '@hubspot/ui-extensions';
1149
1435
  ```
1150
1436
 
1151
1437
  ##### Props
1438
+
1152
1439
  ```typescript
1153
1440
  interface TableFooterProps {
1154
1441
  children: ReactNode;
1155
1442
  }
1156
1443
  ```
1444
+
1157
1445
  | Prop | Type | Default | Description |
1158
- | - | - | - | - |
1159
- | `children` | `ReactNode` | `N/A`| Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. These children should be [TableRow](#tablerow). |
1446
+ | --- | --- | --- | --- |
1447
+ | `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. These children should be [TableRow](#tablerow). |
1160
1448
 
1161
1449
  ##### Usage
1450
+
1162
1451
  ```javascript
1163
1452
  const Extension = () => {
1164
1453
  return (
@@ -1196,27 +1485,31 @@ const Extension = () => {
1196
1485
  </TableBody>
1197
1486
  </Table>
1198
1487
  );
1199
- }
1488
+ };
1200
1489
  ```
1201
1490
 
1202
1491
  ### TableHead
1203
1492
 
1204
1493
  ##### Import
1494
+
1205
1495
  ```javascript
1206
1496
  import { TableHead } from '@hubspot/ui-extensions';
1207
1497
  ```
1208
1498
 
1209
1499
  ##### Props
1500
+
1210
1501
  ```typescript
1211
1502
  interface TableHeadProps {
1212
1503
  children: ReactNode;
1213
1504
  }
1214
1505
  ```
1506
+
1215
1507
  | Prop | Type | Default | Description |
1216
- | - | - | - | - |
1217
- | `children` | `ReactNode` | `N/A`| Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. These children should be [TableHeader](#tableheader). |
1508
+ | --- | --- | --- | --- |
1509
+ | `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. These children should be [TableHeader](#tableheader). |
1218
1510
 
1219
1511
  ##### Usage
1512
+
1220
1513
  ```javascript
1221
1514
  const Extension = () => {
1222
1515
  return (
@@ -1235,26 +1528,31 @@ const Extension = () => {
1235
1528
  </TableBody>
1236
1529
  </Table>
1237
1530
  );
1238
- }
1531
+ };
1239
1532
  ```
1533
+
1240
1534
  ### TableHeader
1241
1535
 
1242
1536
  ##### Import
1537
+
1243
1538
  ```javascript
1244
1539
  import { TableHeader } from '@hubspot/ui-extensions';
1245
1540
  ```
1246
1541
 
1247
1542
  ##### Props
1543
+
1248
1544
  ```typescript
1249
1545
  interface TableHeaderProps {
1250
1546
  children: ReactNode;
1251
1547
  }
1252
1548
  ```
1549
+
1253
1550
  | Prop | Type | Default | Description |
1254
- | - | - | - | - |
1255
- | `children` | `ReactNode` | `N/A`| Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components.|
1551
+ | --- | --- | --- | --- |
1552
+ | `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. |
1256
1553
 
1257
1554
  ##### Usage
1555
+
1258
1556
  ```javascript
1259
1557
  const Extension = () => {
1260
1558
  return (
@@ -1273,26 +1571,31 @@ const Extension = () => {
1273
1571
  </TableBody>
1274
1572
  </Table>
1275
1573
  );
1276
- }
1574
+ };
1277
1575
  ```
1576
+
1278
1577
  ### TableRow
1279
1578
 
1280
1579
  ##### Import
1580
+
1281
1581
  ```javascript
1282
1582
  import { TableRow } from '@hubspot/ui-extensions';
1283
1583
  ```
1284
1584
 
1285
1585
  ##### Props
1586
+
1286
1587
  ```typescript
1287
1588
  interface TableRowProps {
1288
1589
  children: ReactNode;
1289
1590
  }
1290
1591
  ```
1592
+
1291
1593
  | Prop | Type | Default | Description |
1292
- | - | - | - | - |
1293
- | `children` | `ReactNode` | `N/A`| Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components.|
1594
+ | --- | --- | --- | --- |
1595
+ | `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. |
1294
1596
 
1295
1597
  ##### Usage
1598
+
1296
1599
  ```javascript
1297
1600
  const Extension = () => {
1298
1601
  return (
@@ -1311,100 +1614,128 @@ const Extension = () => {
1311
1614
  </TableBody>
1312
1615
  </Table>
1313
1616
  );
1314
- }
1617
+ };
1315
1618
  ```
1316
1619
 
1317
1620
  ### Tag
1318
1621
 
1319
1622
  ##### Import
1623
+
1320
1624
  ```javascript
1321
1625
  import { Tag } from '@hubspot/ui-extensions';
1322
1626
  ```
1323
1627
 
1324
1628
  ##### Props
1629
+
1325
1630
  ```typescript
1326
1631
  interface TagProps {
1327
- text: string;
1632
+ children: ReactNode;
1328
1633
  onClick?: () => void;
1329
1634
  variant?: 'default' | 'warning' | 'success' | 'error';
1330
1635
  }
1331
1636
  ```
1637
+
1332
1638
  | Prop | Type | Default | Description |
1333
- | - | - | - | - |
1334
- | `text` | `string` | `N/A`| Text to be displayed in the tag. |
1335
- | `onClick` | `() => void` `(optional)` | `N/A` | A function that will be invoked when the `Tag` is clicked. It receives no arguments and it's return value is ignored. |
1336
- | `variant` | `'default' \| 'warning' \| 'success' \| 'error'` `(optional)` | `'default'`| The color variation of the tag to display |
1639
+ | --- | --- | --- | --- |
1640
+ | `children` | `string` | `N/A` | Text to be displayed in the tag. |
1641
+ | `onClick` | `() => void` `(optional)` | `N/A` | A function that will be invoked when the `Tag` is clicked. It receives no arguments and it's return value is ignored. |
1642
+ | `variant` | `'default' \| 'warning' \| 'success' \| 'error'` `(optional)` | `'default'` | The color variation of the tag to display |
1337
1643
 
1338
1644
  ##### Usage
1645
+
1339
1646
  ```javascript
1340
1647
  const Extension = () => {
1341
1648
  return (
1342
1649
  <Tag
1343
- text="Success"
1344
- variant='success'
1650
+ variant="success"
1345
1651
  onClick={() => {
1346
1652
  console.log('Tag clicked!');
1347
1653
  }}
1348
- />
1654
+ >
1655
+ Success
1656
+ </Tag>
1349
1657
  );
1350
- }
1658
+ };
1351
1659
  ```
1352
1660
 
1353
1661
  ### Text
1354
1662
 
1355
1663
  ##### Import
1664
+
1356
1665
  ```javascript
1357
1666
  import { Text } from '@hubspot/ui-extensions';
1358
1667
  ```
1359
1668
 
1360
1669
  ##### Props
1670
+
1361
1671
  ```typescript
1362
- interface TextProps {
1363
- format?: 'plaintext' | 'markdown';
1364
- text: string;
1672
+ export interface TextFormatOptions {
1673
+ fontWeight?: 'regular' | 'bold' | 'demibold';
1674
+ italic?: boolean;
1675
+ lineDecoration?: 'none' | 'underline' | 'strikethrough';
1676
+ }
1677
+
1678
+ export type TextProps = {
1365
1679
  variant?: 'bodytext' | 'microcopy';
1680
+ inline?: boolean;
1366
1681
  children: ReactNode;
1367
- tagName?: 'p' | 'span' | 'small';
1368
- }
1682
+ format?: TextFormatOptions;
1683
+ };
1369
1684
  ```
1685
+
1370
1686
  | Prop | Type | Default | Description |
1371
- | - | - | - | - |
1372
- | `format` | `'plaintext' \| 'markdown'` `(optional)`| `'plaintext'`| Type of formatting for the display text. |
1373
- | `text` | `string` | `N/A`| Text to be displayed as body text iff format is `"markdown"`. Inline markdown elements (i.e. bold, italics, code, links) are supported |
1374
- | `children` | `string` | `N/A`| Text to be displayed as body text iff format is `"plaintext"`. |
1375
- | `variant` | `'bodytext' \| 'microcopy'` | `'bodytext`| Type of text to display |
1376
- | `tagName` | `'p' \| 'small' \| 'span'` | `'bodytext`| Type of text element(tag) to display. |
1687
+ | --- | --- | --- | --- |
1688
+ | `format` | `'TextFormatOptions'` `(optional)` | `N/A` | Type of formatting options for the text. |
1689
+ | `children` | `string` | `N/A` | Text to be displayed as body text. |
1690
+ | `variant` | `'bodytext' \| 'microcopy'` | `'bodytext'` | Type of text to display |
1691
+ | `inline` | `boolean(optional)` | `false` | If `false` the text component will not insert a line break. |
1692
+
1693
+ #### Format Options
1377
1694
 
1378
- #### Markdown
1379
- Markdown syntax supported in the component:
1695
+ - bold text: `{ fontWeight: 'bold' }`
1696
+ - semibold text: `{ fontWeight: 'demibold' }`
1697
+ - italicized text: `{ italic: true }`
1698
+ - strikethrough text: `{ lineDecoration: 'strikethrough' }`
1699
+ - underlined text: `{ lineDecoration: 'underline' }`
1700
+ - inline text: `<Text inline={true}/>`
1380
1701
 
1381
- - bold text: `**like this**` or `__like this__`
1382
- - italicized text: `*like this*` or `_like this_`
1383
- - inline code: `` `like this` ``
1384
- - links: `[visible anchor text](https://www.hubspot.com/)`
1385
1702
 
1386
1703
  ##### Usage
1704
+
1387
1705
  ```javascript
1388
1706
  const Extension = () => {
1389
1707
  return (
1390
1708
  <>
1391
- <Text text="**Bold**" format="markdown"/>
1392
- <Text text="*Italics*" format="markdown"/>
1393
- <Text text="**Not Bold because format isn't markdown**"/>
1394
- <Text text="This is going to be small" variant="microcopy"/>
1709
+ <Text>Plain text</Text>
1710
+ <Text format={{ fontWeight: 'bold' }}>Bold</Text>
1711
+ <Text format={{ italic: true }}>Italics</Text>
1712
+ <Text format={{ fontWeight: 'bold', italic: true }}>
1713
+ Bold and Italic text
1714
+ </Text>
1715
+ <Text format={{ lineDecoration: 'strikethrough' }}>
1716
+ Strikethrough Text
1717
+ </Text>
1718
+ <Text variant="microcopy">
1719
+ Microcopy text
1720
+ <Text inline={true} format={{ fontWeight: 'bold' }}>
1721
+ with inner bold
1722
+ </Text>
1723
+ </Text>
1395
1724
  </>
1396
1725
  );
1397
- }
1726
+ };
1398
1727
  ```
1399
1728
 
1400
1729
  ### Textarea
1401
1730
 
1402
1731
  ##### Import
1732
+
1403
1733
  ```javascript
1404
1734
  import { Textarea } from '@hubspot/ui-extensions';
1405
1735
  ```
1406
1736
 
1407
1737
  ##### Props
1738
+
1408
1739
  ```typescript
1409
1740
  interface TextareaProps {
1410
1741
  label: string;
@@ -1427,35 +1758,37 @@ interface TextareaProps {
1427
1758
  resize?: 'vertical' | 'horizontal' | 'both' | 'none';
1428
1759
  }
1429
1760
  ```
1761
+
1430
1762
  | Prop | Type | Default | Description |
1431
- | - | - | - | - |
1432
- | `label` | `string` | `N/A`| The label text to display for the textarea element |
1433
- | `name` | `string` | `N/A`| The unique identifier for the textarea element, this could be thought of as the HTML5 [Textarea element's name attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#name) |
1434
- | `value` | `string(optional)` | `''`| The value of the textarea |
1435
- | `required` | `boolean(optional)` | `false`| Determines if the required indicator should be displayed |
1436
- | `readOnly` | `boolean(optional)` | `false`| Determines if the field is editable or not. |
1437
- | `description` | `string(optional)` | `N/A`| Instructional message to display to the user to help understand the purpose of the textarea. |
1438
- | `tooltip` | `string(optional)` | `N/A`| Text that will appear in a tooltip next to the textarea label. |
1439
- | `placeholder` | `string(optional)` | `N/A`| Text that appears in the textarea when it has no value set. |
1440
- | `error` | `boolean(optional)` | `false`| If set to true, `validationMessage` is displayed as an error message, if it was provided. The textarea will also render it's error state to let the user know there is an error. If false, `validationMessage` is displayed as a success message. |
1441
- | `validationMessage` | `string(optional)` | `''`| The text to show if the textarea has an error. |
1442
- | `onChange` | `(value: string) => void(optional)` | `N/A` | A callback function that is invoked when the value is committed. Currently these times are `onBlur` of the textarea and when the user submits the form. |
1443
- | `onInput` | `(value: string) => void(optional)` | `N/A`| A function that is called and passed the value every time the field is edited by the user. It is recommended that you do not use this value to update state, that is what `onChange` should be used for. Instead this should be used for validation. |
1444
- | `onBlur` | `(value: string) => void(optional)` | `N/A`| A function that is called and passed the value every time the field loses focus. |
1445
- | `onFocus` | `(value: string) => void(optional)` | `N/A`| A function that is called and passed the value every time the field gets focused. |
1763
+ | --- | --- | --- | --- |
1764
+ | `label` | `string` | `N/A` | The label text to display for the textarea element |
1765
+ | `name` | `string` | `N/A` | The unique identifier for the textarea element, this could be thought of as the HTML5 [Textarea element's name attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/textarea#name) |
1766
+ | `value` | `string(optional)` | `''` | The value of the textarea |
1767
+ | `required` | `boolean(optional)` | `false` | Determines if the required indicator should be displayed |
1768
+ | `readOnly` | `boolean(optional)` | `false` | Determines if the field is editable or not. |
1769
+ | `description` | `string(optional)` | `N/A` | Instructional message to display to the user to help understand the purpose of the textarea. |
1770
+ | `tooltip` | `string(optional)` | `N/A` | Text that will appear in a tooltip next to the textarea label. |
1771
+ | `placeholder` | `string(optional)` | `N/A` | Text that appears in the textarea when it has no value set. |
1772
+ | `error` | `boolean(optional)` | `false` | If set to true, `validationMessage` is displayed as an error message, if it was provided. The textarea will also render it's error state to let the user know there is an error. If false, `validationMessage` is displayed as a success message. |
1773
+ | `validationMessage` | `string(optional)` | `''` | The text to show if the textarea has an error. |
1774
+ | `onChange` | `(value: string) => void(optional)` | `N/A` | A callback function that is invoked when the value is committed. Currently these times are `onBlur` of the textarea and when the user submits the form. |
1775
+ | `onInput` | `(value: string) => void(optional)` | `N/A` | A function that is called and passed the value every time the field is edited by the user. It is recommended that you do not use this value to update state, that is what `onChange` should be used for. Instead this should be used for validation. |
1776
+ | `onBlur` | `(value: string) => void(optional)` | `N/A` | A function that is called and passed the value every time the field loses focus. |
1777
+ | `onFocus` | `(value: string) => void(optional)` | `N/A` | A function that is called and passed the value every time the field gets focused. |
1446
1778
  | `cols` | `number(optional)` | `N/A` | The visible width of the text control, in average character widths. |
1447
1779
  | `rows` | `number(optional)` | `N/A` | The number of visible text lines for the control. |
1448
1780
  | `maxLength` | `number(optional)` | `N/A` | The maximum number of characters (UTF-16 code units) that the user can enter. If this value isn't specified, the user can enter an unlimited number of characters. |
1449
- | `resize` | `'vertical' \| 'horizontal' \| 'both' \| 'none'` `(optional)`| `'vertical'` | Sets whether an element is resizable, and if so, in which directions. |
1781
+ | `resize` | `'vertical' \| 'horizontal' \| 'both' \| 'none'` `(optional)` | `'vertical'` | Sets whether an element is resizable, and if so, in which directions. |
1450
1782
 
1451
1783
  ##### Usage
1784
+
1452
1785
  ```javascript
1453
1786
  import { useState } from 'react';
1454
1787
 
1455
1788
  const Extension = () => {
1456
- const [ desciptiption, setDescription ] = useState('');
1457
- const [ validationMessage, setValidationMessage ] = useState('');
1458
- const [ isValid, setIsValid ] = useState(true);
1789
+ const [desciptiption, setDescription] = useState('');
1790
+ const [validationMessage, setValidationMessage] = useState('');
1791
+ const [isValid, setIsValid] = useState(true);
1459
1792
 
1460
1793
  return (
1461
1794
  <Form>
@@ -1468,58 +1801,137 @@ const Extension = () => {
1468
1801
  required={true}
1469
1802
  error={!isValid}
1470
1803
  validationMessage={validationMessage}
1471
- onChange={(value) => {
1472
- setDescription(value)
1804
+ onChange={value => {
1805
+ setDescription(value);
1473
1806
  }}
1474
- onInput={(value) => {
1807
+ onInput={value => {
1475
1808
  if (!value.includes('http')) {
1476
1809
  setValidationMessage('A link must be included.');
1477
1810
  setIsValid(false);
1478
1811
  } else {
1479
- setValidationMessage('Valid description!')
1812
+ setValidationMessage('Valid description!');
1480
1813
  setIsValid(true);
1481
1814
  }
1482
1815
  }}
1483
1816
  />
1484
1817
  </Form>
1485
1818
  );
1486
- }
1819
+ };
1487
1820
  ```
1488
1821
 
1489
-
1490
1822
  ### Tile
1491
1823
 
1492
1824
  ##### Import
1825
+
1493
1826
  ```javascript
1494
1827
  import { Tile } from '@hubspot/ui-extensions';
1495
1828
  ```
1496
1829
 
1497
1830
  ##### Props
1831
+
1498
1832
  ```typescript
1499
1833
  interface TileProps {
1500
1834
  children: ReactNode;
1501
1835
  flush?: boolean;
1502
1836
  }
1503
1837
  ```
1838
+
1504
1839
  | Prop | Type | Default | Description |
1505
- | - | - | - | - |
1506
- | `children` | `ReactNode` | `N/A`| Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. |
1507
- | `flush` | `boolean(optional)` | `false`| If true the content of the Tile will have no left or right padding. |
1840
+ | --- | --- | --- | --- |
1841
+ | `children` | `ReactNode` | `N/A` | Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components. |
1842
+ | `flush` | `boolean(optional)` | `false` | If true the content of the Tile will have no left or right padding. |
1508
1843
 
1509
1844
  ##### Usage
1845
+
1510
1846
  ```javascript
1511
1847
  const Extension = () => {
1512
1848
  return (
1513
1849
  <>
1514
1850
  <Tile flush={true}>
1515
- <Text text="No left padding" />
1851
+ <Text>No left padding</Text>
1516
1852
  </Tile>
1517
1853
  <Tile>
1518
- <Text text="Small amount of left padding" />
1854
+ <Text>Small amount of left padding</Text>
1519
1855
  </Tile>
1520
1856
  </>
1521
1857
  );
1522
- }
1858
+ };
1859
+ ```
1860
+
1861
+ ### ToggleGroup
1862
+
1863
+ ##### Import
1523
1864
 
1865
+ ```javascript
1866
+ import { ToggleGroup } from '@hubspot/ui-extensions';
1867
+ ```
1868
+
1869
+ ##### Props
1524
1870
 
1871
+ ```typescript
1872
+ type ToggleGroupProps = {
1873
+ toggleType: 'checkboxList' | 'radioButtonList';
1874
+ name: string;
1875
+ label: string;
1876
+ value?: string | string[];
1877
+ onChange?: (value: string) => void | (value: string[]) => void;
1878
+ validationMessage?: string;
1879
+ required?: boolean;
1880
+ tooltip?: string;
1881
+ error?: boolean;
1882
+ options: {
1883
+ label: string;
1884
+ value: string;
1885
+ initialIsChecked?: boolean;
1886
+ readonly?: boolean;
1887
+ description?: string;
1888
+ }[];
1889
+ inline?: boolean;
1890
+ variant?: 'default' | 'small';
1891
+ };
1892
+
1893
+ ```
1894
+
1895
+ | Prop | Type | Default | Description |
1896
+ | --- | --- | --- | --- | --- |
1897
+ | `toggleType` | `'radioButtonList' \| 'checkboxList'` | `N/A` | The type of toggles that will be shown. `'checkboxList'` is a multi-select and `'radioButtonList'` is a single select | ; |
1898
+ | `name` | `string` | `N/A` | The unique identifier for the toggle group element. |
1899
+ | `label` | `string` | `N/A` | The label text to display for the toggle group element. |
1900
+ | `options` | `Array<{ label: string; value: string; initialIsChecked?: boolean; readonly?: boolean; description?: string }>` | `N/A` | |
1901
+ | `value` | `string \| string[]` `(optional)` | `N/A` | The value of the toggle group. If `toggleType` is `'radioButtonList'`, this should be a `string`. If `toggleType` is `'checkboxList'` this should be an array of `string`s. |
1902
+ | `onChange` | `(value: string) => void \| (value: string[]) => void` `(optional)` | `N/A` | A function that is called with the new value or values when it is updated. If `toggleType` is `'radioButtonList'`, the function will be called with the `value` that is a `string`. If `toggleType` is `'checkboxList'` the function will be called with the `value` that is an array of `string`s. |
1903
+ | `required` | `boolean(optional)` | `false` | Determines if the required indicator should be displayed |
1904
+ | `tooltip` | `string` | `N/A` | Text that will appear in a tooltip next to the toggle group label. |
1905
+ | `error` | `boolean(optional)` | `false` | If set to true, `validationMessage` is displayed as an error message, if it was provided. The input will also render it's error state to let the user know there is an error. If false, `validationMessage` is displayed as a success message. |
1906
+ | `validationMessage` | `string(optional)` | `''` | The text to show if the input has an error. |
1907
+ | `inline` | `boolean(optional)` | `false` | Determines of the options are stacked vertically or share a line horizontally. |
1908
+ | `variant` | `'default' \| 'small'` `(optional)` | `default` | The size variation of the individual options. |
1909
+
1910
+ ##### Usage
1911
+
1912
+ ```javascript
1913
+ const options = [1, 2, 3, 4].map(n => ({
1914
+ label: `Option ${n}`,
1915
+ value: `${n}`,
1916
+ initialIsChecked: n === 2,
1917
+ readonly: false,
1918
+ description: `This is option ${n}`,
1919
+ }));
1920
+
1921
+ const Extension = () => {
1922
+ return (
1923
+ <ToggleGroup
1924
+ name="toggle-checkboxes"
1925
+ label="Toggle these things"
1926
+ error={false}
1927
+ options={options}
1928
+ tooltip="Here's a secret tip."
1929
+ validationMessage="Make sure you do the thing correctly."
1930
+ required={false}
1931
+ inline={false}
1932
+ toggleType="checkboxList"
1933
+ variant="default"
1934
+ />
1935
+ );
1936
+ };
1525
1937
  ```