@leapdevuk/component-toolbox 0.0.130 → 0.0.131

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 CHANGED
@@ -44,6 +44,9 @@ To run a single test, for example the DatePicker.
44
44
 
45
45
  npm run test -- DatePicker
46
46
 
47
+ To display console logs...
48
+ npm run test -- DatePicker --printConsoleTrace=true --silent=false
49
+
47
50
  ## Build
48
51
 
49
52
  To build the component toolbox as a package.
package/dist/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.0.131 (2025-08-13)
4
+
5
+ ### Bug Fixes
6
+
7
+ - AppBar 'help' link to access the application's help content is now centered within the parent bar.
8
+
3
9
  ## 0.0.130 (2025-07-17)
4
10
 
5
11
  ### Features
@@ -31,5 +31,57 @@ interface IDatePickerProps {
31
31
  locale?: Locale;
32
32
  sdk?: Api;
33
33
  }
34
+ /**
35
+ * Leap Component for DatePicker
36
+ * @param disabled - If true, the date picker is disabled.
37
+ * @param fullWidth - If true, the date picker will take the full width of its container.
38
+ * @param isUTC - If true, the date will be treated as UTC.
39
+ * @param startOfDate - If true, the date will be set to the start of the day.
40
+ * @param endOfDate - If true, the date will be set to the end of the day.
41
+ * @param dateOnly - If true, the time part will be ignored.
42
+ * @param onUpdate - Callback function to update the date value.
43
+ * @param additionalActions - Additional actions to be displayed in the date picker.
44
+ * @param size - Size of the date picker, can be "small" or "medium".
45
+ * @param validate30Days - If true, it will validate that the selected date is not more than 30 days in the future.
46
+ * @param validate - Custom validation function that returns an error if the date is invalid.
47
+ * @param value - The current value of the date picker.
48
+ * @param locale - Locale for date formatting.
49
+ * @param sdk - The Leap SDK instance for API interactions.
50
+ * @returns A DatePicker component that allows users to select a date with optional validation and additional actions.
51
+ * @example
52
+ * ```tsx
53
+ * <LCTDatePicker
54
+ * disabled={false}
55
+ * fullWidth={true}
56
+ * isUTC={false}
57
+ * startOfDate={true}
58
+ * endOfDate={false}
59
+ * dateOnly={false}
60
+ * onUpdate={(value) => console.log(value)}
61
+ * additionalActions={{
62
+ * showToday: true,
63
+ * showClear: true,
64
+ * customActions: [
65
+ * { label: "Last 7 Days", value: new Date(Date.now() - 7 * 24 * 60 * 60 * 1000) },
66
+ * { label: "Last 30 Days", value: new Date(Date.now() - 30 * 24 * 60 * 60 * 1000) },
67
+ * ],
68
+ * }}
69
+ * size="small"
70
+ * validate30Days={true}
71
+ * validate={(value) => {
72
+ * if (value && new Date(value) > new Date(Date.now() + 30 * 24 * 60 * 60 * 1000)) {
73
+ * return { keepButton: true, message: "Date cannot be more than 30 days in the future." };
74
+ * }
75
+ * return null;
76
+ * }}
77
+ * value={null}
78
+ * locale={enGB} // or any other locale
79
+ * sdk={leapSdkInstance} // Leap SDK instance
80
+ * />
81
+ *
82
+ * This component provides a user-friendly date selection interface with validation and additional actions like "Today" and "Clear".
83
+ * It supports both date and datetime formats, and can be customized with locale settings.
84
+ *
85
+ */
34
86
  declare const LCTDatePicker: FC<IDatePickerProps>;
35
87
  export default LCTDatePicker;
@@ -1,204 +1,213 @@
1
1
  import { Api, LeapContext } from '@leapdev/leap-host';
2
2
  import { Locale } from 'date-fns';
3
3
  /**
4
- * This constant defines the date format used for database storage.
5
- * It is used to ensure consistent date formatting across the application,
6
- * especially when interacting with databases or APIs that require a specific date format.
4
+ * This constant defines the string used to represent an invalid date.
5
+ * It is used to indicate that a date value is not valid or cannot be parsed.
6
+ */
7
+ export declare const invalidDate = "Invalid date";
8
+ /**
9
+ * This constant defines the date format used for database storage.
10
+ * It is used to ensure consistent date formatting across the application,
11
+ * especially when interacting with databases or APIs that require a specific date format.
7
12
  */
8
13
  export declare const dbDateOnlyFormat = "yyyy-MM-dd";
9
14
  /**
10
- * This constant defines the default date format used in the application.
11
- * It is used for displaying dates in the user interface and for formatting dates in various components.
15
+ * This constant defines the default date format used in the application.
16
+ * It is used for displaying dates in the user interface and for formatting dates in various components.
12
17
  */
13
18
  export declare const defaultDateFormat = "dd/MM/yyyy";
14
19
  /**
15
- * This constant defines the default date and time format used in the application.
16
- * It is used for displaying both date and time in the user interface and for formatting datetime values
20
+ * This constant defines the default date and time format used in the application.
21
+ * It is used for displaying both date and time in the user interface and for formatting datetime values
17
22
  */
18
23
  export declare const defaultDateTimeFormat = "yyyy-MM-dd HH:mm:ss";
19
24
  /**
20
- * This constant defines the minimum date that can be used in the application.
21
- * It is set to January 1, 1900, and is used to ensure that date inputs do not go below this value.
22
- * It is useful for setting a minimum date in date pickers or other date-related components.
25
+ * This constant defines the minimum date that can be used in the application.
26
+ * It is set to January 1, 1900, and is used to ensure that date inputs do not go below this value.
27
+ * It is useful for setting a minimum date in date pickers or other date-related components.
23
28
  */
24
29
  export declare const minDateAsObject: Date;
25
30
  /**
26
- * This constant defines the timezone used in the application.
27
- * It is derived from the user's system settings and is used for formatting dates and times in the user's local timezone.
28
- * It ensures that date and time values are displayed correctly based on the user's timezone.
31
+ * This constant defines the timezone used in the application.
32
+ * It is derived from the user's system settings and is used for formatting dates and times in the user's local timezone.
33
+ * It ensures that date and time values are displayed correctly based on the user's timezone.
29
34
  */
30
35
  export declare const timezone: string;
31
36
  /**
32
- * This constant defines the UTC format used for date and time values in the application.
33
- * It is used to ensure that date and time values are stored and displayed in a consistent UTC format.
37
+ * This constant defines the UTC format used for date and time values in the application.
38
+ * It is used to ensure that date and time values are stored and displayed in a consistent UTC format.
34
39
  */
35
40
  export declare const utcFormat = "yyyy-MM-dd HH:mm:ss";
36
41
  /**
37
- * This function returns the minimum date as a string formatted in the default date format.
38
- * It is useful for setting a minimum date in date pickers or other date-related components.
39
- * @returns (string): The minimum date formatted as a string in the default date format.
40
- * @example
41
- * ```typescript
42
- * const minDate = getMinDate(); // Returns "01/01/1900"
43
- * ```
42
+ * This constant defines the UTC timezone used in the application.
43
+ */
44
+ export declare const utcTimeZone = "Etc/UTC";
45
+ /**
46
+ * This function returns the minimum date as a string formatted in the default date format.
47
+ * It is useful for setting a minimum date in date pickers or other date-related components.
48
+ * @returns (string): The minimum date formatted as a string in the default date format.
49
+ * @example
50
+ * ```typescript
51
+ * const minDateValue = minDate; // Returns "01/01/1900"
52
+ * ```
44
53
  */
45
54
  export declare const minDate: string;
46
55
  /**
47
- * This function returns a date that is one week from today, formatted as a string.
48
- * It is useful for scenarios where you need to calculate a date one week in the future,
49
- * such as setting deadlines or reminders.
50
- * @returns (string): A formatted date string representing one week from today.
51
- * It can be used in various contexts, such as displaying future dates in a user interface or calculating due dates.
52
- * @example
53
- * ```typescript
54
- * const oneWeekFromToday = getOneWeekFromToday(); // Returns "dd/MM/yyyy" format of the date one week from today
55
- * ```
56
+ * This function returns a date that is one week from today, formatted as a string.
57
+ * It is useful for scenarios where you need to calculate a date one week in the future,
58
+ * such as setting deadlines or reminders.
59
+ * @returns (string): A formatted date string representing one week from today.
60
+ * It can be used in various contexts, such as displaying future dates in a user interface or calculating due dates.
61
+ * @example
62
+ * ```typescript
63
+ * const oneWeekFromToday = oneWeek; // Returns "dd/MM/yyyy" format of the date one week from today
64
+ * ```
56
65
  */
57
66
  export declare const oneWeek: string;
58
67
  /**
59
- * This function returns today's date formatted as a string in the default date format.
60
- * It is useful for displaying the current date in a user interface or for date calculations.
61
- * @returns (string): Today's date formatted as a string in the default date format.
62
- * It can be used in various contexts, such as displaying the current date in a user interface or calculating date differences.
63
- * @example
64
- * ```typescript
65
- * const todayDate = getTodayDate(); // Returns "dd/MM/yyyy" format of today's date
66
- * ```
68
+ * This function returns today's date formatted as a string in the default date format.
69
+ * It is useful for displaying the current date in a user interface or for date calculations.
70
+ * @returns (string): Today's date formatted as a string in the default date format.
71
+ * It can be used in various contexts, such as displaying the current date in a user interface or calculating date differences.
72
+ * @example
73
+ * ```typescript
74
+ * const todayDate = today; // Returns "dd/MM/yyyy" format of today's date
75
+ * ```
67
76
  */
68
77
  export declare const today: string;
69
78
  /**
70
- * This function returns a date that is one day from today, formatted as a string.
71
- * It is useful for scenarios where you need to calculate a date one day in the future,
72
- * such as setting deadlines or reminders.
73
- * @returns (string): A formatted date string representing tomorrow's date.
74
- * It can be used in various contexts, such as displaying future dates in a user interface or calculating due dates.
75
- * @example
76
- * ```typescript
77
- * const tomorrowDate = getTomorrowDate(); // Returns "dd/MM/yyyy" format of the date tomorrow
78
- * ```
79
+ * This function returns a date that is one day from today, formatted as a string.
80
+ * It is useful for scenarios where you need to calculate a date one day in the future,
81
+ * such as setting deadlines or reminders.
82
+ * @returns (string): A formatted date string representing tomorrow's date.
83
+ * It can be used in various contexts, such as displaying future dates in a user interface or calculating due dates.
84
+ * @example
85
+ * ```typescript
86
+ * const tomorrowDate = tomorrow; // Returns "dd/MM/yyyy" format of the date tomorrow
87
+ * ```
79
88
  */
80
89
  export declare const tomorrow: string;
81
90
  /**
82
- * This function returns a date that is two weeks from today, formatted as a string.
83
- * It is useful for scenarios where you need to calculate a date two weeks in the future,
84
- * such as setting deadlines or reminders.
85
- * @returns (string): A formatted date string representing two weeks from today.
86
- * It can be used in various contexts, such as displaying future dates in a user interface or calculating due dates.
87
- * @example
88
- * ```typescript
89
- * const twoWeeksFromToday = getTwoWeeksFromToday(); // Returns "dd/MM/yyyy" format of the date two weeks from today
90
- * ```
91
+ * This function returns a date that is two weeks from today, formatted as a string.
92
+ * It is useful for scenarios where you need to calculate a date two weeks in the future,
93
+ * such as setting deadlines or reminders.
94
+ * @returns (string): A formatted date string representing two weeks from today.
95
+ * It can be used in various contexts, such as displaying future dates in a user interface or calculating due dates.
96
+ * @example
97
+ * ```typescript
98
+ * const twoWeeksFromToday = twoWeeks; // Returns "dd/MM/yyyy" format of the date two weeks from today
99
+ * ```
91
100
  */
92
101
  export declare const twoWeeks: string;
93
102
  /**
94
- * This function returns the current date formatted as a string based on the provided format.
95
- * @param formatString (optional) The format string to use for the date. Defaults to "dd/MM/yyyy".
96
- * It is useful for getting the current date in a specific format, such as "dd/MM/yyyy" or "MM/dd/yyyy".
97
- * If no format string is provided, it defaults to "dd/MM/yyyy".
98
- * @returns (string): The current date formatted as a string.
99
- * It can be used in various contexts, such as displaying the current date in a user interface or storing it in a database.
100
- * @example
101
- * ```typescript
102
- * const formattedDate = defaultDate(); // Returns the current date in "dd/MM/yyyy" format
103
- * const formattedDateUS = defaultDate("MM/dd/yyyy"); // Returns the current date in "MM/dd/yyyy" format
104
- * ```
103
+ * This function returns the current date formatted as a string based on the provided format.
104
+ * @param formatString (optional) The format string to use for the date. Defaults to "dd/MM/yyyy".
105
+ * It is useful for getting the current date in a specific format, such as "dd/MM/yyyy" or "MM/dd/yyyy".
106
+ * If no format string is provided, it defaults to "dd/MM/yyyy".
107
+ * @returns (string): The current date formatted as a string.
108
+ * It can be used in various contexts, such as displaying the current date in a user interface or storing it in a database.
109
+ * @example
110
+ * ```typescript
111
+ * const formattedDate = defaultDate(); // Returns the current date in "dd/MM/yyyy" format
112
+ * const formattedDateUS = defaultDate("MM/dd/yyyy"); // Returns the current date in "MM/dd/yyyy" format
113
+ * ```
105
114
  */
106
115
  export declare const defaultDate: (formatString?: string) => string;
107
116
  /**
108
- * This function formats a date based on the provided parameters.
109
- * It can format the date to the start or end of the day, handle UTC dates,
110
- * and format it as a date-only string.
111
- * It is useful for displaying dates in a specific format,
112
- * such as in a date picker or when saving dates to a database.
113
- * @param date (Date | null | undefined): The date to format. If null or undefined, it returns null.
114
- * @param startOfDate (boolean): If true, formats the date to the start of the day.
115
- * @param endOfDate (boolean): If true, formats the date to the end of the day.
116
- * @param isUTC (boolean): If true, formats the date in UTC format.
117
- * @param dateOnly (boolean): If true, formats the date as a date-only string (e.g., "yyyy-MM-dd").
118
- * This is useful for scenarios where you need to display or store only the date part without the time.
119
- * It can be used in various contexts, such as displaying dates in a user interface or saving them to a database.
120
- * @example
121
- * ```typescript
122
- * const formattedDate = formatDate(new Date(), true, false, false, true); // Formats the current date to the start of the day as a date-only string
123
- * const formattedUTCDate = formatDate(new Date(), false, false, true); // Formats the current date in UTC format
124
- * const formattedEndDate = formatDate(new Date(), false, true); // Formats the current date to the end of the day
125
- * ```
126
- * @returns (string | null): A formatted date string based on the provided parameters. If the input date is null or undefined, it returns null.
117
+ * This function formats a date based on the provided parameters.
118
+ * It can format the date to the start or end of the day, handle UTC dates,
119
+ * and format it as a date-only string.
120
+ * It is useful for displaying dates in a specific format,
121
+ * such as in a date picker or when saving dates to a database.
122
+ * @param date (Date | null | undefined): The date to format. If null or undefined, it returns null.
123
+ * @param startOfDate (boolean): If true, formats the date to the start of the day.
124
+ * @param endOfDate (boolean): If true, formats the date to the end of the day.
125
+ * @param isUTC (boolean): If true, formats the date in UTC format.
126
+ * @param dateOnly (boolean): If true, formats the date as a date-only string (e.g., "yyyy-MM-dd").
127
+ * This is useful for scenarios where you need to display or store only the date part without the time.
128
+ * It can be used in various contexts, such as displaying dates in a user interface or saving them to a database.
129
+ * @example
130
+ * ```typescript
131
+ * const formattedDate = formatDate(new Date(), true, false, false, true); // Formats the current date to the start of the day as a date-only string
132
+ * const formattedUTCDate = formatDate(new Date(), false, false, true); // Formats the current date in UTC format
133
+ * const formattedEndDate = formatDate(new Date(), false, true); // Formats the current date to the end of the day
134
+ * ```
135
+ * @returns (string | null): A formatted date string based on the provided parameters. If the input date is null or undefined, it returns null.
127
136
  */
128
137
  export declare const formatDate: (date?: Date | null, startOfDate?: boolean, endOfDate?: boolean, isUTC?: boolean, dateOnly?: boolean) => string | null;
129
138
  /**
130
- * This function parses a date string into a Date object based on the provided format.
131
- * It splits the date string into parts (day, month, year) and constructs a Date object.
132
- * If the date string is invalid or cannot be parsed, it returns null.
133
- * It also handles two-digit years by converting them to four-digit years.
134
- * @param date (any): The date string to parse. It can be in various formats (e.g., "dd/MM/yyyy", "MM/dd/yyyy").
135
- * @param formatString (string): The format string to use for parsing the date.
136
- * @param localDateformat (string): The local date format to use for parsing. It should match the format of the input date string.
137
- * @param parseKeyboardVal (boolean): Whether to parse the date from a keyboard input. Defaults to false.
138
- * @returns (string | null): Returns a formatted date string if parsing is successful, or null if the input is invalid.
139
- * This function is useful for converting user input or string representations of dates into a Date object.
140
- * It can handle various date formats and ensures that the resulting Date object is valid.
141
- * If the input date string is invalid or cannot be parsed, it returns null.
142
- * It also includes logic to handle two-digit years by converting them to four-digit years.
143
- * @example
144
- * ```typescript
145
- * const parsedDate = parseDate("25/12/2023", "dd/MM/yyyy", "dd/MM/yyyy");
146
- * console.log(parsedDate); // Returns "2023-12-25" in the "yyyy-MM-dd" format
147
- * const parsedDateUS = parseDate("12/25/23", "MM/dd/yyyy", "MM/dd/yyyy");
148
- * console.log(parsedDateUS); // Returns "2023-12-25" in the "yyyy-MM-dd" format
149
- * const parsedInvalidDate = parseDate("31/02/2023", "dd/MM/yyyy", "dd/MM/yyyy");
150
- * console.log(parsedInvalidDate); // Returns null, as February 31st is invalid
151
- * ```
139
+ * This function parses a date string into a Date object based on the provided format.
140
+ * It splits the date string into parts (day, month, year) and constructs a Date object.
141
+ * If the date string is invalid or cannot be parsed, it returns null.
142
+ * It also handles two-digit years by converting them to four-digit years.
143
+ * @param date (any): The date string to parse. It can be in various formats (e.g., "dd/MM/yyyy", "MM/dd/yyyy").
144
+ * @param formatString (string): The format string to use for parsing the date.
145
+ * @param localDateformat (string): The local date format to use for parsing. It should match the format of the input date string.
146
+ * @param parseKeyboardVal (boolean): Whether to parse the date from a keyboard input. Defaults to false.
147
+ * @returns (string | null): Returns a formatted date string if parsing is successful, or null if the input is invalid.
148
+ * This function is useful for converting user input or string representations of dates into a Date object.
149
+ * It can handle various date formats and ensures that the resulting Date object is valid.
150
+ * If the input date string is invalid or cannot be parsed, it returns null.
151
+ * It also includes logic to handle two-digit years by converting them to four-digit years.
152
+ * @example
153
+ * ```typescript
154
+ * const parsedDate = parseDate("25/12/2023", "dd/MM/yyyy", "dd/MM/yyyy");
155
+ * console.log(parsedDate); // Returns "2023-12-25" in the "yyyy-MM-dd" format
156
+ * const parsedDateUS = parseDate("12/25/23", "MM/dd/yyyy", "MM/dd/yyyy");
157
+ * console.log(parsedDateUS); // Returns "2023-12-25" in the "yyyy-MM-dd" format
158
+ * const parsedInvalidDate = parseDate("31/02/2023", "dd/MM/yyyy", "dd/MM/yyyy");
159
+ * console.log(parsedInvalidDate); // Returns null, as February 31st is invalid
160
+ * ```
152
161
  */
153
162
  export declare const parseDate: (date: any, formatString: string | undefined, localDateformat: string, parseKeyboardVal?: boolean) => string | null;
154
163
  /**
155
- * This function returns a locale object based on the provided LeapContext.
156
- * It checks the hostInfo.region and returns the corresponding locale with weekStartsOn set to 1.
157
- * If the region is not recognized, it returns undefined.
158
- * @param leapContext (LeapContext | undefined): The LeapContext object containing hostInfo with region information.
159
- * @returns The function supports UK, US, AU (including NZ), and CA regions. If the region is not recognized, it returns undefined.
160
- * @example
161
- * ```typescript
162
- * const locale = getLocale(leapContext); // Returns the appropriate locale based on the region
163
- * const localeUS = getLocale({ hostInfo: { region: "us" } }); // Returns enUS locale
164
- * const localeUK = getLocale({ hostInfo: { region: "uk" } }); // Returns enGB locale
165
- * const localeAU = getLocale({ hostInfo: { region: "au" } }); // Returns enAU locale
166
- * const localeCA = getLocale({ hostInfo: { region: "ca" } }); // Returns enGB locale
167
- * ```
164
+ * This function returns a locale object based on the provided LeapContext.
165
+ * It checks the hostInfo.region and returns the corresponding locale with weekStartsOn set to 1.
166
+ * If the region is not recognized, it returns undefined.
167
+ * @param leapContext (LeapContext | undefined): The LeapContext object containing hostInfo with region information.
168
+ * @returns The function supports UK, US, AU (including NZ), and CA regions. If the region is not recognized, it returns undefined.
169
+ * @example
170
+ * ```typescript
171
+ * const locale = getLocale(leapContext); // Returns the appropriate locale based on the region
172
+ * const localeUS = getLocale({ hostInfo: { region: "us" } }); // Returns enUS locale
173
+ * const localeUK = getLocale({ hostInfo: { region: "uk" } }); // Returns enGB locale
174
+ * const localeAU = getLocale({ hostInfo: { region: "au" } }); // Returns enAU locale
175
+ * const localeCA = getLocale({ hostInfo: { region: "ca" } }); // Returns enGB locale
176
+ * ```
168
177
  */
169
178
  export declare const getLocale: (leapContext?: LeapContext) => Locale | undefined;
170
179
  /**
171
- * This function formats a date or datetime value into a string based on the provided locale.
172
- * It supports both date-only and datetime formats, and can handle UTC dates.
173
- * @param inputValue (string | Date | undefined): The date or datetime value to format.
174
- * @param locale (Locale | undefined): The locale to use for formatting. If undefined, it will not format the date.
175
- * @param outputAsUtc (boolean): Whether the date is in UTC format. Defaults to true.
176
- * @param outputAsDateOnly (boolean): Whether to format the value as a date only.
177
- * @param outputAs24H (boolean): Whether to show the time in 24-hour format. Defaults to false.
178
- * @returns (string): A formatted date or datetime string. If the input value is invalid or locale is undefined, it returns an empty string.
179
- * @example
180
- * ```typescript
181
- * const formattedDate = lctFormatDateTime(new Date(), enGB, true, false, true); // Returns "01/01/2023 14:30"
182
- * const formattedDateTime = lctFormatDateTime("2023-01-01T14:30:00Z", enUS, true, false, false); // Returns "01/01/2023 02:30 PM"
183
- * const formattedDateOnly = lctFormatDateTime("2023-01-01", enAU, false, true); // Returns "01/01/2023"
184
- * const formattedInvalid = lctFormatDateTime(undefined, enGB); // Returns ""
185
- * ```
180
+ * This function formats a date or datetime value into a string based on the provided locale.
181
+ * It supports both date-only and datetime formats, and can handle UTC dates.
182
+ * @param inputValue (string | Date | undefined): The date or datetime value to format.
183
+ * @param locale (Locale | undefined): The locale to use for formatting. If undefined, it will not format the date.
184
+ * @param outputAsUtc (boolean): Whether the date is in UTC format. Defaults to true.
185
+ * @param outputAsDateOnly (boolean): Whether to format the value as a date only.
186
+ * @param outputAs24H (boolean): Whether to show the time in 24-hour format. Defaults to false.
187
+ * @returns (string): A formatted date or datetime string. If the input value is invalid or locale is undefined, it returns an empty string.
188
+ * @example
189
+ * ```typescript
190
+ * const formattedDate = lctFormatDateTime(new Date(), enGB, true, false, true); // Returns "01/01/2023 14:30"
191
+ * const formattedDateTime = lctFormatDateTime("2023-01-01T14:30:00Z", enUS, true, false, false); // Returns "01/01/2023 02:30 PM"
192
+ * const formattedDateOnly = lctFormatDateTime("2023-01-01", enAU, false, true); // Returns "01/01/2023"
193
+ * const formattedInvalid = lctFormatDateTime(undefined, enGB); // Returns ""
194
+ * ```
186
195
  */
187
196
  export declare const formatDateTime: (inputValue?: string | Date, locale?: Locale, outputAsUtc?: boolean, outputAsDateOnly?: boolean, outputAs24H?: boolean) => string;
188
197
  /**
189
- * This function formats a date string into a report-friendly format based on the provided locale.
190
- * It handles both ISO date strings and strings in the format "yyyy-MM-dd".
198
+ * This function formats a date string into a report-friendly format based on the provided locale.
199
+ * It handles both ISO date strings and strings in the format "yyyy-MM-dd".
191
200
  *
192
- * @param date (string | null): The date string to format. It can be in ISO format or "yyyy-MM-dd".
193
- * @param locale (Locale | undefined): The locale to use for formatting. If undefined, it will not format the date.
194
- * @returns (string): A formatted date string. If the input date is invalid or locale is undefined, it returns an empty string and logs a warning.
195
- * @example
196
- * ```typescript
197
- * const formattedReportDate = formatReportDate("2023-12-25", enGB); // Returns "25-12-2023"
198
- * const formattedReportDateISO = formatReportDate("2023-12-25T00:00:00Z", enUS); // Returns "12-25-2023"
199
- * const formattedReportDateInvalid = formatReportDate("31-02-2023", enGB); // Returns "", logs warning
200
- * const formattedReportDateNull = formatReportDate(null, enGB); // Returns "", logs warning
201
- * ```
201
+ * @param date (string | null): The date string to format. It can be in ISO format or "yyyy-MM-dd".
202
+ * @param locale (Locale | undefined): The locale to use for formatting. If undefined, it will not format the date.
203
+ * @returns (string): A formatted date string. If the input date is invalid or locale is undefined, it returns an empty string and logs a warning.
204
+ * @example
205
+ * ```typescript
206
+ * const formattedReportDate = formatReportDate("2023-12-25", enGB); // Returns "25-12-2023"
207
+ * const formattedReportDateISO = formatReportDate("2023-12-25T00:00:00Z", enUS); // Returns "12-25-2023"
208
+ * const formattedReportDateInvalid = formatReportDate("31-02-2023", enGB); // Returns "", logs warning
209
+ * const formattedReportDateNull = formatReportDate(null, enGB); // Returns "", logs warning
210
+ * ```
202
211
  */
203
212
  export declare const formatReportDate: (date: string | null, locale?: Locale) => string;
204
213
  /**
@@ -206,52 +215,54 @@ export declare const formatReportDate: (date: string | null, locale?: Locale) =>
206
215
  */
207
216
  export declare const getDateTimeWithOffset: (date: string) => Date;
208
217
  /**
209
- * This function checks if a string is null or undefined.
210
- * It returns true if the string is null, undefined, or an empty string.
211
- * @param value (string | null | undefined): The string to check.
212
- * @returns (boolean): Returns true if the string is null, undefined, or empty; otherwise, false.
213
- * @example
214
- * ```typescript
215
- * const isNullOrUndefined = isStringNullOrUndefined(null); // Returns true
216
- * const isEmptyString = isStringNullOrUndefined(""); // Returns true
217
- * const isValidString = isStringNullOrUndefined("Hello"); // Returns false
218
- * ```
218
+ * This function checks if a string is null or undefined.
219
+ * It returns true if the string is null, undefined, or an empty string.
220
+ * @param value (string | null | undefined): The string to check.
221
+ * @returns (boolean): Returns true if the string is null, undefined, or empty; otherwise, false.
222
+ * @example
223
+ * ```typescript
224
+ * const isNullOrUndefined = isStringNullOrUndefined(null); // Returns true
225
+ * const isEmptyString = isStringNullOrUndefined(""); // Returns true
226
+ * const isValidString = isStringNullOrUndefined("Hello"); // Returns false
227
+ * ```
219
228
  */
220
229
  export declare const isStringNullOrUndefined: (value?: string | null) => boolean;
221
230
  /**
222
- * This function formats a date as a string in the "yyyy-MM-dd" format, suitable for database storage.
223
- * It takes a Date object as input and returns the formatted string.
224
- * @param date (Date): The date to format.
225
- * @returns (string): A formatted date string in the "yyyy-MM-dd" format.
226
- * @example
227
- * ```typescript
228
- * const dbFormattedDate = formatAsDBDate(new Date()); // Returns "2023-12-25"
229
- * const dbFormattedDateInvalid = formatAsDBDate(new Date("Invalid Date")); // Returns "Invalid date"
230
- * ```
231
+ * This function formats a date as a string in the "yyyy-MM-dd" format, suitable for database storage.
232
+ * It takes a Date object as input and returns the formatted string.
233
+ * @param date (Date): The date to format.
234
+ * @returns (string): A formatted date string in the "yyyy-MM-dd" format.
235
+ * @example
236
+ * ```typescript
237
+ * const dbFormattedDate = formatAsDBDate(new Date()); // Returns "2023-12-25"
238
+ * const dbFormattedDateInvalid = formatAsDBDate(new Date("Invalid Date")); // Returns "Invalid date"
239
+ * ```
231
240
  */
232
241
  export declare const formatAsDBDate: (date: Date) => string;
233
242
  /**
234
- * This function formats a date or datetime value into a string based on the provided locale.
235
- * It supports both date-only and datetime formats, and can handle UTC dates.
236
- * It also allows for formatting the start or end of the day.
237
- * @param inputValue (string | Date | undefined): The date or datetime value to format.
238
- * @param outputAsStartOfDay (boolean): If true, formats the date to the start of the day.
239
- * @param outputAsEndOfDay (boolean): If true, formats the date to the end of the day.
240
- * @returns (string): A formatted date or datetime string. If the input value is invalid or locale is undefined, it returns an empty string.
241
- * @example
242
- * ```typescript
243
- * const formattedDate = convertLocalDateToUTCDateTime(new Date(), enGB, true, false, true); // Returns "01/01/2023 14:30"
244
- * const formattedDateTime = convertLocalDateToUTCDateTime("2023-01-01T14:30:00Z", enUS, true, false, false); // Returns "01/01/2023 02:30 PM"
245
- * const formattedDateOnly = convertLocalDateToUTCDateTime("2023-01-01", enAU, false, true); // Returns "01/01/2023"
246
- * const formattedInvalid = convertLocalDateToUTCDateTime(undefined, enGB); // Returns ""
247
- * const outputAsStartOfDay = convertLocalDateToUTCDateTime(new Date(), enGB, true, false, true, undefined, true); // Returns "01/01/2023 00:00"
248
- * const outputAsEndOfDay = convertLocalDateToUTCDateTime(new Date(), enGB, true, false, true, undefined, false, true); // Returns "01/01/2023 23:59"
249
- * ```
243
+ * This function converts a local date to a UTC date and time string.
244
+ * It can output the date as the start or end of the day, or as a regular date.
245
+ * It is useful for converting local date inputs to a standardized UTC format for storage or processing.
246
+ * @param inputValue (string | Date | undefined): The local date to convert. It can be a string or a Date object.
247
+ * @param outputAsStartOfDay (boolean): If true, the output will be the start of the day in UTC format.
248
+ * @param outputAsEndOfDay (boolean): If true, the output will be the end of the day in UTC format.
249
+ * If both outputAsStartOfDay and outputAsEndOfDay are false,
250
+ * the output will be the date in UTC format without any time adjustments.
251
+ * If inputValue is null or undefined, the function returns an empty string.
252
+ * @returns
253
+ * (string): A UTC date and time string. If inputValue is null or undefined, it returns an empty string.
254
+ * @example
255
+ * ```typescript
256
+ * const utcDateStart = convertLocalDateToUTCDateTime("2023-12-25", true, false); // Returns "2023-12-25T00:00:00.000Z"
257
+ * const utcDateEnd = convertLocalDateToUTCDateTime("2023-12-25", false, true); // Returns "2023-12-25T23:59:59.999Z"
258
+ * const utcDateRegular = convertLocalDateToUTCDateTime("2023-12-25", false, false); // Returns "2023-12-25T00:00:00.000Z"
259
+ * const utcDateInvalid = convertLocalDateToUTCDateTime(undefined, true, false ); // Returns ""
260
+ * ```
250
261
  */
251
262
  export declare const convertLocalDateToUTCDateTime: (inputValue?: string | Date, outputAsStartOfDay?: boolean, outputAsEndOfDay?: boolean) => string;
252
263
  /**
253
- * This enum defines the types of buttons available in the dialog.
254
- * It is used to identify which button was clicked by the user.
264
+ * This enum defines the types of buttons available in the dialog.
265
+ * It is used to identify which button was clicked by the user.
255
266
  */
256
267
  export declare enum DialogButtonType {
257
268
  Confirm = 1,
@@ -259,28 +270,28 @@ export declare enum DialogButtonType {
259
270
  Cancel = 3
260
271
  }
261
272
  /**
262
- * This function shows a 3-button alert dialog using the Leap SDK.
263
- * It allows the user to confirm, refuse, or cancel an action.
264
- * It takes a message, button texts, and callbacks for each action.
265
- * @param message (string): The message to display in the dialog.
266
- * @param confirmButtonText (string): The text for the confirm button.
267
- * @param confirmCallback (function): The callback function to execute when the confirm button is clicked.
268
- * @param refuseButtonText (string): The text for the refuse button. Optional.
269
- * @param refuseCallback (function): The callback function to execute when the refuse button is clicked. Optional.
270
- * @param cancelButtonText (string): The text for the cancel button. Optional.
271
- * @param sdkApi (Api): The Leap SDK API instance to use for showing the dialog.
272
- * @returns A promise that resolves when the dialog is closed.
273
- * @example
274
- * ```typescript
275
- * show3buttonAlert(
276
- * "Are you sure you want to proceed?",
277
- * "Yes",
278
- * () => console.log("Confirmed"),
279
- * "No",
280
- * () => console.log("Refused"),
281
- * "Cancel",
282
- * sdkApi
283
- * );
284
- * ```
273
+ * This function shows a 3-button alert dialog using the Leap SDK.
274
+ * It allows the user to confirm, refuse, or cancel an action.
275
+ * It takes a message, button texts, and callbacks for each action.
276
+ * @param message (string): The message to display in the dialog.
277
+ * @param confirmButtonText (string): The text for the confirm button.
278
+ * @param confirmCallback (function): The callback function to execute when the confirm button is clicked.
279
+ * @param refuseButtonText (string): The text for the refuse button. Optional.
280
+ * @param refuseCallback (function): The callback function to execute when the refuse button is clicked. Optional.
281
+ * @param cancelButtonText (string): The text for the cancel button. Optional.
282
+ * @param sdkApi (Api): The Leap SDK API instance to use for showing the dialog.
283
+ * @returns A promise that resolves when the dialog is closed.
284
+ * @example
285
+ * ```typescript
286
+ * show3buttonAlert(
287
+ * "Are you sure you want to proceed?",
288
+ * "Yes",
289
+ * () => console.log("Confirmed"),
290
+ * "No",
291
+ * () => console.log("Refused"),
292
+ * "Cancel",
293
+ * sdkApi
294
+ * );
295
+ * ```
285
296
  */
286
297
  export declare const show3buttonAlert: (message: string, confirmButtonText: string, confirmCallback: () => void, refuseButtonText?: string, refuseCallback?: () => void, cancelButtonText?: string, sdkApi?: Api) => Promise<void> | undefined;