@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/dist/types.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { ReactNode, ComponentType } from 'react';
2
2
  export interface AlertProps {
3
3
  title: string;
4
- body?: string;
5
4
  children?: ReactNode;
6
5
  variant?: 'info' | 'warning' | 'success' | 'error' | 'danger';
7
6
  }
@@ -29,7 +28,7 @@ export interface DescriptionListProps {
29
28
  direction?: 'row' | 'column';
30
29
  }
31
30
  export interface DividerProps {
32
- distance?: 'flush' | 'extra-small' | 'small' | 'medium' | 'large' | 'extra-large';
31
+ distance?: AllDistances;
33
32
  }
34
33
  export interface EmptyStateProps {
35
34
  flush?: boolean;
@@ -51,8 +50,8 @@ export interface FormProps {
51
50
  preventDefault?: boolean;
52
51
  }
53
52
  export interface HeadingProps {
54
- text: string;
55
- format?: 'plaintext' | 'markdown';
53
+ children: ReactNode;
54
+ inline?: boolean;
56
55
  }
57
56
  export interface ImageProps {
58
57
  alt?: string;
@@ -60,22 +59,24 @@ export interface ImageProps {
60
59
  onClick?: () => void;
61
60
  src: string;
62
61
  width?: number;
62
+ height?: number;
63
63
  }
64
- export interface InputProps {
64
+ export interface InputProps<T = string> {
65
65
  label: string;
66
66
  name: string;
67
- value?: string;
67
+ value?: T;
68
68
  required?: boolean;
69
69
  readOnly?: boolean;
70
70
  description?: string;
71
71
  tooltip?: string;
72
72
  placeholder?: string;
73
73
  error?: boolean;
74
+ defaultValue?: T;
74
75
  validationMessage?: string;
75
- onChange?: (value: string) => void;
76
- onInput?: (value: string) => void;
77
- onBlur?: (value: string) => void;
78
- onFocus?: (value: string) => void;
76
+ onChange?: (value: T) => void;
77
+ onInput?: (value: T) => void;
78
+ onBlur?: (value: T) => void;
79
+ onFocus?: (value: T) => void;
79
80
  }
80
81
  export interface TextareaProps extends InputProps {
81
82
  cols?: number;
@@ -83,8 +84,15 @@ export interface TextareaProps extends InputProps {
83
84
  rows?: number;
84
85
  resize?: 'vertical' | 'horizontal' | 'both' | 'none';
85
86
  }
87
+ export interface NumberInputProps extends InputProps<number> {
88
+ min?: number;
89
+ max?: number;
90
+ precision?: number;
91
+ formatStyle?: 'decimal' | 'percentage';
92
+ }
86
93
  export interface ProgressBarProps {
87
94
  title?: string;
95
+ 'aria-label'?: string;
88
96
  showPercentage?: boolean;
89
97
  value?: number;
90
98
  valueMax?: number;
@@ -109,7 +117,7 @@ export interface SelectProps {
109
117
  }[];
110
118
  }
111
119
  export interface TagProps {
112
- text: string;
120
+ children: ReactNode;
113
121
  onClick?: () => void;
114
122
  variant?: 'default' | 'warning' | 'success' | 'error';
115
123
  }
@@ -133,6 +141,48 @@ interface Team {
133
141
  name: string;
134
142
  teammates: number[];
135
143
  }
144
+ export type ToggleGroupOption = {
145
+ label: string;
146
+ value: string;
147
+ initialIsChecked?: boolean;
148
+ readonly?: boolean;
149
+ description?: string;
150
+ };
151
+ interface ToggleGroupListBaseProps {
152
+ name: ToggleGroupProps['name'];
153
+ options: ToggleGroupProps['options'];
154
+ variant: ToggleGroupProps['variant'];
155
+ inline?: boolean;
156
+ }
157
+ export interface CheckboxListProps extends ToggleGroupListBaseProps {
158
+ value?: CheckboxGroupProps['value'];
159
+ onChange?: CheckboxGroupProps['onChange'];
160
+ }
161
+ export interface RadioButtonListProps extends ToggleGroupListBaseProps {
162
+ value?: RadioButtonGroupProps['value'];
163
+ onChange?: RadioButtonGroupProps['onChange'];
164
+ }
165
+ interface CheckboxGroupProps {
166
+ toggleType: 'checkboxList';
167
+ onChange?: (value: this['value']) => void;
168
+ value?: string[];
169
+ }
170
+ interface RadioButtonGroupProps {
171
+ toggleType: 'radioButtonList';
172
+ onChange?: (value: this['value']) => void;
173
+ value?: string;
174
+ }
175
+ export type ToggleGroupProps = {
176
+ name: string;
177
+ label: string;
178
+ validationMessage?: string;
179
+ required?: boolean;
180
+ tooltip?: string;
181
+ error?: boolean;
182
+ options: Array<ToggleGroupOption>;
183
+ inline?: boolean;
184
+ variant?: 'default' | 'small';
185
+ } & (CheckboxGroupProps | RadioButtonGroupProps);
136
186
  export interface UserContext {
137
187
  id: number;
138
188
  emails: string[];
@@ -152,9 +202,12 @@ export interface Context {
152
202
  portal: PortalContext;
153
203
  }
154
204
  export interface StackProps {
155
- distance?: 'flush' | 'small' | 'extra-small' | 'medium' | 'large';
205
+ distance?: AllDistances;
156
206
  children?: React.ReactNode;
157
207
  direction?: 'row' | 'column';
208
+ justify?: 'center' | 'end' | 'start';
209
+ align?: 'start' | 'center' | 'baseline' | 'end' | 'stretch';
210
+ width?: 'auto' | '100%';
158
211
  }
159
212
  export interface StatisticsTrendProps {
160
213
  value: string;
@@ -215,6 +268,8 @@ export interface ServerlessExecutionRequest {
215
268
  type: 'SERVERLESS_ACTION_HOOK';
216
269
  payload: JsonValue;
217
270
  };
271
+ objectId?: number;
272
+ objectTypeId?: string;
218
273
  }
219
274
  export interface ServerlessExecutionResponse {
220
275
  logId: string;
@@ -265,19 +320,40 @@ export interface CrmMiddleExtensionPoint extends ExtensionPointContract {
265
320
  customComponents: {
266
321
  CrmPropertyList: ComponentType<CrmPropertyListProps>;
267
322
  CrmAssociationTable: ComponentType<CrmAssociationTableProps>;
323
+ CrmDataHighlight: ComponentType<CrmDataHighlightProps>;
324
+ CrmReport: ComponentType<CrmReportProps>;
325
+ CrmAssociationPivot: ComponentType<CrmAssociationPivotProps>;
326
+ CrmObjectProperty?: ComponentType<CrmObjectPropertyProps>;
327
+ CrmAssociationPropertyList?: ComponentType<CrmAssociationPropertyListProps>;
268
328
  };
269
329
  }
330
+ export interface CrmDataHighlightProps {
331
+ properties: Array<string>;
332
+ objectTypeId?: string;
333
+ objectId?: number;
334
+ }
335
+ export interface CrmReportProps {
336
+ reportId: string;
337
+ }
270
338
  export interface CrmPropertyListProps {
271
- properties: string[];
339
+ properties: Array<string>;
272
340
  direction?: string;
341
+ objectTypeId?: string;
342
+ objectId?: number;
343
+ }
344
+ export interface CrmObjectPropertyProps {
345
+ properties: Array<string>;
346
+ objectTypeId?: string;
347
+ objectId?: number;
273
348
  }
274
349
  type CrmSortDescriptor = {
275
350
  columnName: string;
276
351
  direction: 1 | -1;
277
352
  };
278
353
  interface CrmSearchFilter {
279
- operator: 'EQ' | 'NEQ' | 'LT' | 'LTE' | 'GT' | 'GTE' | 'BETWEEN' | 'IN' | 'NOT_IN' | 'HAS_PROPERTY' | 'NOT_HAS_PROPERTY' | 'ROLLING_DATE_RANGE' | 'TIME_UNIT_TO_DATE';
354
+ operator: 'EQ' | 'NEQ' | 'LT' | 'LTE' | 'GT' | 'GTE' | 'BETWEEN' | 'IN' | 'NOT_IN' | 'HAS_PROPERTY' | 'NOT_HAS_PROPERTY';
280
355
  value?: string | number;
356
+ values?: string | number;
281
357
  highValue?: string | number;
282
358
  property: string;
283
359
  }
@@ -291,6 +367,20 @@ export interface CrmAssociationTableProps {
291
367
  preFilters?: Array<CrmSearchFilter>;
292
368
  sort?: Array<CrmSortDescriptor>;
293
369
  }
370
+ export interface CrmAssociationPivotProps {
371
+ objectTypeId: string;
372
+ associationLabels?: Array<string>;
373
+ maxAssociations?: number;
374
+ preFilters?: Array<CrmSearchFilter>;
375
+ sort?: Array<CrmSortDescriptor>;
376
+ }
377
+ export interface CrmAssociationPropertyListProps {
378
+ objectTypeId: string;
379
+ properties: Array<string>;
380
+ associationLabels?: Array<string>;
381
+ filters?: Array<CrmSearchFilter>;
382
+ sort?: Array<CrmSortDescriptor>;
383
+ }
294
384
  interface CrmSidebarExtensionPoint extends ExtensionPointContract {
295
385
  actions: {
296
386
  reloadPage: ReloadPageAction;
@@ -318,7 +408,6 @@ export interface ExtensionPointApi<ExtensionPointName extends keyof ExtensionPoi
318
408
  context: Context;
319
409
  runServerlessFunction: ServerlessFuncRunner;
320
410
  actions: ExtensionPoints[ExtensionPointName]['actions'];
321
- customComponents: string[];
322
411
  }
323
412
  interface OpenIframeActionPayload {
324
413
  uri: string;
@@ -329,9 +418,8 @@ interface OpenIframeActionPayload {
329
418
  export interface LoadingSpinnerProps {
330
419
  label: string;
331
420
  showLabel?: boolean;
332
- size?: 'xs' | 'sm' | 'md';
421
+ size?: TShirtSizes['xs'] | TShirtSizes['sm'] | TShirtSizes['md'];
333
422
  layout?: 'inline' | 'centered';
334
- grow?: boolean;
335
423
  }
336
424
  export interface TableElementProps {
337
425
  children: React.ReactNode;
@@ -365,8 +453,41 @@ export interface LinkProps {
365
453
  children: ReactNode;
366
454
  href: string;
367
455
  variant?: 'primary' | 'destructive' | 'light' | 'dark';
456
+ onClick?: () => void;
457
+ preventDefault?: boolean;
368
458
  }
369
459
  export type JsonValue = string | number | boolean | null | JsonValue[] | {
370
460
  [key: string]: JsonValue;
371
461
  };
462
+ export interface BoxProps {
463
+ children: ReactNode;
464
+ grow?: boolean;
465
+ alignSelf?: 'start' | 'center' | 'baseline' | 'end' | 'stretch' | 'auto';
466
+ }
467
+ interface TShirtSizes {
468
+ xs: 'extra-small' | 'xs';
469
+ sm: 'small' | 'sm';
470
+ md: 'medium' | 'md';
471
+ lg: 'large' | 'lg';
472
+ xl: 'extra-large' | 'xl';
473
+ }
474
+ export type AllSizes = TShirtSizes['xs'] | TShirtSizes['sm'] | TShirtSizes['md'] | TShirtSizes['lg'] | TShirtSizes['xl'];
475
+ export type AllDistances = 'flush' | AllSizes;
476
+ export interface StepIndicatorProps {
477
+ stepNames: string[];
478
+ direction?: 'horizontal' | 'vertical';
479
+ onClick?: (stepIndex: number) => void;
480
+ circleSize?: AllSizes;
481
+ currentStep?: number;
482
+ variant?: 'default' | 'compact' | 'flush';
483
+ }
484
+ export interface AccordionProps {
485
+ title: string;
486
+ children: ReactNode;
487
+ defaultOpen?: boolean;
488
+ disabled?: boolean;
489
+ open?: boolean;
490
+ size?: TShirtSizes['xs'] | TShirtSizes['sm'] | TShirtSizes['md'];
491
+ onClick?: () => void;
492
+ }
372
493
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/ui-extensions",
3
- "version": "0.0.1-prealpha.7",
3
+ "version": "0.2.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": "b5968f431fe29ee9977e6aacdd9b9ab3aa08af0c"
51
+ "gitHead": "ab7ad192e9d98163d2613d77f68677e3b48898aa"
52
52
  }