hs-uix 1.6.0 → 1.6.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/utils.d.ts +31 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hs-uix",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
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",
package/utils.d.ts CHANGED
@@ -47,7 +47,34 @@ export interface StatusTagSortComparatorOptions extends AutoStatusTagOptions {
47
47
  export declare function createStatusTagSortComparator(
48
48
  options?: StatusTagSortComparatorOptions
49
49
  ): (aValue: unknown, bValue: unknown) => number;
50
+ export interface FormatCurrencyCompactOptions extends Intl.NumberFormatOptions {
51
+ locale?: string;
52
+ currency?: string;
53
+ maximumFractionDigits?: number;
54
+ compactDisplay?: "short" | "long";
55
+ }
56
+
57
+ export interface DeriveCardFieldsOptions<Row = Record<string, unknown>> {
58
+ titleField?: string;
59
+ titleHref?: (row: Row) => string | { url: string; external?: boolean };
60
+ placements?: Record<string, "title" | "subtitle" | "meta" | "body" | "footer">;
61
+ exclude?: string[];
62
+ include?: string[];
63
+ maxBodyFields?: number;
64
+ }
65
+
66
+ export interface DerivedCardField<Row = Record<string, unknown>> {
67
+ key: string;
68
+ field: string;
69
+ placement: "title" | "subtitle" | "meta" | "body" | "footer";
70
+ label?: unknown;
71
+ render?: (value: unknown, row: Row) => unknown;
72
+ truncate?: true | number | { maxLength?: number };
73
+ href?: (row: Row) => string | { url: string; external?: boolean };
74
+ }
75
+
50
76
  export declare function formatCurrency(value: unknown, options?: FormatCurrencyOptions): string;
77
+ export declare function formatCurrencyCompact(value: unknown, options?: FormatCurrencyCompactOptions): string;
51
78
  export declare function formatDate(value: unknown, options?: FormatDateOptions): string;
52
79
  export declare function formatDateTime(value: unknown, options?: FormatDateOptions): string;
53
80
  export declare function formatPercentage(value: unknown, options?: Intl.NumberFormatOptions & { locale?: string }): string;
@@ -57,3 +84,7 @@ export declare function isDateValueObject(value: unknown): boolean;
57
84
  export declare function isTimeValueObject(value: unknown): boolean;
58
85
  export declare function isDateTimeValueObject(value: unknown): boolean;
59
86
  export declare function sumBy<Item = Record<string, unknown>>(items: Item[] | null | undefined, keyOrFn: keyof Item | ((item: Item) => unknown)): number;
87
+ export declare function deriveCardFieldsFromColumns<Row = Record<string, unknown>>(
88
+ columns: ReadonlyArray<Record<string, unknown>> | null | undefined,
89
+ options?: DeriveCardFieldsOptions<Row>
90
+ ): DerivedCardField<Row>[];