hs-uix 1.5.0 → 1.6.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 +221 -0
- package/common-components.d.ts +127 -0
- package/dist/common-components.js +491 -16
- package/dist/common-components.mjs +465 -10
- package/dist/datatable.js +3 -3
- package/dist/datatable.mjs +5 -4
- package/dist/form.js +18 -1
- package/dist/form.mjs +18 -1
- package/dist/index.js +1745 -17
- package/dist/index.mjs +1760 -20
- package/dist/kanban.js +1410 -0
- package/dist/kanban.mjs +1408 -0
- package/dist/utils.js +60 -0
- package/dist/utils.mjs +58 -0
- package/form.d.ts +1 -0
- package/index.d.ts +65 -0
- package/kanban.d.ts +1 -0
- package/package.json +9 -1
package/dist/utils.js
CHANGED
|
@@ -21,8 +21,10 @@ var utils_exports = {};
|
|
|
21
21
|
__export(utils_exports, {
|
|
22
22
|
buildOptions: () => buildOptions,
|
|
23
23
|
createStatusTagSortComparator: () => createStatusTagSortComparator,
|
|
24
|
+
deriveCardFieldsFromColumns: () => deriveCardFieldsFromColumns,
|
|
24
25
|
findOptionLabel: () => findOptionLabel,
|
|
25
26
|
formatCurrency: () => formatCurrency,
|
|
27
|
+
formatCurrencyCompact: () => formatCurrencyCompact,
|
|
26
28
|
formatDate: () => formatDate,
|
|
27
29
|
formatDateTime: () => formatDateTime,
|
|
28
30
|
formatPercentage: () => formatPercentage,
|
|
@@ -88,6 +90,20 @@ var formatPercentage = (value, { locale = DEFAULT_LOCALE, minimumFractionDigits
|
|
|
88
90
|
maximumFractionDigits,
|
|
89
91
|
...options
|
|
90
92
|
}).format(Number(value || 0));
|
|
93
|
+
var formatCurrencyCompact = (value, {
|
|
94
|
+
locale = DEFAULT_LOCALE,
|
|
95
|
+
currency = "USD",
|
|
96
|
+
maximumFractionDigits = 1,
|
|
97
|
+
compactDisplay = "short",
|
|
98
|
+
...options
|
|
99
|
+
} = {}) => new Intl.NumberFormat(locale, {
|
|
100
|
+
style: "currency",
|
|
101
|
+
currency,
|
|
102
|
+
notation: "compact",
|
|
103
|
+
compactDisplay,
|
|
104
|
+
maximumFractionDigits,
|
|
105
|
+
...options
|
|
106
|
+
}).format(Number(value || 0));
|
|
91
107
|
|
|
92
108
|
// src/utils/hubspotValues.js
|
|
93
109
|
var isDateValueObject = (value) => Boolean(
|
|
@@ -250,12 +266,56 @@ var createStatusTagSortComparator = (options = {}) => {
|
|
|
250
266
|
return labelOf(aVal).localeCompare(labelOf(bVal));
|
|
251
267
|
};
|
|
252
268
|
};
|
|
269
|
+
|
|
270
|
+
// src/utils/viewAdapters.js
|
|
271
|
+
var deriveCardFieldsFromColumns = (columns, opts = {}) => {
|
|
272
|
+
var _a;
|
|
273
|
+
const {
|
|
274
|
+
titleField,
|
|
275
|
+
titleHref,
|
|
276
|
+
placements = {},
|
|
277
|
+
exclude,
|
|
278
|
+
include,
|
|
279
|
+
maxBodyFields
|
|
280
|
+
} = opts;
|
|
281
|
+
const excludeSet = new Set(exclude || []);
|
|
282
|
+
const includeSet = include ? new Set(include) : null;
|
|
283
|
+
const filtered = (columns || []).filter((col) => {
|
|
284
|
+
if (!col || !col.field) return false;
|
|
285
|
+
if (excludeSet.has(col.field)) return false;
|
|
286
|
+
if (includeSet && !includeSet.has(col.field)) return false;
|
|
287
|
+
return true;
|
|
288
|
+
});
|
|
289
|
+
const resolvedTitleField = titleField || Object.keys(placements).find((k) => placements[k] === "title") || ((_a = filtered[0]) == null ? void 0 : _a.field);
|
|
290
|
+
const out = [];
|
|
291
|
+
let bodyCount = 0;
|
|
292
|
+
for (const col of filtered) {
|
|
293
|
+
const placement = placements[col.field] || (col.field === resolvedTitleField ? "title" : "body");
|
|
294
|
+
if (placement === "body" && maxBodyFields != null && bodyCount >= maxBodyFields) {
|
|
295
|
+
continue;
|
|
296
|
+
}
|
|
297
|
+
if (placement === "body") bodyCount += 1;
|
|
298
|
+
const cardField = {
|
|
299
|
+
key: col.field,
|
|
300
|
+
field: col.field,
|
|
301
|
+
placement
|
|
302
|
+
};
|
|
303
|
+
if (col.label != null) cardField.label = col.label;
|
|
304
|
+
if (col.renderCell) cardField.render = col.renderCell;
|
|
305
|
+
if (col.truncate != null) cardField.truncate = col.truncate;
|
|
306
|
+
if (placement === "title" && titleHref) cardField.href = titleHref;
|
|
307
|
+
out.push(cardField);
|
|
308
|
+
}
|
|
309
|
+
return out;
|
|
310
|
+
};
|
|
253
311
|
// Annotate the CommonJS export names for ESM import in node:
|
|
254
312
|
0 && (module.exports = {
|
|
255
313
|
buildOptions,
|
|
256
314
|
createStatusTagSortComparator,
|
|
315
|
+
deriveCardFieldsFromColumns,
|
|
257
316
|
findOptionLabel,
|
|
258
317
|
formatCurrency,
|
|
318
|
+
formatCurrencyCompact,
|
|
259
319
|
formatDate,
|
|
260
320
|
formatDateTime,
|
|
261
321
|
formatPercentage,
|
package/dist/utils.mjs
CHANGED
|
@@ -50,6 +50,20 @@ var formatPercentage = (value, { locale = DEFAULT_LOCALE, minimumFractionDigits
|
|
|
50
50
|
maximumFractionDigits,
|
|
51
51
|
...options
|
|
52
52
|
}).format(Number(value || 0));
|
|
53
|
+
var formatCurrencyCompact = (value, {
|
|
54
|
+
locale = DEFAULT_LOCALE,
|
|
55
|
+
currency = "USD",
|
|
56
|
+
maximumFractionDigits = 1,
|
|
57
|
+
compactDisplay = "short",
|
|
58
|
+
...options
|
|
59
|
+
} = {}) => new Intl.NumberFormat(locale, {
|
|
60
|
+
style: "currency",
|
|
61
|
+
currency,
|
|
62
|
+
notation: "compact",
|
|
63
|
+
compactDisplay,
|
|
64
|
+
maximumFractionDigits,
|
|
65
|
+
...options
|
|
66
|
+
}).format(Number(value || 0));
|
|
53
67
|
|
|
54
68
|
// src/utils/hubspotValues.js
|
|
55
69
|
var isDateValueObject = (value) => Boolean(
|
|
@@ -212,11 +226,55 @@ var createStatusTagSortComparator = (options = {}) => {
|
|
|
212
226
|
return labelOf(aVal).localeCompare(labelOf(bVal));
|
|
213
227
|
};
|
|
214
228
|
};
|
|
229
|
+
|
|
230
|
+
// src/utils/viewAdapters.js
|
|
231
|
+
var deriveCardFieldsFromColumns = (columns, opts = {}) => {
|
|
232
|
+
var _a;
|
|
233
|
+
const {
|
|
234
|
+
titleField,
|
|
235
|
+
titleHref,
|
|
236
|
+
placements = {},
|
|
237
|
+
exclude,
|
|
238
|
+
include,
|
|
239
|
+
maxBodyFields
|
|
240
|
+
} = opts;
|
|
241
|
+
const excludeSet = new Set(exclude || []);
|
|
242
|
+
const includeSet = include ? new Set(include) : null;
|
|
243
|
+
const filtered = (columns || []).filter((col) => {
|
|
244
|
+
if (!col || !col.field) return false;
|
|
245
|
+
if (excludeSet.has(col.field)) return false;
|
|
246
|
+
if (includeSet && !includeSet.has(col.field)) return false;
|
|
247
|
+
return true;
|
|
248
|
+
});
|
|
249
|
+
const resolvedTitleField = titleField || Object.keys(placements).find((k) => placements[k] === "title") || ((_a = filtered[0]) == null ? void 0 : _a.field);
|
|
250
|
+
const out = [];
|
|
251
|
+
let bodyCount = 0;
|
|
252
|
+
for (const col of filtered) {
|
|
253
|
+
const placement = placements[col.field] || (col.field === resolvedTitleField ? "title" : "body");
|
|
254
|
+
if (placement === "body" && maxBodyFields != null && bodyCount >= maxBodyFields) {
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
if (placement === "body") bodyCount += 1;
|
|
258
|
+
const cardField = {
|
|
259
|
+
key: col.field,
|
|
260
|
+
field: col.field,
|
|
261
|
+
placement
|
|
262
|
+
};
|
|
263
|
+
if (col.label != null) cardField.label = col.label;
|
|
264
|
+
if (col.renderCell) cardField.render = col.renderCell;
|
|
265
|
+
if (col.truncate != null) cardField.truncate = col.truncate;
|
|
266
|
+
if (placement === "title" && titleHref) cardField.href = titleHref;
|
|
267
|
+
out.push(cardField);
|
|
268
|
+
}
|
|
269
|
+
return out;
|
|
270
|
+
};
|
|
215
271
|
export {
|
|
216
272
|
buildOptions,
|
|
217
273
|
createStatusTagSortComparator,
|
|
274
|
+
deriveCardFieldsFromColumns,
|
|
218
275
|
findOptionLabel,
|
|
219
276
|
formatCurrency,
|
|
277
|
+
formatCurrencyCompact,
|
|
220
278
|
formatDate,
|
|
221
279
|
formatDateTime,
|
|
222
280
|
formatPercentage,
|
package/form.d.ts
CHANGED
package/index.d.ts
CHANGED
|
@@ -26,6 +26,37 @@ export type {
|
|
|
26
26
|
DataTableErrorStateRenderContext,
|
|
27
27
|
} from "./packages/datatable/index";
|
|
28
28
|
|
|
29
|
+
export { Kanban, KanbanCardActions } from "./packages/kanban/index";
|
|
30
|
+
export type {
|
|
31
|
+
KanbanProps,
|
|
32
|
+
KanbanStage,
|
|
33
|
+
KanbanStageMeta,
|
|
34
|
+
KanbanStageVariant,
|
|
35
|
+
KanbanStageControlMode,
|
|
36
|
+
KanbanCardField,
|
|
37
|
+
KanbanCardFieldPlacement,
|
|
38
|
+
KanbanCardDensity,
|
|
39
|
+
KanbanCardBodyMode,
|
|
40
|
+
KanbanCardDividers,
|
|
41
|
+
KanbanCardRenderContext,
|
|
42
|
+
KanbanFilterConfig,
|
|
43
|
+
KanbanFilterType,
|
|
44
|
+
KanbanSortOption,
|
|
45
|
+
KanbanSelectionAction,
|
|
46
|
+
KanbanCardAction,
|
|
47
|
+
KanbanCardActionsProps,
|
|
48
|
+
KanbanLabels,
|
|
49
|
+
KanbanParams,
|
|
50
|
+
KanbanStageChangeResult,
|
|
51
|
+
KanbanMetricItem,
|
|
52
|
+
KanbanSelectionBarRenderContext,
|
|
53
|
+
KanbanEmptyStateRenderContext,
|
|
54
|
+
KanbanLoadingStateRenderContext,
|
|
55
|
+
KanbanErrorStateRenderContext,
|
|
56
|
+
KanbanTransitionPromptContext,
|
|
57
|
+
KanbanOption,
|
|
58
|
+
} from "./packages/kanban/index";
|
|
59
|
+
|
|
29
60
|
export { FormBuilder, useFormPrefill } from "./packages/form/index";
|
|
30
61
|
export type {
|
|
31
62
|
FormBuilderProps,
|
|
@@ -40,6 +71,7 @@ export type {
|
|
|
40
71
|
FormBuilderValidator,
|
|
41
72
|
FormBuilderDependsOnConfig,
|
|
42
73
|
FormBuilderRepeaterProps,
|
|
74
|
+
FormBuilderGroupOptions,
|
|
43
75
|
FormBuilderLabels,
|
|
44
76
|
FormBuilderAlertConfig,
|
|
45
77
|
FormBuilderButtonsRenderContext,
|
|
@@ -53,6 +85,28 @@ export type {
|
|
|
53
85
|
} from "./packages/form/index";
|
|
54
86
|
|
|
55
87
|
export { AutoTag, AutoStatusTag, KeyValueList, SectionHeader } from "./common-components";
|
|
88
|
+
export {
|
|
89
|
+
AvatarStack,
|
|
90
|
+
StyledText,
|
|
91
|
+
makeAvatarStackDataUri,
|
|
92
|
+
makeStyledTextDataUri,
|
|
93
|
+
HS_DATE_DIRECTION_LABELS,
|
|
94
|
+
HS_DATE_PRESETS,
|
|
95
|
+
HS_FONT_FAMILY,
|
|
96
|
+
HS_TEXT_COLOR,
|
|
97
|
+
HS_SUBTLE_BG,
|
|
98
|
+
HS_MUTED_TEXT,
|
|
99
|
+
HS_NEUTRAL_CHIP,
|
|
100
|
+
HS_TAG_SUBTLE_BORDER,
|
|
101
|
+
HS_TAG_TEXT_COLOR,
|
|
102
|
+
HS_TAG_FONT_SIZE,
|
|
103
|
+
HS_TAG_LINE_HEIGHT,
|
|
104
|
+
HS_TAG_PADDING_X,
|
|
105
|
+
HS_TAG_PADDING_Y,
|
|
106
|
+
HS_TAG_BORDER_RADIUS,
|
|
107
|
+
HS_TAG_BORDER_WIDTH,
|
|
108
|
+
DEFAULT_SVG_FONT_WEIGHT,
|
|
109
|
+
} from "./common-components";
|
|
56
110
|
export {
|
|
57
111
|
getAutoTagVariant,
|
|
58
112
|
getAutoStatusTagVariant,
|
|
@@ -68,7 +122,18 @@ export type {
|
|
|
68
122
|
export type {
|
|
69
123
|
AutoTagProps,
|
|
70
124
|
AutoStatusTagProps,
|
|
125
|
+
AvatarStackDataUriResult,
|
|
126
|
+
AvatarStackItem,
|
|
127
|
+
AvatarStackItemObject,
|
|
128
|
+
AvatarStackProps,
|
|
129
|
+
DateDirectionLabels,
|
|
130
|
+
DatePresetOption,
|
|
71
131
|
KeyValueListItem,
|
|
72
132
|
KeyValueListProps,
|
|
73
133
|
SectionHeaderProps,
|
|
134
|
+
StyledTextBackground,
|
|
135
|
+
StyledTextDataUriOptions,
|
|
136
|
+
StyledTextDataUriResult,
|
|
137
|
+
StyledTextFormat,
|
|
138
|
+
StyledTextProps,
|
|
74
139
|
} from "./common-components";
|
package/kanban.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./packages/kanban/index";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hs-uix",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "Production-ready UI components for HubSpot UI Extensions — DataTable, FormBuilder, and more",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -22,6 +22,11 @@
|
|
|
22
22
|
"import": "./dist/form.mjs",
|
|
23
23
|
"require": "./dist/form.js"
|
|
24
24
|
},
|
|
25
|
+
"./kanban": {
|
|
26
|
+
"types": "./kanban.d.ts",
|
|
27
|
+
"import": "./dist/kanban.mjs",
|
|
28
|
+
"require": "./dist/kanban.js"
|
|
29
|
+
},
|
|
25
30
|
"./common-components": {
|
|
26
31
|
"types": "./common-components.d.ts",
|
|
27
32
|
"import": "./dist/common-components.mjs",
|
|
@@ -38,6 +43,7 @@
|
|
|
38
43
|
"index.d.ts",
|
|
39
44
|
"datatable.d.ts",
|
|
40
45
|
"form.d.ts",
|
|
46
|
+
"kanban.d.ts",
|
|
41
47
|
"common-components.d.ts",
|
|
42
48
|
"utils.d.ts",
|
|
43
49
|
"README.md"
|
|
@@ -48,6 +54,8 @@
|
|
|
48
54
|
"scripts": {
|
|
49
55
|
"build": "tsup",
|
|
50
56
|
"dev": "tsup --watch",
|
|
57
|
+
"link:demos": "npm link && cd ../hs-uix-demos/src/app/pages && npm link hs-uix",
|
|
58
|
+
"dev:demos": "npm run link:demos && npm run dev",
|
|
51
59
|
"prepublishOnly": "tsup",
|
|
52
60
|
"release:patch": "npm version patch && npm publish && git push origin main --tags",
|
|
53
61
|
"release:minor": "npm version minor && npm publish && git push origin main --tags",
|