@hubspot/ui-extensions 0.9.5 → 0.9.7
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/__tests__/experimental/crm/fetchAssociations.spec.js +1 -23
- package/dist/__tests__/experimental/hooks/useAssociations.spec.js +2 -2
- package/dist/coreComponents.d.ts +24 -0
- package/dist/coreComponents.js +16 -0
- package/dist/experimental/crm/fetchAssociations.d.ts +0 -8
- package/dist/experimental/crm/fetchAssociations.js +0 -12
- package/dist/experimental/hooks/useAssociations.js +36 -6
- package/dist/experimental/index.d.ts +1 -13
- package/dist/experimental/index.js +1 -5
- package/dist/experimental/types.d.ts +0 -35
- package/dist/types.d.ts +77 -13
- package/package.json +2 -2
|
@@ -8,7 +8,7 @@ Object.defineProperty(global, 'self', {
|
|
|
8
8
|
value: mockSelf,
|
|
9
9
|
writable: true,
|
|
10
10
|
});
|
|
11
|
-
import { fetchAssociations,
|
|
11
|
+
import { fetchAssociations, calculatePaginationFlags, } from '../../../experimental/crm/fetchAssociations';
|
|
12
12
|
describe('fetchAssociations', () => {
|
|
13
13
|
// Helper functions
|
|
14
14
|
const createMockResponse = (data, overrides = {}) => ({
|
|
@@ -394,28 +394,6 @@ describe('fetchAssociations', () => {
|
|
|
394
394
|
});
|
|
395
395
|
});
|
|
396
396
|
describe('pagination utilities', () => {
|
|
397
|
-
describe('pageToOffset', () => {
|
|
398
|
-
it('should convert page numbers to offsets', () => {
|
|
399
|
-
expect(pageToOffset(1, 10)).toBe(0);
|
|
400
|
-
expect(pageToOffset(3, 10)).toBe(20);
|
|
401
|
-
expect(pageToOffset(2, 25)).toBe(25);
|
|
402
|
-
});
|
|
403
|
-
it('should always return 0 for page 1', () => {
|
|
404
|
-
expect(pageToOffset(1, 10)).toBe(0);
|
|
405
|
-
expect(pageToOffset(1, 50)).toBe(0);
|
|
406
|
-
});
|
|
407
|
-
});
|
|
408
|
-
describe('offsetToPage', () => {
|
|
409
|
-
it('should convert offsets to page numbers', () => {
|
|
410
|
-
expect(offsetToPage(0, 10)).toBe(1);
|
|
411
|
-
expect(offsetToPage(20, 10)).toBe(3);
|
|
412
|
-
expect(offsetToPage(15, 10)).toBe(2); // partial page
|
|
413
|
-
});
|
|
414
|
-
it('should always return 1 for offset 0', () => {
|
|
415
|
-
expect(offsetToPage(0, 10)).toBe(1);
|
|
416
|
-
expect(offsetToPage(0, 25)).toBe(1);
|
|
417
|
-
});
|
|
418
|
-
});
|
|
419
397
|
describe('calculatePaginationFlags', () => {
|
|
420
398
|
it('should calculate pagination flags correctly', () => {
|
|
421
399
|
// Page 1 scenarios
|
|
@@ -118,7 +118,7 @@ describe('useAssociations with Pagination', () => {
|
|
|
118
118
|
toObjectType: '0-1',
|
|
119
119
|
properties: ['firstname', 'lastname'],
|
|
120
120
|
pageLength: 10,
|
|
121
|
-
offset:
|
|
121
|
+
offset: undefined, // First page starts with undefined offset
|
|
122
122
|
}), expect.any(Object));
|
|
123
123
|
});
|
|
124
124
|
it('should handle empty results correctly', async () => {
|
|
@@ -182,7 +182,7 @@ describe('useAssociations with Pagination', () => {
|
|
|
182
182
|
});
|
|
183
183
|
// Verify API was called with correct offset for page 2
|
|
184
184
|
expect(mockFetchAssociations).toHaveBeenLastCalledWith(expect.objectContaining({
|
|
185
|
-
offset: 10, //
|
|
185
|
+
offset: 10, // Uses nextOffset (10) from first page response
|
|
186
186
|
}), expect.any(Object));
|
|
187
187
|
});
|
|
188
188
|
it('should navigate to previous page correctly', async () => {
|
package/dist/coreComponents.d.ts
CHANGED
|
@@ -806,3 +806,27 @@ export declare const TimeInput: "TimeInput" & {
|
|
|
806
806
|
readonly props?: types.TimeInputProps | undefined;
|
|
807
807
|
readonly children?: true | undefined;
|
|
808
808
|
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"TimeInput", types.TimeInputProps, true>>;
|
|
809
|
+
/**
|
|
810
|
+
* The `CurrencyInput` component renders a currency input field with proper formatting,
|
|
811
|
+
* currency symbols, and locale-specific display patterns. Commonly used within the `Form` component.
|
|
812
|
+
*
|
|
813
|
+
* **Links:**
|
|
814
|
+
*
|
|
815
|
+
* - {@link https://developers.hubspot.com/docs/reference/ui-components/standard-components/currency-input Docs}
|
|
816
|
+
*/
|
|
817
|
+
export declare const CurrencyInput: "CurrencyInput" & {
|
|
818
|
+
readonly type?: "CurrencyInput" | undefined;
|
|
819
|
+
readonly props?: types.CurrencyInputProps | undefined;
|
|
820
|
+
readonly children?: true | undefined;
|
|
821
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"CurrencyInput", types.CurrencyInputProps, true>>;
|
|
822
|
+
/**
|
|
823
|
+
* The `Inline` component spreads aligns its children horizontally (along the x-axis).
|
|
824
|
+
*
|
|
825
|
+
* **Links:**
|
|
826
|
+
*
|
|
827
|
+
* - {@link https://developers.hubspot.com/docs/reference/ui-components/standard-components/inline Docs}
|
|
828
|
+
*/ export declare const Inline: "Inline" & {
|
|
829
|
+
readonly type?: "Inline" | undefined;
|
|
830
|
+
readonly props?: types.InlineProps | undefined;
|
|
831
|
+
readonly children?: true | undefined;
|
|
832
|
+
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Inline", types.InlineProps, true>>;
|
package/dist/coreComponents.js
CHANGED
|
@@ -542,3 +542,19 @@ export const SearchInput = createRemoteReactComponent('SearchInput');
|
|
|
542
542
|
* - {@link https://developers.hubspot.com/docs/reference/ui-components/standard-components/time-input Docs}
|
|
543
543
|
*/
|
|
544
544
|
export const TimeInput = createRemoteReactComponent('TimeInput');
|
|
545
|
+
/**
|
|
546
|
+
* The `CurrencyInput` component renders a currency input field with proper formatting,
|
|
547
|
+
* currency symbols, and locale-specific display patterns. Commonly used within the `Form` component.
|
|
548
|
+
*
|
|
549
|
+
* **Links:**
|
|
550
|
+
*
|
|
551
|
+
* - {@link https://developers.hubspot.com/docs/reference/ui-components/standard-components/currency-input Docs}
|
|
552
|
+
*/
|
|
553
|
+
export const CurrencyInput = createRemoteReactComponent('CurrencyInput');
|
|
554
|
+
/**
|
|
555
|
+
* The `Inline` component spreads aligns its children horizontally (along the x-axis).
|
|
556
|
+
*
|
|
557
|
+
* **Links:**
|
|
558
|
+
*
|
|
559
|
+
* - {@link https://developers.hubspot.com/docs/reference/ui-components/standard-components/inline Docs}
|
|
560
|
+
*/ export const Inline = createRemoteReactComponent('Inline');
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import { FetchCrmPropertiesOptions } from './fetchCrmProperties';
|
|
2
2
|
export declare const DEFAULT_PAGE_SIZE = 10;
|
|
3
|
-
/**
|
|
4
|
-
* Convert page number and page size to offset for API calls
|
|
5
|
-
*/
|
|
6
|
-
export declare function pageToOffset(page: number, pageSize: number): number;
|
|
7
|
-
/**
|
|
8
|
-
* Convert offset and page size to page number
|
|
9
|
-
*/
|
|
10
|
-
export declare function offsetToPage(offset: number, pageSize: number): number;
|
|
11
3
|
/**
|
|
12
4
|
* Calculate pagination flags based on current page and API hasMore flag
|
|
13
5
|
*/
|
|
@@ -1,16 +1,4 @@
|
|
|
1
1
|
export const DEFAULT_PAGE_SIZE = 10;
|
|
2
|
-
/**
|
|
3
|
-
* Convert page number and page size to offset for API calls
|
|
4
|
-
*/
|
|
5
|
-
export function pageToOffset(page, pageSize) {
|
|
6
|
-
return (page - 1) * pageSize;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Convert offset and page size to page number
|
|
10
|
-
*/
|
|
11
|
-
export function offsetToPage(offset, pageSize) {
|
|
12
|
-
return Math.floor(offset / pageSize) + 1;
|
|
13
|
-
}
|
|
14
2
|
/**
|
|
15
3
|
* Calculate pagination flags based on current page and API hasMore flag
|
|
16
4
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useReducer, useMemo, useRef, useCallback } from 'react';
|
|
2
2
|
import { logger } from '../../logger';
|
|
3
|
-
import { fetchAssociations, DEFAULT_PAGE_SIZE,
|
|
3
|
+
import { fetchAssociations, DEFAULT_PAGE_SIZE, calculatePaginationFlags, } from '../crm/fetchAssociations';
|
|
4
4
|
function createInitialState(pageSize) {
|
|
5
5
|
return {
|
|
6
6
|
results: [],
|
|
@@ -9,6 +9,9 @@ function createInitialState(pageSize) {
|
|
|
9
9
|
currentPage: 1,
|
|
10
10
|
pageSize,
|
|
11
11
|
hasMore: false,
|
|
12
|
+
currentOffset: undefined,
|
|
13
|
+
nextOffset: undefined,
|
|
14
|
+
offsetHistory: [],
|
|
12
15
|
};
|
|
13
16
|
}
|
|
14
17
|
function associationsReducer(state, action) {
|
|
@@ -25,6 +28,8 @@ function associationsReducer(state, action) {
|
|
|
25
28
|
isLoading: false,
|
|
26
29
|
results: action.payload.results,
|
|
27
30
|
hasMore: action.payload.hasMore,
|
|
31
|
+
currentOffset: action.payload.currentOffset,
|
|
32
|
+
nextOffset: action.payload.nextOffset,
|
|
28
33
|
error: null,
|
|
29
34
|
};
|
|
30
35
|
case 'FETCH_ERROR':
|
|
@@ -34,17 +39,31 @@ function associationsReducer(state, action) {
|
|
|
34
39
|
error: action.payload,
|
|
35
40
|
results: [],
|
|
36
41
|
hasMore: false,
|
|
42
|
+
currentOffset: undefined,
|
|
43
|
+
nextOffset: undefined,
|
|
37
44
|
};
|
|
38
45
|
case 'NEXT_PAGE':
|
|
39
46
|
return {
|
|
40
47
|
...state,
|
|
41
48
|
currentPage: state.currentPage + 1,
|
|
49
|
+
offsetHistory: state.currentOffset !== undefined
|
|
50
|
+
? [...state.offsetHistory, state.currentOffset]
|
|
51
|
+
: state.offsetHistory,
|
|
52
|
+
currentOffset: state.nextOffset,
|
|
53
|
+
nextOffset: undefined,
|
|
42
54
|
};
|
|
43
|
-
case 'PREVIOUS_PAGE':
|
|
55
|
+
case 'PREVIOUS_PAGE': {
|
|
56
|
+
const newPage = Math.max(1, state.currentPage - 1);
|
|
57
|
+
const newHistory = [...state.offsetHistory];
|
|
58
|
+
const previousOffset = newHistory.pop();
|
|
44
59
|
return {
|
|
45
60
|
...state,
|
|
46
|
-
currentPage:
|
|
61
|
+
currentPage: newPage,
|
|
62
|
+
offsetHistory: newHistory,
|
|
63
|
+
currentOffset: previousOffset,
|
|
64
|
+
nextOffset: undefined,
|
|
47
65
|
};
|
|
66
|
+
}
|
|
48
67
|
case 'RESET':
|
|
49
68
|
return {
|
|
50
69
|
...state,
|
|
@@ -52,6 +71,9 @@ function associationsReducer(state, action) {
|
|
|
52
71
|
results: [],
|
|
53
72
|
hasMore: false,
|
|
54
73
|
error: null,
|
|
74
|
+
currentOffset: undefined,
|
|
75
|
+
nextOffset: undefined,
|
|
76
|
+
offsetHistory: [],
|
|
55
77
|
};
|
|
56
78
|
default:
|
|
57
79
|
return state;
|
|
@@ -117,12 +139,12 @@ export function useAssociations(config, options = DEFAULT_OPTIONS) {
|
|
|
117
139
|
const fetchData = async () => {
|
|
118
140
|
try {
|
|
119
141
|
dispatch({ type: 'FETCH_START' });
|
|
120
|
-
// Build request using current
|
|
142
|
+
// Build request using current offset token
|
|
121
143
|
const request = {
|
|
122
144
|
toObjectType: stableConfig.toObjectType,
|
|
123
145
|
properties: stableConfig.properties,
|
|
124
146
|
pageLength: pageSize,
|
|
125
|
-
offset:
|
|
147
|
+
offset: state.currentOffset,
|
|
126
148
|
};
|
|
127
149
|
const result = await fetchAssociations(request, {
|
|
128
150
|
propertiesToFormat: stableOptions.propertiesToFormat,
|
|
@@ -134,6 +156,8 @@ export function useAssociations(config, options = DEFAULT_OPTIONS) {
|
|
|
134
156
|
payload: {
|
|
135
157
|
results: result.data.results,
|
|
136
158
|
hasMore: result.data.hasMore,
|
|
159
|
+
nextOffset: result.data.nextOffset,
|
|
160
|
+
currentOffset: state.currentOffset,
|
|
137
161
|
},
|
|
138
162
|
});
|
|
139
163
|
cleanup = result.cleanup;
|
|
@@ -156,7 +180,13 @@ export function useAssociations(config, options = DEFAULT_OPTIONS) {
|
|
|
156
180
|
cleanup();
|
|
157
181
|
}
|
|
158
182
|
};
|
|
159
|
-
}, [
|
|
183
|
+
}, [
|
|
184
|
+
stableConfig,
|
|
185
|
+
stableOptions,
|
|
186
|
+
state.currentPage,
|
|
187
|
+
state.currentOffset,
|
|
188
|
+
pageSize,
|
|
189
|
+
]);
|
|
160
190
|
// Calculate pagination flags
|
|
161
191
|
const paginationFlags = calculatePaginationFlags(state.currentPage, state.hasMore);
|
|
162
192
|
return {
|
|
@@ -15,12 +15,6 @@ declare const MediaObject: "MediaObject" & {
|
|
|
15
15
|
readonly children?: true | undefined;
|
|
16
16
|
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"MediaObject", experimentalTypes.MediaObjectProps, true>>;
|
|
17
17
|
/** @experimental This component is experimental. Avoid using it in production due to potential breaking changes. Your feedback is valuable for improvements. Stay tuned for updates. */
|
|
18
|
-
declare const Inline: "Inline" & {
|
|
19
|
-
readonly type?: "Inline" | undefined;
|
|
20
|
-
readonly props?: experimentalTypes.InlineProps | undefined;
|
|
21
|
-
readonly children?: true | undefined;
|
|
22
|
-
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"Inline", experimentalTypes.InlineProps, true>>;
|
|
23
|
-
/** @experimental This component is experimental. Avoid using it in production due to potential breaking changes. Your feedback is valuable for improvements. Stay tuned for updates. */
|
|
24
18
|
declare const Stack2: "Stack2" & {
|
|
25
19
|
readonly type?: "Stack2" | undefined;
|
|
26
20
|
readonly props?: experimentalTypes.Stack2Props | undefined;
|
|
@@ -85,12 +79,6 @@ declare const FileInput: "FileInput" & {
|
|
|
85
79
|
readonly children?: true | undefined;
|
|
86
80
|
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"FileInput", experimentalTypes.FileInputProps, true>>;
|
|
87
81
|
/** @experimental This component is experimental. Avoid using it in production due to potential breaking changes. Your feedback is valuable for improvements. Stay tuned for updates. */
|
|
88
|
-
declare const CurrencyInput: "CurrencyInput" & {
|
|
89
|
-
readonly type?: "CurrencyInput" | undefined;
|
|
90
|
-
readonly props?: experimentalTypes.CurrencyInputProps | undefined;
|
|
91
|
-
readonly children?: true | undefined;
|
|
92
|
-
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"CurrencyInput", experimentalTypes.CurrencyInputProps, true>>;
|
|
93
|
-
/** @experimental This component is experimental. Avoid using it in production due to potential breaking changes. Your feedback is valuable for improvements. Stay tuned for updates. */
|
|
94
82
|
declare const HeaderActions: "HeaderActions" & {
|
|
95
83
|
readonly type?: "HeaderActions" | undefined;
|
|
96
84
|
readonly props?: experimentalTypes.HeaderActionsProps | undefined;
|
|
@@ -108,4 +96,4 @@ declare const SecondaryHeaderActionButton: "SecondaryHeaderActionButton" & {
|
|
|
108
96
|
readonly props?: experimentalTypes.HeaderActionButtonProps | undefined;
|
|
109
97
|
readonly children?: true | undefined;
|
|
110
98
|
} & import("@remote-ui/react").ReactComponentTypeFromRemoteComponentType<import("@remote-ui/types").RemoteComponentType<"SecondaryHeaderActionButton", experimentalTypes.HeaderActionButtonProps, true>>;
|
|
111
|
-
export { Iframe, MediaObject,
|
|
99
|
+
export { Iframe, MediaObject, Stack2, Center, SimpleGrid, GridItem, Grid, SettingsView, ExpandableText, Popover, FileInput, HeaderActions, PrimaryHeaderActionButton, SecondaryHeaderActionButton, };
|
|
@@ -8,8 +8,6 @@ const MediaObject = createRemoteReactComponent('MediaObject', {
|
|
|
8
8
|
fragmentProps: ['itemRight', 'itemLeft'],
|
|
9
9
|
});
|
|
10
10
|
/** @experimental This component is experimental. Avoid using it in production due to potential breaking changes. Your feedback is valuable for improvements. Stay tuned for updates. */
|
|
11
|
-
const Inline = createRemoteReactComponent('Inline');
|
|
12
|
-
/** @experimental This component is experimental. Avoid using it in production due to potential breaking changes. Your feedback is valuable for improvements. Stay tuned for updates. */
|
|
13
11
|
const Stack2 = createRemoteReactComponent('Stack2');
|
|
14
12
|
/** @experimental This component is experimental. Avoid using it in production due to potential breaking changes. Your feedback is valuable for improvements. Stay tuned for updates. */
|
|
15
13
|
const Center = createRemoteReactComponent('Center');
|
|
@@ -38,8 +36,6 @@ const ExpandableText = createRemoteReactComponent('ExpandableText');
|
|
|
38
36
|
const Popover = createRemoteReactComponent('Popover');
|
|
39
37
|
const FileInput = createRemoteReactComponent('FileInput');
|
|
40
38
|
/** @experimental This component is experimental. Avoid using it in production due to potential breaking changes. Your feedback is valuable for improvements. Stay tuned for updates. */
|
|
41
|
-
const CurrencyInput = createRemoteReactComponent('CurrencyInput');
|
|
42
|
-
/** @experimental This component is experimental. Avoid using it in production due to potential breaking changes. Your feedback is valuable for improvements. Stay tuned for updates. */
|
|
43
39
|
const HeaderActions = createRemoteReactComponent('HeaderActions');
|
|
44
40
|
/** @experimental This component is experimental. Avoid using it in production due to potential breaking changes. Your feedback is valuable for improvements. Stay tuned for updates. */
|
|
45
41
|
const PrimaryHeaderActionButton = createRemoteReactComponent('PrimaryHeaderActionButton', {
|
|
@@ -49,4 +45,4 @@ const PrimaryHeaderActionButton = createRemoteReactComponent('PrimaryHeaderActio
|
|
|
49
45
|
const SecondaryHeaderActionButton = createRemoteReactComponent('SecondaryHeaderActionButton', {
|
|
50
46
|
fragmentProps: ['overlay'],
|
|
51
47
|
});
|
|
52
|
-
export { Iframe, MediaObject,
|
|
48
|
+
export { Iframe, MediaObject, Stack2, Center, SimpleGrid, GridItem, Grid, SettingsView, ExpandableText, Popover, FileInput, HeaderActions, PrimaryHeaderActionButton, SecondaryHeaderActionButton, };
|
|
@@ -19,16 +19,6 @@ export type FlexJustify = 'center' | 'end' | 'start' | 'around' | 'between';
|
|
|
19
19
|
* @experimental do not use in production
|
|
20
20
|
*/
|
|
21
21
|
export type FlexAlign = 'start' | 'center' | 'baseline' | 'end' | 'stretch';
|
|
22
|
-
/**
|
|
23
|
-
* @ignore
|
|
24
|
-
* @experimental do not use in production
|
|
25
|
-
*/
|
|
26
|
-
export interface InlineProps extends BaseLayout {
|
|
27
|
-
justify?: FlexJustify;
|
|
28
|
-
align?: FlexAlign;
|
|
29
|
-
gap?: AllDistances;
|
|
30
|
-
children?: ReactNode;
|
|
31
|
-
}
|
|
32
22
|
/**
|
|
33
23
|
* @ignore
|
|
34
24
|
* @experimental do not use in production
|
|
@@ -252,31 +242,6 @@ export interface BaseInputProps<T = string, V = string> {
|
|
|
252
242
|
* @ignore
|
|
253
243
|
* @experimental do not use in production
|
|
254
244
|
*/
|
|
255
|
-
type BaseInputForNumber = Omit<BaseInputProps<number, number>, 'onInput'>;
|
|
256
|
-
/**
|
|
257
|
-
* @ignore
|
|
258
|
-
* @experimental do not use in production
|
|
259
|
-
*/
|
|
260
|
-
export interface CurrencyInputProps extends BaseInputForNumber {
|
|
261
|
-
/**
|
|
262
|
-
* ISO 4217 currency code (e.g., "USD", "EUR", "JPY")
|
|
263
|
-
* @defaultValue "USD"
|
|
264
|
-
*/
|
|
265
|
-
currency?: string;
|
|
266
|
-
/**
|
|
267
|
-
* Sets the number of decimal places for the currency
|
|
268
|
-
* If not provided, defaults to currency-specific precision
|
|
269
|
-
*/
|
|
270
|
-
precision?: number;
|
|
271
|
-
/**
|
|
272
|
-
* Sets the lower bound of the input
|
|
273
|
-
*/
|
|
274
|
-
min?: number;
|
|
275
|
-
/**
|
|
276
|
-
* Sets the upper bound of the input
|
|
277
|
-
*/
|
|
278
|
-
max?: number;
|
|
279
|
-
}
|
|
280
245
|
/**
|
|
281
246
|
* @ignore
|
|
282
247
|
* @experimental do not use in production
|
package/dist/types.d.ts
CHANGED
|
@@ -1084,6 +1084,31 @@ export interface NumberInputProps extends BaseInputForNumber {
|
|
|
1084
1084
|
/** @deprecated use onChange instead. It doesn't guarantee valid format */
|
|
1085
1085
|
onInput?: (value: number) => void;
|
|
1086
1086
|
}
|
|
1087
|
+
/**
|
|
1088
|
+
* The props type for {@link !components.CurrencyInput}.
|
|
1089
|
+
*
|
|
1090
|
+
* @category Component Props
|
|
1091
|
+
*/
|
|
1092
|
+
export interface CurrencyInputProps extends BaseInputForNumber {
|
|
1093
|
+
/**
|
|
1094
|
+
* ISO 4217 currency code (e.g., "USD", "EUR", "JPY")
|
|
1095
|
+
* @defaultValue "USD"
|
|
1096
|
+
*/
|
|
1097
|
+
currency?: string;
|
|
1098
|
+
/**
|
|
1099
|
+
* Sets the number of decimal places for the currency
|
|
1100
|
+
* If not provided, defaults to currency-specific precision
|
|
1101
|
+
*/
|
|
1102
|
+
precision?: number;
|
|
1103
|
+
/**
|
|
1104
|
+
* Sets the lower bound of the input
|
|
1105
|
+
*/
|
|
1106
|
+
min?: number;
|
|
1107
|
+
/**
|
|
1108
|
+
* Sets the upper bound of the input
|
|
1109
|
+
*/
|
|
1110
|
+
max?: number;
|
|
1111
|
+
}
|
|
1087
1112
|
/**
|
|
1088
1113
|
* The props type for {@link !components.StepperInput}.
|
|
1089
1114
|
*
|
|
@@ -1279,6 +1304,8 @@ export interface StackProps {
|
|
|
1279
1304
|
*/
|
|
1280
1305
|
width?: 'auto' | '100%';
|
|
1281
1306
|
}
|
|
1307
|
+
export type FlexJustify = 'center' | 'end' | 'start' | 'around' | 'between';
|
|
1308
|
+
export type FlexAlign = 'start' | 'center' | 'baseline' | 'end' | 'stretch';
|
|
1282
1309
|
/**
|
|
1283
1310
|
* The props type for {@link !components.Flex}.
|
|
1284
1311
|
*
|
|
@@ -1307,18 +1334,18 @@ export interface FlexProps {
|
|
|
1307
1334
|
*
|
|
1308
1335
|
* @defaultValue `"start"`
|
|
1309
1336
|
*/
|
|
1310
|
-
justify?:
|
|
1337
|
+
justify?: FlexJustify;
|
|
1311
1338
|
/**
|
|
1312
1339
|
* Distributes components along the cross-axis using the available free space.
|
|
1313
1340
|
*
|
|
1314
1341
|
* @defaultValue `"stretch"`
|
|
1315
1342
|
*/
|
|
1316
|
-
align?:
|
|
1343
|
+
align?: FlexAlign;
|
|
1317
1344
|
/**
|
|
1318
1345
|
* Overrides Flex's `alignItem` value for this element.
|
|
1319
1346
|
*
|
|
1320
1347
|
*/
|
|
1321
|
-
alignSelf?:
|
|
1348
|
+
alignSelf?: FlexAlign;
|
|
1322
1349
|
/**
|
|
1323
1350
|
* Whether components will wrap instead of trying to fit on one line.
|
|
1324
1351
|
*
|
|
@@ -1356,6 +1383,34 @@ export interface BoxProps {
|
|
|
1356
1383
|
*/
|
|
1357
1384
|
flex?: 'initial' | 'auto' | 'none' | number;
|
|
1358
1385
|
}
|
|
1386
|
+
/**
|
|
1387
|
+
* The props type for {@link !components.Inline}.
|
|
1388
|
+
*
|
|
1389
|
+
* @category Component Props
|
|
1390
|
+
*/
|
|
1391
|
+
export interface InlineProps {
|
|
1392
|
+
/**
|
|
1393
|
+
* Sets the content that will render inside the component. This prop is passed implicitly by providing sub-components.
|
|
1394
|
+
*
|
|
1395
|
+
*/
|
|
1396
|
+
children?: ReactNode;
|
|
1397
|
+
/**
|
|
1398
|
+
* Distributes components along the main axis using the available free space.
|
|
1399
|
+
* @defaultValue `"start"`
|
|
1400
|
+
*/
|
|
1401
|
+
justify?: FlexJustify;
|
|
1402
|
+
/**
|
|
1403
|
+
* Distributes components along the cross-axis using the available free space.
|
|
1404
|
+
* @defaultValue `"center"`
|
|
1405
|
+
*/
|
|
1406
|
+
align?: FlexAlign;
|
|
1407
|
+
/**
|
|
1408
|
+
* Sets the spacing between components.
|
|
1409
|
+
*
|
|
1410
|
+
* @defaultValue `"flush"`
|
|
1411
|
+
*/
|
|
1412
|
+
gap?: AllDistances;
|
|
1413
|
+
}
|
|
1359
1414
|
/**
|
|
1360
1415
|
* The props type for {@link !components.Link}.
|
|
1361
1416
|
*
|
|
@@ -1670,15 +1725,6 @@ export interface BaseSelectProps {
|
|
|
1670
1725
|
*
|
|
1671
1726
|
*/
|
|
1672
1727
|
validationMessage?: string;
|
|
1673
|
-
/**
|
|
1674
|
-
* The options to display in the dropdown menu.
|
|
1675
|
-
*/
|
|
1676
|
-
options: {
|
|
1677
|
-
/** Will be used as the display text. **/
|
|
1678
|
-
label: string;
|
|
1679
|
-
/** Should be the option's unique identifier, which is submitted with the form. **/
|
|
1680
|
-
value: string | number;
|
|
1681
|
-
}[];
|
|
1682
1728
|
/**
|
|
1683
1729
|
* The variant type for the select.
|
|
1684
1730
|
*
|
|
@@ -1696,7 +1742,7 @@ export interface SelectProps extends BaseSelectProps {
|
|
|
1696
1742
|
* The value of the select input.
|
|
1697
1743
|
*
|
|
1698
1744
|
*/
|
|
1699
|
-
value?: string | number;
|
|
1745
|
+
value?: string | number | boolean;
|
|
1700
1746
|
/**
|
|
1701
1747
|
* A callback function that is invoked when the value is committed.
|
|
1702
1748
|
*
|
|
@@ -1717,6 +1763,15 @@ export interface SelectProps extends BaseSelectProps {
|
|
|
1717
1763
|
* @event
|
|
1718
1764
|
*/
|
|
1719
1765
|
onInput?: (value: string) => void;
|
|
1766
|
+
/**
|
|
1767
|
+
* The options to display in the dropdown menu.
|
|
1768
|
+
*/
|
|
1769
|
+
options: {
|
|
1770
|
+
/** Will be used as the display text. **/
|
|
1771
|
+
label: string;
|
|
1772
|
+
/** Should be the option's unique identifier, which is submitted with the form. **/
|
|
1773
|
+
value: string | number | boolean;
|
|
1774
|
+
}[];
|
|
1720
1775
|
}
|
|
1721
1776
|
/**
|
|
1722
1777
|
* The props type for {@link !components.MultiSelect}.
|
|
@@ -1735,6 +1790,15 @@ export interface MultiSelectProps extends BaseSelectProps {
|
|
|
1735
1790
|
* @event
|
|
1736
1791
|
*/
|
|
1737
1792
|
onChange?: (value: NonNullable<MultiSelectProps['value']>) => void;
|
|
1793
|
+
/**
|
|
1794
|
+
* The options to display in the dropdown menu.
|
|
1795
|
+
*/
|
|
1796
|
+
options: {
|
|
1797
|
+
/** Will be used as the display text. **/
|
|
1798
|
+
label: string;
|
|
1799
|
+
/** Should be the option's unique identifier, which is submitted with the form. **/
|
|
1800
|
+
value: string | number;
|
|
1801
|
+
}[];
|
|
1738
1802
|
}
|
|
1739
1803
|
/**
|
|
1740
1804
|
* The props type for {@link !components.StatisticsTrend}.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hubspot/ui-extensions",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -66,5 +66,5 @@
|
|
|
66
66
|
"ts-jest": "^29.1.1",
|
|
67
67
|
"typescript": "5.0.4"
|
|
68
68
|
},
|
|
69
|
-
"gitHead": "
|
|
69
|
+
"gitHead": "b9a6650baca7fd7326e7de6ffeacc8d5c097e126"
|
|
70
70
|
}
|