@longline/aqua-ui 1.0.183 → 1.0.186
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/containers/Dock/Dock.d.ts +7 -4
- package/containers/Dock/Dock.js +2 -1
- package/containers/Dock/Dockable.d.ts +14 -3
- package/containers/Dock/Dockable.js +45 -14
- package/containers/DragBar/DragBar.d.ts +4 -1
- package/containers/DragBar/DragBar.js +1 -0
- package/containers/GlassPane/GlassPane.d.ts +16 -4
- package/containers/GlassPane/GlassPane.js +41 -8
- package/containers/InfoBox/InfoBox.d.ts +23 -2
- package/containers/InfoBox/InfoBox.js +40 -2
- package/containers/InfoBox/elements/Content.d.ts +4 -1
- package/containers/InfoBox/elements/Content.js +1 -0
- package/containers/InfoBox/elements/Footer.d.ts +4 -1
- package/containers/InfoBox/elements/Footer.js +1 -0
- package/containers/InfoBox/elements/Header.d.ts +4 -1
- package/containers/InfoBox/elements/Header.js +2 -1
- package/containers/List/ListCell.d.ts +4 -1
- package/containers/List/ListCell.js +2 -1
- package/containers/List/ListRow.d.ts +4 -1
- package/containers/List/ListRow.js +2 -1
- package/containers/Message/Error.d.ts +4 -1
- package/containers/Message/Error.js +1 -0
- package/containers/Message/Message.d.ts +13 -3
- package/containers/Message/Message.js +2 -1
- package/containers/Message/NoData.d.ts +4 -1
- package/containers/Message/NoData.js +1 -0
- package/containers/Message/NoFilteredData.d.ts +4 -1
- package/containers/Message/NoFilteredData.js +1 -0
- package/controls/Chip/Chip.d.ts +7 -4
- package/controls/Chip/Chip.js +12 -12
- package/controls/Dropzone/Dropzone.d.ts +14 -10
- package/controls/Dropzone/Dropzone.js +88 -20
- package/controls/Fab/Fab.d.ts +7 -5
- package/controls/Fab/Fab.js +19 -18
- package/controls/FilterButton/FilterButton.d.ts +4 -5
- package/controls/FilterButton/FilterButton.js +11 -16
- package/controls/Gradient/Gradient.d.ts +8 -2
- package/controls/Gradient/Gradient.js +32 -6
- package/controls/Gradient/PresetGradients.d.ts +11 -4
- package/controls/Gradient/PresetGradients.js +7 -0
- package/controls/Icon/Icon.d.ts +7 -4
- package/controls/Icon/Icon.js +6 -5
- package/controls/Key/Key.d.ts +5 -2
- package/controls/Key/Key.js +36 -35
- package/controls/LinearChart/LinearChart.d.ts +4 -1
- package/controls/LinearChart/LinearChart.js +3 -2
- package/controls/ListView/ColumnsManager/ColumnsManager.js +1 -1
- package/controls/ListView/ListView.d.ts +2 -1
- package/controls/ListView/ListView.js +6 -5
- package/controls/ListView/NoData.d.ts +4 -1
- package/controls/ListView/NoData.js +1 -0
- package/controls/ListView/{Body.d.ts → elements/Body.d.ts} +2 -2
- package/controls/ListView/{Body.js → elements/Body.js} +1 -1
- package/controls/ListView/elements/Ghost.d.ts +12 -0
- package/controls/ListView/{Ghost.js → elements/Ghost.js} +4 -3
- package/controls/ListView/{Header.d.ts → elements/Header.d.ts} +2 -2
- package/controls/ListView/{Header.js → elements/Header.js} +3 -14
- package/controls/ListView/{HeaderButton.d.ts → elements/HeaderButton.d.ts} +4 -1
- package/controls/ListView/{HeaderButton.js → elements/HeaderButton.js} +1 -1
- package/controls/ListView/{HeaderCell.d.ts → elements/HeaderCell.d.ts} +7 -4
- package/controls/ListView/{HeaderCell.js → elements/HeaderCell.js} +5 -3
- package/controls/ListView/{SortButton.d.ts → elements/SortButton.d.ts} +1 -1
- package/controls/ListView/elements/SortButton.js +27 -0
- package/controls/ListView/{Table.d.ts → elements/Table.d.ts} +6 -3
- package/controls/ListView/{Table.js → elements/Table.js} +5 -4
- package/controls/ListView/{Total.d.ts → elements/Total.d.ts} +5 -1
- package/controls/ListView/{Total.js → elements/Total.js} +2 -1
- package/controls/Mouse/Mouse.d.ts +8 -3
- package/controls/Mouse/Mouse.js +21 -7
- package/controls/PrimaryButton/PrimaryButton.d.ts +6 -2
- package/controls/PrimaryButton/PrimaryButton.js +14 -9
- package/controls/Progress/Progress.d.ts +22 -6
- package/controls/Progress/Progress.js +38 -7
- package/controls/SecondaryButton/SecondaryButton.d.ts +12 -5
- package/controls/SecondaryButton/SecondaryButton.js +29 -19
- package/controls/TabBar/Tab.js +1 -1
- package/controls/TabBar/TabBar.d.ts +15 -4
- package/controls/TabBar/TabBar.js +105 -10
- package/controls/TabBar/Underliner.js +2 -1
- package/controls/TertiaryButton/TertiaryButton.d.ts +4 -1
- package/controls/TertiaryButton/TertiaryButton.js +3 -8
- package/controls/View/EllipsizedContent.d.ts +4 -1
- package/controls/View/EllipsizedContent.js +14 -1
- package/controls/View/ScrollingContent.d.ts +4 -1
- package/controls/View/ScrollingContent.js +14 -1
- package/controls/View/View.d.ts +6 -1
- package/controls/View/View.js +5 -4
- package/formatters/DateTime/DateTime.d.ts +46 -8
- package/formatters/DateTime/DateTime.js +14 -10
- package/formatters/DateTime/elements/Custom.d.ts +6 -17
- package/formatters/DateTime/elements/Custom.js +1 -0
- package/formatters/DateTime/elements/DistanceDate.d.ts +14 -0
- package/formatters/DateTime/elements/{Distance.js → DistanceDate.js} +1 -0
- package/formatters/DateTime/elements/LongDate.d.ts +23 -13
- package/formatters/DateTime/elements/LongDate.js +31 -5
- package/formatters/DateTime/elements/LongDateTime.d.ts +29 -13
- package/formatters/DateTime/elements/LongDateTime.js +28 -1
- package/formatters/DateTime/elements/LongTime.d.ts +25 -13
- package/formatters/DateTime/elements/LongTime.js +23 -1
- package/formatters/DateTime/elements/ShortDate.d.ts +27 -13
- package/formatters/DateTime/elements/ShortDate.js +28 -1
- package/formatters/DateTime/elements/ShortDateTime.d.ts +27 -13
- package/formatters/DateTime/elements/ShortDateTime.js +28 -1
- package/formatters/DateTime/elements/ShortTime.d.ts +13 -12
- package/formatters/DateTime/elements/ShortTime.js +19 -5
- package/formatters/DateTime/elements/index.d.ts +8 -0
- package/formatters/DateTime/elements/index.js +8 -0
- package/formatters/Filesize/Filesize.d.ts +23 -14
- package/formatters/Filesize/Filesize.js +33 -42
- package/formatters/GIS/Latitude.d.ts +11 -5
- package/formatters/GIS/Latitude.js +26 -3
- package/formatters/GIS/Longitude.d.ts +9 -5
- package/formatters/GIS/Longitude.js +24 -3
- package/formatters/Highlight/Highlight.d.ts +21 -6
- package/formatters/Highlight/Highlight.js +37 -19
- package/formatters/Human/Human.d.ts +18 -7
- package/formatters/Human/Human.js +17 -25
- package/formatters/Number/Number.d.ts +10 -2
- package/formatters/Number/Number.js +13 -7
- package/helper/DMS.d.ts +44 -6
- package/helper/DMS.js +86 -24
- package/package.json +1 -1
- package/controls/Dropzone/Dropbox.d.ts +0 -19
- package/controls/Dropzone/Dropbox.js +0 -47
- package/controls/ListView/Ghost.d.ts +0 -9
- package/controls/ListView/SortButton.js +0 -26
- package/formatters/DateTime/elements/Distance.d.ts +0 -24
- package/formatters/GIS/toDMS.d.ts +0 -2
- package/formatters/GIS/toDMS.js +0 -16
- /package/controls/ListView/{sortItems.d.ts → elements/sortItems.d.ts} +0 -0
- /package/controls/ListView/{sortItems.js → elements/sortItems.js} +0 -0
|
@@ -1,10 +1,37 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { format } from 'date-fns';
|
|
3
3
|
import { toDate } from './toDate';
|
|
4
|
+
/**
|
|
5
|
+
* `ShortDate` formats a date value into a short date string,
|
|
6
|
+
* using the format `dd-MM-yyyy` (e.g., `28-05-2025`).
|
|
7
|
+
*
|
|
8
|
+
* It shows a tooltip with the full date in a long, human-readable format,
|
|
9
|
+
* e.g., `"Wednesday, 28 May 2025"`.
|
|
10
|
+
*
|
|
11
|
+
* Accepts a `Date` object or a date string as `value`. Returns `null` if input
|
|
12
|
+
* is `null` or invalid.
|
|
13
|
+
*
|
|
14
|
+
* Optionally supports a `locale` prop that affects the date formatting and tooltip.
|
|
15
|
+
*
|
|
16
|
+
* The date is wrapped in a semantic `<time>` element with a machine-readable
|
|
17
|
+
* `dateTime` attribute.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <ShortDate value={new Date()} />
|
|
22
|
+
* <ShortDate value="2025-05-28" locale={someLocale} />
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
4
25
|
var ShortDate = function (props) {
|
|
5
26
|
if (props.value == null)
|
|
6
27
|
return null;
|
|
7
28
|
var date = toDate(props.value);
|
|
8
|
-
|
|
29
|
+
if (isNaN(date.getTime()))
|
|
30
|
+
return null;
|
|
31
|
+
var longDateFormat = 'eeee, d MMMM yyyy';
|
|
32
|
+
var shortDateFormat = 'dd-MM-yyyy';
|
|
33
|
+
var localeOption = props.locale ? { locale: props.locale } : {};
|
|
34
|
+
return (React.createElement("time", { dateTime: date.toISOString(), title: format(date, longDateFormat, localeOption) }, format(date, shortDateFormat, localeOption)));
|
|
9
35
|
};
|
|
36
|
+
ShortDate.displayName = "DateTime.ShortDate";
|
|
10
37
|
export { ShortDate };
|
|
@@ -1,14 +1,28 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
import { IDateTimeProps } from '../DateTime';
|
|
3
|
+
/**
|
|
4
|
+
* `ShortDateTime` formats a date/time value as a short date and time string,
|
|
5
|
+
* using the format `dd-MM-yyyy HH:mm:ss` (e.g., `28-05-2025 14:30:45`).
|
|
6
|
+
*
|
|
7
|
+
* It displays a tooltip showing the full date/time in a long, human-readable format,
|
|
8
|
+
* e.g., `"Wednesday, 28 May 2025 14:30:45"`.
|
|
9
|
+
*
|
|
10
|
+
* Accepts a `Date` object or a date string as `value`. Returns `null` if input
|
|
11
|
+
* is `null` or invalid.
|
|
12
|
+
*
|
|
13
|
+
* Optionally supports a `locale` prop that affects the formatting and tooltip.
|
|
14
|
+
*
|
|
15
|
+
* The output is wrapped in a semantic `<time>` element with a machine-readable
|
|
16
|
+
* `dateTime` attribute.
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```tsx
|
|
20
|
+
* <ShortDateTime value={new Date()} />
|
|
21
|
+
* <ShortDateTime value="2025-05-28T14:30:45" locale={someLocale} />
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
declare const ShortDateTime: {
|
|
25
|
+
(props: IDateTimeProps): React.JSX.Element;
|
|
26
|
+
displayName: string;
|
|
27
|
+
};
|
|
28
|
+
export { ShortDateTime };
|
|
@@ -1,10 +1,37 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { format } from 'date-fns';
|
|
3
3
|
import { toDate } from './toDate';
|
|
4
|
+
/**
|
|
5
|
+
* `ShortDateTime` formats a date/time value as a short date and time string,
|
|
6
|
+
* using the format `dd-MM-yyyy HH:mm:ss` (e.g., `28-05-2025 14:30:45`).
|
|
7
|
+
*
|
|
8
|
+
* It displays a tooltip showing the full date/time in a long, human-readable format,
|
|
9
|
+
* e.g., `"Wednesday, 28 May 2025 14:30:45"`.
|
|
10
|
+
*
|
|
11
|
+
* Accepts a `Date` object or a date string as `value`. Returns `null` if input
|
|
12
|
+
* is `null` or invalid.
|
|
13
|
+
*
|
|
14
|
+
* Optionally supports a `locale` prop that affects the formatting and tooltip.
|
|
15
|
+
*
|
|
16
|
+
* The output is wrapped in a semantic `<time>` element with a machine-readable
|
|
17
|
+
* `dateTime` attribute.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```tsx
|
|
21
|
+
* <ShortDateTime value={new Date()} />
|
|
22
|
+
* <ShortDateTime value="2025-05-28T14:30:45" locale={someLocale} />
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
4
25
|
var ShortDateTime = function (props) {
|
|
5
26
|
if (props.value == null)
|
|
6
27
|
return null;
|
|
7
28
|
var date = toDate(props.value);
|
|
8
|
-
|
|
29
|
+
if (isNaN(date.getTime()))
|
|
30
|
+
return null;
|
|
31
|
+
var longDateTimeFormat = 'eeee, d MMMM yyyy HH:mm:ss';
|
|
32
|
+
var shortDateTimeFormat = 'dd-MM-yyyy HH:mm:ss';
|
|
33
|
+
var localeOption = props.locale ? { locale: props.locale } : {};
|
|
34
|
+
return (React.createElement("time", { dateTime: date.toISOString(), title: format(date, longDateTimeFormat, localeOption) }, format(date, shortDateTimeFormat, localeOption)));
|
|
9
35
|
};
|
|
36
|
+
ShortDateTime.displayName = "DateTime.ShortDateTime";
|
|
10
37
|
export { ShortDateTime };
|
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
interface
|
|
4
|
-
/**
|
|
5
|
-
* Time to format.
|
|
6
|
-
*/
|
|
7
|
-
value: Date | string;
|
|
8
|
-
/**
|
|
9
|
-
* Optional locale.
|
|
10
|
-
*/
|
|
11
|
-
locale?: Locale;
|
|
2
|
+
import { IDateTimeProps } from '../DateTime';
|
|
3
|
+
interface IShortTimeProps extends IDateTimeProps {
|
|
12
4
|
/**
|
|
13
5
|
* Seconds are shown if set.
|
|
14
6
|
*/
|
|
15
7
|
seconds?: boolean;
|
|
16
8
|
}
|
|
17
|
-
|
|
18
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Formats a time value to a short string (HH:mm or HH:mm:ss).
|
|
11
|
+
* Supports optional locale and seconds display.
|
|
12
|
+
*
|
|
13
|
+
* ```tsx
|
|
14
|
+
* <ShortTime value={new Date()} />
|
|
15
|
+
* <ShortTime value="2023-05-28T14:30:00" seconds locale={someLocale} />
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
declare const ShortTime: React.MemoExoticComponent<({ value, locale, seconds }: IShortTimeProps) => React.JSX.Element>;
|
|
19
|
+
export { ShortTime, IShortTimeProps };
|
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { format } from 'date-fns';
|
|
3
3
|
import { toDate } from './toDate';
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Formats a time value to a short string (HH:mm or HH:mm:ss).
|
|
6
|
+
* Supports optional locale and seconds display.
|
|
7
|
+
*
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <ShortTime value={new Date()} />
|
|
10
|
+
* <ShortTime value="2023-05-28T14:30:00" seconds locale={someLocale} />
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
var ShortTime = React.memo(function (_a) {
|
|
14
|
+
var value = _a.value, locale = _a.locale, _b = _a.seconds, seconds = _b === void 0 ? false : _b;
|
|
15
|
+
if (value == null)
|
|
6
16
|
return null;
|
|
7
|
-
var date = toDate(
|
|
8
|
-
|
|
9
|
-
|
|
17
|
+
var date = toDate(value);
|
|
18
|
+
if (isNaN(date.getTime()))
|
|
19
|
+
return null; // handle invalid dates gracefully
|
|
20
|
+
var formatString = seconds ? 'HH:mm:ss' : 'HH:mm';
|
|
21
|
+
return (React.createElement("span", null, format(date, formatString, { locale: locale })));
|
|
22
|
+
});
|
|
23
|
+
ShortTime.displayName = "DateTime.ShortTime";
|
|
10
24
|
export { ShortTime };
|
|
@@ -1,29 +1,38 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
interface IProps {
|
|
3
|
-
/**
|
|
4
|
-
* File size in bytes
|
|
5
|
-
*/
|
|
3
|
+
/** File size in bytes */
|
|
6
4
|
value: number | string;
|
|
7
5
|
/**
|
|
8
|
-
* Unit type, `si` or `binary`
|
|
9
|
-
* @default si
|
|
6
|
+
* Unit type, `si` (base 1000) or `binary` (base 1024)
|
|
7
|
+
* @default 'si'
|
|
10
8
|
*/
|
|
11
9
|
unit?: 'si' | 'binary';
|
|
10
|
+
/**
|
|
11
|
+
* Optional locale string (e.g., 'en-US', 'fr-FR')
|
|
12
|
+
* @default 'en'
|
|
13
|
+
*/
|
|
14
|
+
locale?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Number of digits to show after decimal point
|
|
17
|
+
* @default 2
|
|
18
|
+
*/
|
|
19
|
+
decimals?: number;
|
|
12
20
|
}
|
|
13
21
|
/**
|
|
14
|
-
* Filesize
|
|
15
|
-
* string. If provided with a string, `Filesize` will convert it to a number
|
|
16
|
-
* first.
|
|
22
|
+
* `Filesize` displays a human-readable file size string from a number of bytes.
|
|
17
23
|
*
|
|
18
|
-
*
|
|
24
|
+
* Supports SI (base 1000) and binary (base 1024) unit systems.
|
|
19
25
|
*
|
|
20
|
-
*
|
|
21
|
-
* System of Units, where 1 kilobyte is 1,000 byes), or `binary (where 1
|
|
22
|
-
* kilobyte equals 1,024 bytes).
|
|
26
|
+
* Localized formatting via `Intl.NumberFormat`.
|
|
23
27
|
*
|
|
24
28
|
* ```tsx
|
|
25
|
-
* <Filesize value={10000} unit=
|
|
29
|
+
* <Filesize value={10000} unit="si" /> // "10.00 kB"
|
|
30
|
+
* <Filesize value={1048576} unit="binary" /> // "1.00 MiB"
|
|
31
|
+
* <Filesize value="2048000" locale="de-DE" /> // "2,05 MB"
|
|
26
32
|
* ```
|
|
27
33
|
*/
|
|
28
|
-
declare const Filesize:
|
|
34
|
+
declare const Filesize: {
|
|
35
|
+
({ value, unit, locale, decimals, }: IProps): string | React.JSX.Element;
|
|
36
|
+
displayName: string;
|
|
37
|
+
};
|
|
29
38
|
export { Filesize, IProps };
|
|
@@ -1,54 +1,45 @@
|
|
|
1
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
-
var t = {};
|
|
3
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
-
t[p] = s[p];
|
|
5
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
-
t[p[i]] = s[p[i]];
|
|
9
|
-
}
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
1
|
import * as React from 'react';
|
|
13
2
|
/**
|
|
14
|
-
* Filesize
|
|
15
|
-
* string. If provided with a string, `Filesize` will convert it to a number
|
|
16
|
-
* first.
|
|
3
|
+
* `Filesize` displays a human-readable file size string from a number of bytes.
|
|
17
4
|
*
|
|
18
|
-
*
|
|
5
|
+
* Supports SI (base 1000) and binary (base 1024) unit systems.
|
|
19
6
|
*
|
|
20
|
-
*
|
|
21
|
-
* System of Units, where 1 kilobyte is 1,000 byes), or `binary (where 1
|
|
22
|
-
* kilobyte equals 1,024 bytes).
|
|
7
|
+
* Localized formatting via `Intl.NumberFormat`.
|
|
23
8
|
*
|
|
24
9
|
* ```tsx
|
|
25
|
-
* <Filesize value={10000} unit=
|
|
10
|
+
* <Filesize value={10000} unit="si" /> // "10.00 kB"
|
|
11
|
+
* <Filesize value={1048576} unit="binary" /> // "1.00 MiB"
|
|
12
|
+
* <Filesize value="2048000" locale="de-DE" /> // "2,05 MB"
|
|
26
13
|
* ```
|
|
27
14
|
*/
|
|
28
15
|
var Filesize = function (_a) {
|
|
29
|
-
var _b = _a.unit, unit = _b === void 0 ?
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
var thresh = unit == 'si' ? 1000 : 1024;
|
|
35
|
-
if (Math.abs(bytes) < thresh) {
|
|
36
|
-
return bytes + ' B';
|
|
37
|
-
}
|
|
38
|
-
var units = unit == 'si'
|
|
39
|
-
? ['kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
|
|
40
|
-
: ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
|
|
41
|
-
var u = -1;
|
|
42
|
-
do {
|
|
43
|
-
bytes /= thresh;
|
|
44
|
-
++u;
|
|
45
|
-
} while (Math.abs(bytes) >= thresh && u < units.length - 1);
|
|
46
|
-
return bytes.toFixed(2) + ' ' + units[u];
|
|
47
|
-
};
|
|
48
|
-
if (props.value == null)
|
|
16
|
+
var value = _a.value, _b = _a.unit, unit = _b === void 0 ? 'si' : _b, _c = _a.locale, locale = _c === void 0 ? 'en' : _c, _d = _a.decimals, decimals = _d === void 0 ? 2 : _d;
|
|
17
|
+
if (value == null)
|
|
18
|
+
return null;
|
|
19
|
+
var num = typeof value === 'string' ? parseFloat(value) : value;
|
|
20
|
+
if (isNaN(num))
|
|
49
21
|
return null;
|
|
50
|
-
|
|
51
|
-
var
|
|
52
|
-
|
|
22
|
+
var threshold = unit === 'si' ? 1000 : 1024;
|
|
23
|
+
var units = unit === 'si'
|
|
24
|
+
? ['kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB']
|
|
25
|
+
: ['KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'];
|
|
26
|
+
if (Math.abs(num) < threshold) {
|
|
27
|
+
return "".concat(num, " B");
|
|
28
|
+
}
|
|
29
|
+
var size = num;
|
|
30
|
+
var u = -1;
|
|
31
|
+
do {
|
|
32
|
+
size /= threshold;
|
|
33
|
+
++u;
|
|
34
|
+
} while (Math.abs(size) >= threshold && u < units.length - 1);
|
|
35
|
+
var formatter = new Intl.NumberFormat(locale, {
|
|
36
|
+
maximumFractionDigits: decimals,
|
|
37
|
+
minimumFractionDigits: 0,
|
|
38
|
+
});
|
|
39
|
+
return (React.createElement(React.Fragment, null,
|
|
40
|
+
formatter.format(size),
|
|
41
|
+
" ",
|
|
42
|
+
units[u]));
|
|
53
43
|
};
|
|
44
|
+
Filesize.displayName = 'Filesize';
|
|
54
45
|
export { Filesize };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
interface
|
|
2
|
+
interface ILatitudeProps {
|
|
3
3
|
/**
|
|
4
4
|
* Value to format.
|
|
5
5
|
*/
|
|
@@ -8,16 +8,22 @@ interface IProps {
|
|
|
8
8
|
* String to show if formatting fails.
|
|
9
9
|
* @default "(no coordinates)"
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
defaultStr?: string;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Formats a fractional latitude value as degrees, minutes and seconds (as a string).
|
|
15
15
|
* If provided with a string, `Longitude` will convert it to a number first.
|
|
16
|
+
* Returns the fallback string if formatting fails or value is out of range.
|
|
17
|
+
*
|
|
18
|
+
* Latitude must be between -90 and 90 degrees.
|
|
16
19
|
*
|
|
17
20
|
* ```tsx
|
|
18
21
|
* <Latitude value={34.2216}/>
|
|
19
|
-
* <Latitude value={
|
|
22
|
+
* <Latitude value={null} defaultStr="Invalid latitude"/>
|
|
20
23
|
* ```
|
|
21
24
|
*/
|
|
22
|
-
declare const Latitude:
|
|
23
|
-
|
|
25
|
+
declare const Latitude: {
|
|
26
|
+
({ value, defaultStr, ...props }: ILatitudeProps): React.JSX.Element;
|
|
27
|
+
displayName: string;
|
|
28
|
+
};
|
|
29
|
+
export { Latitude, ILatitudeProps };
|
|
@@ -1,13 +1,36 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
13
|
+
import { DMS } from '../../helper/DMS';
|
|
3
14
|
/**
|
|
4
15
|
* Formats a fractional latitude value as degrees, minutes and seconds (as a string).
|
|
5
16
|
* If provided with a string, `Longitude` will convert it to a number first.
|
|
17
|
+
* Returns the fallback string if formatting fails or value is out of range.
|
|
18
|
+
*
|
|
19
|
+
* Latitude must be between -90 and 90 degrees.
|
|
6
20
|
*
|
|
7
21
|
* ```tsx
|
|
8
22
|
* <Latitude value={34.2216}/>
|
|
9
|
-
* <Latitude value={
|
|
23
|
+
* <Latitude value={null} defaultStr="Invalid latitude"/>
|
|
10
24
|
* ```
|
|
11
25
|
*/
|
|
12
|
-
var Latitude = function (
|
|
26
|
+
var Latitude = function (_a) {
|
|
27
|
+
var value = _a.value, _b = _a.defaultStr, defaultStr = _b === void 0 ? "(no coordinates)" : _b, props = __rest(_a, ["value", "defaultStr"]);
|
|
28
|
+
// Value and defaultStr and mostly stable. Memoize the formatted string to
|
|
29
|
+
// avoid unnecessary recalculations on every render.
|
|
30
|
+
var formatted = React.useMemo(function () {
|
|
31
|
+
return DMS.toDMSString(value, defaultStr, 90, "N", "S");
|
|
32
|
+
}, [value, defaultStr]);
|
|
33
|
+
return (React.createElement(React.Fragment, null, formatted));
|
|
34
|
+
};
|
|
35
|
+
Latitude.displayName = "Latitude";
|
|
13
36
|
export { Latitude };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
interface
|
|
2
|
+
interface ILongitudeProps {
|
|
3
3
|
/**
|
|
4
4
|
* Value to format.
|
|
5
5
|
*/
|
|
@@ -8,16 +8,20 @@ interface IProps {
|
|
|
8
8
|
* String to show if formatting fails.
|
|
9
9
|
* @default "(no coordinates)"
|
|
10
10
|
*/
|
|
11
|
-
|
|
11
|
+
defaultStr?: string;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Formats a fractional longitude value as degrees, minutes and seconds (as a string).
|
|
15
15
|
* If provided with a string, `Longitude` will convert it to a number first.
|
|
16
|
+
* Returns the fallback string if formatting fails or value is out of range.
|
|
16
17
|
*
|
|
17
18
|
* ```tsx
|
|
18
19
|
* <Longitude value={34.2216}/>
|
|
19
|
-
* <Longitude value={
|
|
20
|
+
* <Longitude value={null} defaultStr="Invalid longitude"/>
|
|
20
21
|
* ```*
|
|
21
22
|
*/
|
|
22
|
-
declare const Longitude:
|
|
23
|
-
|
|
23
|
+
declare const Longitude: {
|
|
24
|
+
({ value, defaultStr, ...props }: ILongitudeProps): React.JSX.Element;
|
|
25
|
+
displayName: string;
|
|
26
|
+
};
|
|
27
|
+
export { Longitude, ILongitudeProps };
|
|
@@ -1,13 +1,34 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
1
12
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
13
|
+
import { DMS } from '../../helper/DMS';
|
|
3
14
|
/**
|
|
4
15
|
* Formats a fractional longitude value as degrees, minutes and seconds (as a string).
|
|
5
16
|
* If provided with a string, `Longitude` will convert it to a number first.
|
|
17
|
+
* Returns the fallback string if formatting fails or value is out of range.
|
|
6
18
|
*
|
|
7
19
|
* ```tsx
|
|
8
20
|
* <Longitude value={34.2216}/>
|
|
9
|
-
* <Longitude value={
|
|
21
|
+
* <Longitude value={null} defaultStr="Invalid longitude"/>
|
|
10
22
|
* ```*
|
|
11
23
|
*/
|
|
12
|
-
var Longitude = function (
|
|
24
|
+
var Longitude = function (_a) {
|
|
25
|
+
var value = _a.value, _b = _a.defaultStr, defaultStr = _b === void 0 ? "(no coordinates)" : _b, props = __rest(_a, ["value", "defaultStr"]);
|
|
26
|
+
// Value and defaultStr and mostly stable. Memoize the formatted string to
|
|
27
|
+
// avoid unnecessary recalculations on every render.
|
|
28
|
+
var formatted = React.useMemo(function () {
|
|
29
|
+
return DMS.toDMSString(value, defaultStr, 180, "E", "W");
|
|
30
|
+
}, [value, defaultStr]);
|
|
31
|
+
return (React.createElement(React.Fragment, null, formatted));
|
|
32
|
+
};
|
|
33
|
+
Longitude.displayName = "Longitude";
|
|
13
34
|
export { Longitude };
|
|
@@ -1,22 +1,37 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
interface IProps {
|
|
3
|
-
/** @ignore */
|
|
4
|
-
className?: string;
|
|
5
3
|
value: string;
|
|
6
4
|
/**
|
|
7
|
-
* String to search for. Only the first occurrence is highlighted
|
|
5
|
+
* String to search for. Only the first occurrence is highlighted, unless
|
|
6
|
+
* `matchAll` is set.
|
|
8
7
|
* Matching is case-insensitive.
|
|
9
8
|
*/
|
|
10
9
|
q: string;
|
|
10
|
+
/**
|
|
11
|
+
* Whether the match should be case-sensitive.
|
|
12
|
+
* @default false
|
|
13
|
+
*/
|
|
14
|
+
caseSensitive?: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Highlight all occurrences, not just the first.
|
|
17
|
+
*/
|
|
18
|
+
matchAll?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Color used for the highlight. If not provided, the theme's accent color
|
|
21
|
+
* is used.
|
|
22
|
+
*/
|
|
23
|
+
color?: string;
|
|
11
24
|
}
|
|
12
25
|
/**
|
|
13
26
|
* Given an input string and a search query, `Highlight` highlights the first
|
|
14
|
-
* occurrence (if any) of the search query and returns a
|
|
15
|
-
* `ReactNode`).
|
|
27
|
+
* occurrence or all occurrences (if any) of the search query and returns a
|
|
28
|
+
* styled string (as a `ReactNode`). By default, matching is case-insensitive,
|
|
29
|
+
* but this can be changed with the `caseSensitive` prop.
|
|
16
30
|
*
|
|
17
31
|
* ```tsx
|
|
18
32
|
* <Highlight value="Hello, world" q="hello"/>
|
|
33
|
+
* <Highlight value="Hello, world" q="Hello" caseSensitive />
|
|
19
34
|
* ```
|
|
20
35
|
*/
|
|
21
|
-
declare const Highlight: (
|
|
36
|
+
declare const Highlight: ({ value, q, caseSensitive, matchAll, color }: IProps) => React.ReactNode;
|
|
22
37
|
export { Highlight };
|
|
@@ -2,31 +2,49 @@ import * as React from 'react';
|
|
|
2
2
|
import { useTheme } from 'styled-components';
|
|
3
3
|
/**
|
|
4
4
|
* Given an input string and a search query, `Highlight` highlights the first
|
|
5
|
-
* occurrence (if any) of the search query and returns a
|
|
6
|
-
* `ReactNode`).
|
|
5
|
+
* occurrence or all occurrences (if any) of the search query and returns a
|
|
6
|
+
* styled string (as a `ReactNode`). By default, matching is case-insensitive,
|
|
7
|
+
* but this can be changed with the `caseSensitive` prop.
|
|
7
8
|
*
|
|
8
9
|
* ```tsx
|
|
9
10
|
* <Highlight value="Hello, world" q="hello"/>
|
|
11
|
+
* <Highlight value="Hello, world" q="Hello" caseSensitive />
|
|
10
12
|
* ```
|
|
11
13
|
*/
|
|
12
|
-
var Highlight = function (
|
|
14
|
+
var Highlight = function (_a) {
|
|
15
|
+
var _b;
|
|
16
|
+
var value = _a.value, q = _a.q, _c = _a.caseSensitive, caseSensitive = _c === void 0 ? false : _c, _d = _a.matchAll, matchAll = _d === void 0 ? false : _d, color = _a.color;
|
|
13
17
|
var theme = useTheme();
|
|
14
18
|
// Is there a search string? If not, do not highlight.
|
|
15
|
-
if (!
|
|
16
|
-
return
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
var
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
19
|
+
if (!q || !value)
|
|
20
|
+
return (React.createElement(React.Fragment, null, value));
|
|
21
|
+
var escapedQ = q.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&');
|
|
22
|
+
var flags = 'g' + (caseSensitive ? '' : 'i');
|
|
23
|
+
var regex = new RegExp(escapedQ, flags);
|
|
24
|
+
var matches = Array.from(value.matchAll(regex));
|
|
25
|
+
// If there are no matches, return the original value.
|
|
26
|
+
if (matches.length === 0)
|
|
27
|
+
return (React.createElement(React.Fragment, null, value));
|
|
28
|
+
var parts = [];
|
|
29
|
+
var lastIndex = 0;
|
|
30
|
+
for (var i = 0; i < matches.length; i++) {
|
|
31
|
+
var match = matches[i];
|
|
32
|
+
var index = (_b = match.index) !== null && _b !== void 0 ? _b : 0;
|
|
33
|
+
if (index > lastIndex) {
|
|
34
|
+
parts.push(value.slice(lastIndex, index));
|
|
35
|
+
}
|
|
36
|
+
parts.push(
|
|
37
|
+
// Styling is done with inline styles so as not to generate too many
|
|
38
|
+
// styled-components classes.
|
|
39
|
+
React.createElement("mark", { key: "".concat(index, "-").concat(i), style: { backgroundColor: color !== null && color !== void 0 ? color : theme.colors.accent } }, value.slice(index, index + match[0].length)));
|
|
40
|
+
lastIndex = index + match[0].length;
|
|
41
|
+
// Unless matchAll, stop processing after the first match.
|
|
42
|
+
if (!matchAll)
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
if (lastIndex < value.length) {
|
|
46
|
+
parts.push(value.slice(lastIndex));
|
|
47
|
+
}
|
|
48
|
+
return (React.createElement(React.Fragment, null, parts));
|
|
31
49
|
};
|
|
32
50
|
export { Highlight };
|
|
@@ -1,18 +1,29 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
interface IProps {
|
|
3
|
+
/** Input value to be humanized (e.g., 10000 → 10K) */
|
|
4
|
+
value: number | string;
|
|
3
5
|
/**
|
|
4
|
-
*
|
|
6
|
+
* Locale string (e.g., 'en-US', 'de-DE')
|
|
7
|
+
* @default 'en'
|
|
5
8
|
*/
|
|
6
|
-
|
|
9
|
+
locale?: string;
|
|
10
|
+
/**
|
|
11
|
+
* Number of decimal places to show (overrides default formatting)
|
|
12
|
+
* @default undefined
|
|
13
|
+
*/
|
|
14
|
+
decimals?: number;
|
|
7
15
|
}
|
|
8
16
|
/**
|
|
9
|
-
* `Human`
|
|
10
|
-
*
|
|
11
|
-
* E.g. `10000` => `10K`
|
|
17
|
+
* `Human` formats large numbers using `Intl.NumberFormat` for locale-aware
|
|
18
|
+
* output and optional compact display (e.g. "10K", "1.2M").
|
|
12
19
|
*
|
|
13
20
|
* ```tsx
|
|
14
|
-
* <Human value={
|
|
21
|
+
* <Human value={1200}/> // => "1.2K"
|
|
22
|
+
* <Human value={999999} locale="de-DE" /> // => "1 Mio."
|
|
15
23
|
* ```
|
|
16
24
|
*/
|
|
17
|
-
declare const Human:
|
|
25
|
+
declare const Human: {
|
|
26
|
+
({ value, locale, decimals }: IProps): React.JSX.Element;
|
|
27
|
+
displayName: string;
|
|
28
|
+
};
|
|
18
29
|
export { Human, IProps };
|