@harpercollins/harpercollins-design-system 1.8.62 → 1.8.64

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.
@@ -1,3 +1,3 @@
1
1
  export * from "./components";
2
2
  export * from "./hooks";
3
- export * from "./helpers";
3
+ export * from "./utils";
@@ -0,0 +1 @@
1
+ export { formatDate, formatNumber, formatText, formatCurrency } from "./utils";
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Format date to locale
3
+ * @param dateString - The date string to format
4
+ * @param format - The format to display the date in. Default is "dd MMM yyyy"
5
+ * @returns - The formatted date
6
+ */
7
+ export declare const formatDate: (dateString: string | null | undefined, format?: string) => string;
8
+ /**
9
+ * Format number to locale
10
+ * @param number - The number to format
11
+ * @returns The formatted number
12
+ */
13
+ export declare const formatNumber: (number: number | string | null | undefined) => string;
14
+ /**
15
+ * Format text to display NULL_DISPLAY_VALUE if text is empty, null or undefined
16
+ * @param text
17
+ * @returns The formatted text
18
+ */
19
+ export declare const formatText: (text: string | null | undefined) => string;
20
+ /**
21
+ * Format currency value to locale and currency
22
+ * @param value - The value to format
23
+ * @param locale - The locale to format the value to
24
+ * @param currency - The currency to format the value to
25
+ * @returns The formatted currency value
26
+ * */
27
+ export declare const formatCurrency: (value: number | string | null | undefined, locale?: string, currency?: string) => string;
@@ -0,0 +1 @@
1
+ export {};
package/dist/index.d.ts CHANGED
@@ -295,8 +295,32 @@ declare const useFetch: <T = unknown>(url: string, options?: RequestInit, deboun
295
295
  error: Error | null;
296
296
  };
297
297
 
298
- declare const formatDate: (dateString: string, format?: string) => string;
299
- declare const formatNumber: (number: number | string) => string;
300
- declare const formatText: (text: string) => string;
301
-
302
- export { Accordion, AppBar, AutoComplete as Autocomplete, AutocompleteSelectMultiple, Badge, Breadcrumb, Button, Divider, Modal as Drawer, DropDownMenu, Heading, Icon, Input, Layout, LoadingSpinner, Logo, ProgressBar, ProgressCircle, ReadMore, RelativeTime, StatusIcon, Table, Tabs, TextBlock, ToastMessages, Tooltip, formatDate, formatNumber, formatText, useFetch, useLocalStorage, useToggle };
298
+ /**
299
+ * Format date to locale
300
+ * @param dateString - The date string to format
301
+ * @param format - The format to display the date in. Default is "dd MMM yyyy"
302
+ * @returns - The formatted date
303
+ */
304
+ declare const formatDate: (dateString: string | null | undefined, format?: string) => string;
305
+ /**
306
+ * Format number to locale
307
+ * @param number - The number to format
308
+ * @returns The formatted number
309
+ */
310
+ declare const formatNumber: (number: number | string | null | undefined) => string;
311
+ /**
312
+ * Format text to display NULL_DISPLAY_VALUE if text is empty, null or undefined
313
+ * @param text
314
+ * @returns The formatted text
315
+ */
316
+ declare const formatText: (text: string | null | undefined) => string;
317
+ /**
318
+ * Format currency value to locale and currency
319
+ * @param value - The value to format
320
+ * @param locale - The locale to format the value to
321
+ * @param currency - The currency to format the value to
322
+ * @returns The formatted currency value
323
+ * */
324
+ declare const formatCurrency: (value: number | string | null | undefined, locale?: string, currency?: string) => string;
325
+
326
+ export { Accordion, AppBar, AutoComplete as Autocomplete, AutocompleteSelectMultiple, Badge, Breadcrumb, Button, Divider, Modal as Drawer, DropDownMenu, Heading, Icon, Input, Layout, LoadingSpinner, Logo, ProgressBar, ProgressCircle, ReadMore, RelativeTime, StatusIcon, Table, Tabs, TextBlock, ToastMessages, Tooltip, formatCurrency, formatDate, formatNumber, formatText, useFetch, useLocalStorage, useToggle };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@harpercollins/harpercollins-design-system",
3
- "version": "1.8.62",
3
+ "version": "1.8.64",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@ssh.dev.azure.com:v3/HarperCollinsUK/HCDesignSystem/HCDesignSystem"
@@ -1,3 +0,0 @@
1
- export declare const formatDate: (dateString: string, format?: string) => string;
2
- export declare const formatNumber: (number: number | string) => string;
3
- export declare const formatText: (text: string) => string;
@@ -1 +0,0 @@
1
- export { formatDate, formatNumber, formatText } from "./helpers";
@@ -1,3 +0,0 @@
1
- export declare const formatDate: (dateString: string, format?: string) => string;
2
- export declare const formatNumber: (number: number | string) => string;
3
- export declare const formatText: (text: string) => string;
@@ -1 +0,0 @@
1
- export { formatDate, formatNumber, formatText } from "./helpers";