@longline/aqua-ui 1.0.186 → 1.0.187
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/Form/Validation.d.ts +1 -1
- package/containers/Form/Validation.js +6 -7
- package/formatters/DateTime/DateTime.d.ts +21 -41
- package/formatters/DateTime/DateTime.js +13 -13
- package/formatters/DateTime/elements/DistanceDate.d.ts +13 -12
- package/formatters/DateTime/elements/DistanceDate.js +70 -38
- package/formatters/DateTime/elements/LongDate.d.ts +4 -7
- package/formatters/DateTime/elements/LongDate.js +13 -10
- package/formatters/DateTime/elements/LongDateTime.d.ts +4 -7
- package/formatters/DateTime/elements/LongDateTime.js +19 -10
- package/formatters/DateTime/elements/LongTime.d.ts +3 -6
- package/formatters/DateTime/elements/LongTime.js +14 -8
- package/formatters/DateTime/elements/ShortDate.d.ts +3 -6
- package/formatters/DateTime/elements/ShortDate.js +23 -11
- package/formatters/DateTime/elements/ShortDateTime.d.ts +3 -6
- package/formatters/DateTime/elements/ShortDateTime.js +35 -11
- package/formatters/DateTime/elements/ShortTime.d.ts +13 -12
- package/formatters/DateTime/elements/ShortTime.js +20 -9
- package/formatters/DateTime/elements/index.d.ts +0 -1
- package/formatters/DateTime/elements/index.js +0 -1
- package/inputs/DateInput/DateInput.js +1 -2
- package/inputs/Dropdown/Dropdown.d.ts +1 -1
- package/inputs/Dropdown/index.d.ts +1 -1
- package/inputs/Input/Input.d.ts +0 -4
- package/package.json +66 -70
- package/formatters/DateTime/elements/Custom.d.ts +0 -7
- package/formatters/DateTime/elements/Custom.js +0 -23
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { isAfter, isBefore, parseISO } from "date-fns";
|
|
2
1
|
var Validation = /** @class */ (function () {
|
|
3
2
|
function Validation() {
|
|
4
3
|
}
|
|
@@ -124,7 +123,7 @@ var Validation = /** @class */ (function () {
|
|
|
124
123
|
return regex.test(String(value).toLowerCase());
|
|
125
124
|
};
|
|
126
125
|
/**
|
|
127
|
-
* Verify that value is before today.
|
|
126
|
+
* Verify that value is before or equal to today.
|
|
128
127
|
*/
|
|
129
128
|
Validation.validateNofuture = function (value) {
|
|
130
129
|
if (!value)
|
|
@@ -134,7 +133,7 @@ var Validation = /** @class */ (function () {
|
|
|
134
133
|
// Abort if not a valid date:
|
|
135
134
|
if (isNaN(d.getDate()))
|
|
136
135
|
return false;
|
|
137
|
-
return
|
|
136
|
+
return d.getTime() <= otherDate.getTime();
|
|
138
137
|
};
|
|
139
138
|
/**
|
|
140
139
|
* Verify that value is before date.
|
|
@@ -142,12 +141,12 @@ var Validation = /** @class */ (function () {
|
|
|
142
141
|
Validation.validateBefore = function (value, otherDateStr) {
|
|
143
142
|
if (!value)
|
|
144
143
|
return true;
|
|
145
|
-
var otherDate =
|
|
144
|
+
var otherDate = new Date(otherDateStr);
|
|
146
145
|
var d = new Date(value);
|
|
147
146
|
// Abort if not a valid date:
|
|
148
147
|
if (isNaN(d.getDate()))
|
|
149
148
|
return false;
|
|
150
|
-
return
|
|
149
|
+
return d.getTime() < otherDate.getTime();
|
|
151
150
|
};
|
|
152
151
|
/**
|
|
153
152
|
* Verify that value is after date.
|
|
@@ -155,12 +154,12 @@ var Validation = /** @class */ (function () {
|
|
|
155
154
|
Validation.validateAfter = function (value, otherDateStr) {
|
|
156
155
|
if (!value)
|
|
157
156
|
return true;
|
|
158
|
-
var otherDate =
|
|
157
|
+
var otherDate = new Date(otherDateStr);
|
|
159
158
|
var d = new Date(value);
|
|
160
159
|
// Abort if not a valid date:
|
|
161
160
|
if (isNaN(d.getDate()))
|
|
162
161
|
return false;
|
|
163
|
-
return
|
|
162
|
+
return d.getTime() > otherDate.getTime();
|
|
164
163
|
};
|
|
165
164
|
Validation.getValidation = function (value, rules) {
|
|
166
165
|
if (!rules)
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
type TType = 'longdate' | 'shortdate' | 'longdatetime' | 'shortdatetime' | 'longtime' | 'shorttime' | 'fuzzydistance' | 'strictdistance' | 'custom';
|
|
2
|
+
type TType = 'longdate' | 'shortdate' | 'longdatetime' | 'shortdatetime' | 'longtime' | 'shorttime' | 'distance' | 'custom';
|
|
4
3
|
interface IDateTimeProps {
|
|
5
4
|
/**
|
|
6
5
|
* Input date. This can either be a `Date` or a `string`.
|
|
7
6
|
*/
|
|
8
7
|
value: string | Date;
|
|
9
8
|
/**
|
|
10
|
-
* Optional `Locale`.
|
|
9
|
+
* Optional `Locale`.
|
|
11
10
|
*/
|
|
12
|
-
locale?:
|
|
11
|
+
locale?: string;
|
|
13
12
|
}
|
|
14
13
|
interface IDateTimeFormatProps {
|
|
15
14
|
/**
|
|
@@ -34,50 +33,31 @@ interface IProps extends IDateTimeProps, IDateTimeFormatProps, IAnimateProps {
|
|
|
34
33
|
/**
|
|
35
34
|
* `DateTime` formats a date or time to a string.
|
|
36
35
|
*
|
|
37
|
-
* If the input date fails to parse (in case of a `string`), or isn't a valid
|
|
38
|
-
* then the formatter falls back to today's
|
|
36
|
+
* If the input date fails to parse (in case of a `string`), or isn't a valid
|
|
37
|
+
* date (in case of a `Date`), then the formatter falls back to today's
|
|
38
|
+
* date/time. An input of `null` is not rendered at all.
|
|
39
39
|
*
|
|
40
|
-
* If `animated` is set, then date distances will be updated every second
|
|
41
|
-
*
|
|
42
|
-
* Optionally, a `locale` is supported:
|
|
40
|
+
* If `animated` is set, then date distances will be updated every second
|
|
41
|
+
* (only applicable to `fuzzydistance` and `strictdistance` types).
|
|
43
42
|
*
|
|
44
43
|
* ```tsx
|
|
45
|
-
*
|
|
44
|
+
* <DateTime type='longdate' value='1992-03-08' locale="es"/>
|
|
45
|
+
* ```
|
|
46
46
|
*
|
|
47
|
-
*
|
|
47
|
+
* You can also use static members of `DateTime` directly:
|
|
48
|
+
* ```tsx
|
|
49
|
+
* <DateTIme.LongDate value='1992-03-08'/>
|
|
48
50
|
* ```
|
|
49
51
|
*/
|
|
50
52
|
declare const DateTime: {
|
|
51
|
-
({ type,
|
|
53
|
+
({ type, ...props }: IProps): React.JSX.Element;
|
|
52
54
|
displayName: string;
|
|
53
|
-
LongDate: {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
};
|
|
61
|
-
LongDateTime: {
|
|
62
|
-
(props: IDateTimeProps): React.JSX.Element;
|
|
63
|
-
displayName: string;
|
|
64
|
-
};
|
|
65
|
-
ShortDateTime: {
|
|
66
|
-
(props: IDateTimeProps): React.JSX.Element;
|
|
67
|
-
displayName: string;
|
|
68
|
-
};
|
|
69
|
-
LongTime: {
|
|
70
|
-
(props: IDateTimeProps): React.JSX.Element;
|
|
71
|
-
displayName: string;
|
|
72
|
-
};
|
|
73
|
-
ShortTime: React.MemoExoticComponent<({ value, locale, seconds }: import("./elements").IShortTimeProps) => React.JSX.Element>;
|
|
74
|
-
DistanceDate: {
|
|
75
|
-
({ animated, ...props }: import("./elements").IDistanceDateProps): React.JSX.Element;
|
|
76
|
-
displayName: string;
|
|
77
|
-
};
|
|
78
|
-
Custom: {
|
|
79
|
-
({ format, ...props }: IDateTimeProps & IDateTimeFormatProps): React.JSX.Element;
|
|
80
|
-
displayName: string;
|
|
81
|
-
};
|
|
55
|
+
LongDate: React.MemoExoticComponent<({ value, locale }: IDateTimeProps) => React.JSX.Element>;
|
|
56
|
+
ShortDate: React.MemoExoticComponent<({ value, locale }: IDateTimeProps) => React.JSX.Element>;
|
|
57
|
+
LongDateTime: React.MemoExoticComponent<({ value, locale }: IDateTimeProps) => React.JSX.Element>;
|
|
58
|
+
ShortDateTime: React.MemoExoticComponent<({ value, locale }: IDateTimeProps) => React.JSX.Element>;
|
|
59
|
+
LongTime: React.MemoExoticComponent<({ value, locale }: IDateTimeProps) => React.JSX.Element>;
|
|
60
|
+
ShortTime: React.MemoExoticComponent<({ value, locale }: IDateTimeProps) => React.JSX.Element>;
|
|
61
|
+
DistanceDate: React.MemoExoticComponent<({ value, animated, locale }: IDateTimeProps & IAnimateProps) => React.JSX.Element>;
|
|
82
62
|
};
|
|
83
63
|
export { DateTime, IDateTimeProps, IDateTimeFormatProps, IAnimateProps, IProps };
|
|
@@ -21,25 +21,28 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
21
21
|
return t;
|
|
22
22
|
};
|
|
23
23
|
import * as React from 'react';
|
|
24
|
-
import {
|
|
24
|
+
import { DistanceDate, LongDate, LongDateTime, LongTime, ShortDate, ShortDateTime, ShortTime } from './elements';
|
|
25
25
|
/**
|
|
26
26
|
* `DateTime` formats a date or time to a string.
|
|
27
27
|
*
|
|
28
|
-
* If the input date fails to parse (in case of a `string`), or isn't a valid
|
|
29
|
-
* then the formatter falls back to today's
|
|
28
|
+
* If the input date fails to parse (in case of a `string`), or isn't a valid
|
|
29
|
+
* date (in case of a `Date`), then the formatter falls back to today's
|
|
30
|
+
* date/time. An input of `null` is not rendered at all.
|
|
30
31
|
*
|
|
31
|
-
* If `animated` is set, then date distances will be updated every second
|
|
32
|
-
*
|
|
33
|
-
* Optionally, a `locale` is supported:
|
|
32
|
+
* If `animated` is set, then date distances will be updated every second
|
|
33
|
+
* (only applicable to `fuzzydistance` and `strictdistance` types).
|
|
34
34
|
*
|
|
35
35
|
* ```tsx
|
|
36
|
-
*
|
|
36
|
+
* <DateTime type='longdate' value='1992-03-08' locale="es"/>
|
|
37
|
+
* ```
|
|
37
38
|
*
|
|
38
|
-
*
|
|
39
|
+
* You can also use static members of `DateTime` directly:
|
|
40
|
+
* ```tsx
|
|
41
|
+
* <DateTIme.LongDate value='1992-03-08'/>
|
|
39
42
|
* ```
|
|
40
43
|
*/
|
|
41
44
|
var DateTime = function (_a) {
|
|
42
|
-
var _b = _a.type, type = _b === void 0 ? 'longdate' : _b,
|
|
45
|
+
var _b = _a.type, type = _b === void 0 ? 'longdate' : _b, props = __rest(_a, ["type"]);
|
|
43
46
|
switch (type) {
|
|
44
47
|
case 'longdate': return React.createElement(LongDate, __assign({}, props));
|
|
45
48
|
case 'shortdate': return React.createElement(ShortDate, __assign({}, props));
|
|
@@ -47,9 +50,7 @@ var DateTime = function (_a) {
|
|
|
47
50
|
case 'shortdatetime': return React.createElement(ShortDateTime, __assign({}, props));
|
|
48
51
|
case 'longtime': return React.createElement(LongTime, __assign({}, props));
|
|
49
52
|
case 'shorttime': return React.createElement(ShortTime, __assign({}, props));
|
|
50
|
-
case '
|
|
51
|
-
case 'strictdistance': return React.createElement(DistanceDate, __assign({ strict: true }, props));
|
|
52
|
-
case 'custom': return React.createElement(Custom, __assign({}, props));
|
|
53
|
+
case 'distance': return React.createElement(DistanceDate, __assign({}, props));
|
|
53
54
|
default:
|
|
54
55
|
return null;
|
|
55
56
|
}
|
|
@@ -64,5 +65,4 @@ DateTime.ShortDateTime = ShortDateTime;
|
|
|
64
65
|
DateTime.LongTime = LongTime;
|
|
65
66
|
DateTime.ShortTime = ShortTime;
|
|
66
67
|
DateTime.DistanceDate = DistanceDate;
|
|
67
|
-
DateTime.Custom = Custom;
|
|
68
68
|
export { DateTime };
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { IAnimateProps, IDateTimeProps } from '../DateTime';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
/**
|
|
4
|
+
* `DateTime.Distance` formats a date relative to "now", e.g.:
|
|
5
|
+
* "5 minutes ago", "in 2 days".
|
|
6
|
+
*
|
|
7
|
+
* If `animated` is true, the value updates every second.
|
|
8
|
+
*
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <DateTime.Distance value="2024-05-28T14:30:00Z" />
|
|
11
|
+
* <DateTime.Distance value={someDate} animated strict locale={fr} />
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
declare const DistanceDate: React.MemoExoticComponent<({ value, animated, locale }: IDateTimeProps & IAnimateProps) => React.JSX.Element>;
|
|
15
|
+
export { DistanceDate };
|
|
@@ -1,46 +1,78 @@
|
|
|
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
|
-
import { format, formatDistanceToNow, formatDistanceToNowStrict } from 'date-fns';
|
|
14
2
|
import { toDate } from './toDate';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
3
|
+
/**
|
|
4
|
+
* `DateTime.Distance` formats a date relative to "now", e.g.:
|
|
5
|
+
* "5 minutes ago", "in 2 days".
|
|
6
|
+
*
|
|
7
|
+
* If `animated` is true, the value updates every second.
|
|
8
|
+
*
|
|
9
|
+
* ```tsx
|
|
10
|
+
* <DateTime.Distance value="2024-05-28T14:30:00Z" />
|
|
11
|
+
* <DateTime.Distance value={someDate} animated strict locale={fr} />
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
var DistanceDate = React.memo(function (_a) {
|
|
15
|
+
var value = _a.value, _b = _a.animated, animated = _b === void 0 ? false : _b, locale = _a.locale;
|
|
16
|
+
var intervalRef = React.useRef(null);
|
|
17
|
+
var _c = React.useState(0), setTick = _c[1]; // trigger updates
|
|
18
|
+
var update = React.useCallback(function () {
|
|
19
|
+
setTick(Date.now());
|
|
20
|
+
}, []);
|
|
21
|
+
// Set up interval for animated updates
|
|
20
22
|
React.useEffect(function () {
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
interval.current = window.setInterval(update, 1000);
|
|
23
|
+
if (animated) {
|
|
24
|
+
intervalRef.current = window.setInterval(update, 1000);
|
|
25
|
+
}
|
|
25
26
|
return function () {
|
|
26
|
-
if (
|
|
27
|
-
clearInterval(
|
|
27
|
+
if (intervalRef.current != null) {
|
|
28
|
+
clearInterval(intervalRef.current);
|
|
29
|
+
intervalRef.current = null;
|
|
30
|
+
}
|
|
28
31
|
};
|
|
29
|
-
}, [animated]);
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if (props.value == null)
|
|
32
|
+
}, [animated, update]);
|
|
33
|
+
if (value == null)
|
|
34
|
+
return null;
|
|
35
|
+
var date = toDate(value);
|
|
36
|
+
if (isNaN(date.getTime()))
|
|
35
37
|
return null;
|
|
36
|
-
var
|
|
37
|
-
var
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
38
|
+
var now = new Date();
|
|
39
|
+
var diff = date.getTime() - now.getTime(); // ms difference
|
|
40
|
+
var absDiff = Math.abs(diff);
|
|
41
|
+
// Determine time unit and value
|
|
42
|
+
var unit = 'second';
|
|
43
|
+
var valueToFormat = Math.round(diff / 1000);
|
|
44
|
+
if (absDiff >= 1000 * 60 * 60 * 24 * 365) {
|
|
45
|
+
unit = 'year';
|
|
46
|
+
valueToFormat = Math.round(diff / (1000 * 60 * 60 * 24 * 365));
|
|
47
|
+
}
|
|
48
|
+
else if (absDiff >= 1000 * 60 * 60 * 24 * 30) {
|
|
49
|
+
unit = 'month';
|
|
50
|
+
valueToFormat = Math.round(diff / (1000 * 60 * 60 * 24 * 30));
|
|
51
|
+
}
|
|
52
|
+
else if (absDiff >= 1000 * 60 * 60 * 24) {
|
|
53
|
+
unit = 'day';
|
|
54
|
+
valueToFormat = Math.round(diff / (1000 * 60 * 60 * 24));
|
|
55
|
+
}
|
|
56
|
+
else if (absDiff >= 1000 * 60 * 60) {
|
|
57
|
+
unit = 'hour';
|
|
58
|
+
valueToFormat = Math.round(diff / (1000 * 60 * 60));
|
|
59
|
+
}
|
|
60
|
+
else if (absDiff >= 1000 * 60) {
|
|
61
|
+
unit = 'minute';
|
|
62
|
+
valueToFormat = Math.round(diff / (1000 * 60));
|
|
63
|
+
}
|
|
64
|
+
var rtf = new Intl.RelativeTimeFormat(locale || undefined, { numeric: 'auto' });
|
|
65
|
+
var formatted = rtf.format(valueToFormat, unit);
|
|
66
|
+
var title = date.toLocaleString(locale || undefined, {
|
|
67
|
+
weekday: 'long',
|
|
68
|
+
year: 'numeric',
|
|
69
|
+
month: 'long',
|
|
70
|
+
day: 'numeric',
|
|
71
|
+
hour: '2-digit',
|
|
72
|
+
minute: '2-digit',
|
|
73
|
+
second: '2-digit',
|
|
74
|
+
});
|
|
75
|
+
return (React.createElement("time", { dateTime: date.toISOString(), title: title }, formatted));
|
|
76
|
+
});
|
|
45
77
|
DistanceDate.displayName = "DateTime.Distance";
|
|
46
78
|
export { DistanceDate };
|
|
@@ -9,19 +9,16 @@ import { IDateTimeProps } from '../DateTime';
|
|
|
9
9
|
* If the input is `null` or invalid, it returns `null` and renders nothing.
|
|
10
10
|
*
|
|
11
11
|
* Optionally, a `locale` can be provided to format the date in different
|
|
12
|
-
* languages and regional formats
|
|
12
|
+
* languages and regional formats.
|
|
13
13
|
*
|
|
14
14
|
* The output is wrapped in a `<time>` element with a machine-readable
|
|
15
15
|
* `dateTime` attribute.
|
|
16
16
|
*
|
|
17
17
|
* @example
|
|
18
18
|
* ```tsx
|
|
19
|
-
* <LongDate value={new Date()} />
|
|
20
|
-
* <LongDate value="2023-01-01" locale={es} />
|
|
19
|
+
* <DateTime.LongDate value={new Date()} />
|
|
20
|
+
* <DateTime.LongDate value="2023-01-01" locale={es} />
|
|
21
21
|
* ```
|
|
22
22
|
*/
|
|
23
|
-
declare const LongDate: {
|
|
24
|
-
({ value, locale }: IDateTimeProps): React.JSX.Element;
|
|
25
|
-
displayName: string;
|
|
26
|
-
};
|
|
23
|
+
declare const LongDate: React.MemoExoticComponent<({ value, locale }: IDateTimeProps) => React.JSX.Element>;
|
|
27
24
|
export { LongDate };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { format } from 'date-fns';
|
|
3
2
|
import { toDate } from './toDate';
|
|
4
3
|
/**
|
|
5
4
|
* `LongDate` formats a date value into a long date string, such as
|
|
@@ -10,28 +9,32 @@ import { toDate } from './toDate';
|
|
|
10
9
|
* If the input is `null` or invalid, it returns `null` and renders nothing.
|
|
11
10
|
*
|
|
12
11
|
* Optionally, a `locale` can be provided to format the date in different
|
|
13
|
-
* languages and regional formats
|
|
12
|
+
* languages and regional formats.
|
|
14
13
|
*
|
|
15
14
|
* The output is wrapped in a `<time>` element with a machine-readable
|
|
16
15
|
* `dateTime` attribute.
|
|
17
16
|
*
|
|
18
17
|
* @example
|
|
19
18
|
* ```tsx
|
|
20
|
-
* <LongDate value={new Date()} />
|
|
21
|
-
* <LongDate value="2023-01-01" locale={es} />
|
|
19
|
+
* <DateTime.LongDate value={new Date()} />
|
|
20
|
+
* <DateTime.LongDate value="2023-01-01" locale={es} />
|
|
22
21
|
* ```
|
|
23
22
|
*/
|
|
24
|
-
var LongDate = function (_a) {
|
|
23
|
+
var LongDate = React.memo(function (_a) {
|
|
25
24
|
var value = _a.value, locale = _a.locale;
|
|
26
25
|
if (value == null)
|
|
27
26
|
return null;
|
|
28
27
|
var date = toDate(value);
|
|
29
28
|
if (!date || isNaN(date.getTime()))
|
|
30
29
|
return null;
|
|
31
|
-
|
|
32
|
-
var
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
console.log(locale);
|
|
31
|
+
var display = React.useMemo(function () { return new Intl.DateTimeFormat(locale || undefined, {
|
|
32
|
+
weekday: 'long',
|
|
33
|
+
day: 'numeric',
|
|
34
|
+
month: 'long',
|
|
35
|
+
year: 'numeric',
|
|
36
|
+
}).format(date); }, [date, locale]);
|
|
37
|
+
return (React.createElement("time", { dateTime: date.toISOString(), title: display }, display));
|
|
38
|
+
});
|
|
36
39
|
LongDate.displayName = "DateTime.LongDate";
|
|
37
40
|
export { LongDate };
|
|
@@ -12,19 +12,16 @@ import { IDateTimeProps } from '../DateTime';
|
|
|
12
12
|
* the component returns `null` and renders nothing.
|
|
13
13
|
*
|
|
14
14
|
* Optionally, a `locale` prop can be provided to format the date/time string according
|
|
15
|
-
* to locale-specific rules
|
|
15
|
+
* to locale-specific rules.
|
|
16
16
|
*
|
|
17
17
|
* The formatted output is wrapped in a `<time>` element with a machine-readable `dateTime`
|
|
18
18
|
* attribute to improve semantics and SEO.
|
|
19
19
|
*
|
|
20
20
|
* @example
|
|
21
21
|
* ```tsx
|
|
22
|
-
* <LongDateTime value={new Date()} />
|
|
23
|
-
* <LongDateTime value="2023-01-01T14:30:45" locale={fr} />
|
|
22
|
+
* <DateTime.LongDateTime value={new Date()} />
|
|
23
|
+
* <DateTime.LongDateTime value="2023-01-01T14:30:45" locale={fr} />
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
|
-
declare const LongDateTime: {
|
|
27
|
-
(props: IDateTimeProps): React.JSX.Element;
|
|
28
|
-
displayName: string;
|
|
29
|
-
};
|
|
26
|
+
declare const LongDateTime: React.MemoExoticComponent<({ value, locale }: IDateTimeProps) => React.JSX.Element>;
|
|
30
27
|
export { LongDateTime };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { format } from 'date-fns';
|
|
3
2
|
import { toDate } from './toDate';
|
|
4
3
|
/**
|
|
5
4
|
* `LongDateTime` formats a date/time value into a long, detailed string including
|
|
@@ -13,25 +12,35 @@ import { toDate } from './toDate';
|
|
|
13
12
|
* the component returns `null` and renders nothing.
|
|
14
13
|
*
|
|
15
14
|
* Optionally, a `locale` prop can be provided to format the date/time string according
|
|
16
|
-
* to locale-specific rules
|
|
15
|
+
* to locale-specific rules.
|
|
17
16
|
*
|
|
18
17
|
* The formatted output is wrapped in a `<time>` element with a machine-readable `dateTime`
|
|
19
18
|
* attribute to improve semantics and SEO.
|
|
20
19
|
*
|
|
21
20
|
* @example
|
|
22
21
|
* ```tsx
|
|
23
|
-
* <LongDateTime value={new Date()} />
|
|
24
|
-
* <LongDateTime value="2023-01-01T14:30:45" locale={fr} />
|
|
22
|
+
* <DateTime.LongDateTime value={new Date()} />
|
|
23
|
+
* <DateTime.LongDateTime value="2023-01-01T14:30:45" locale={fr} />
|
|
25
24
|
* ```
|
|
26
25
|
*/
|
|
27
|
-
var LongDateTime = function (
|
|
28
|
-
|
|
26
|
+
var LongDateTime = React.memo(function (_a) {
|
|
27
|
+
var value = _a.value, locale = _a.locale;
|
|
28
|
+
if (value == null)
|
|
29
29
|
return null;
|
|
30
|
-
var date = toDate(
|
|
30
|
+
var date = toDate(value);
|
|
31
31
|
if (isNaN(date.getTime()))
|
|
32
32
|
return null; // Extra check for invalid dates
|
|
33
|
-
var
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
var display = React.useMemo(function () { return new Intl.DateTimeFormat(locale || undefined, {
|
|
34
|
+
weekday: 'long', // e.g. Tuesday
|
|
35
|
+
day: 'numeric', // e.g. 28
|
|
36
|
+
month: 'long', // e.g. May
|
|
37
|
+
year: 'numeric', // e.g. 2024
|
|
38
|
+
hour: '2-digit', // e.g. 14 (24-hour format)
|
|
39
|
+
minute: '2-digit', // e.g. 30
|
|
40
|
+
second: '2-digit', // e.g. 05
|
|
41
|
+
hour12: false // 24-hour time, remove if you want 12-hour time
|
|
42
|
+
}).format(date); }, [date, locale]);
|
|
43
|
+
return (React.createElement("time", { dateTime: date.toISOString(), title: display }, display));
|
|
44
|
+
});
|
|
36
45
|
LongDateTime.displayName = "DateTime.LongDateTime";
|
|
37
46
|
export { LongDateTime };
|
|
@@ -15,12 +15,9 @@ import { IDateTimeProps } from '../DateTime';
|
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
17
17
|
* ```tsx
|
|
18
|
-
* <LongTime value={new Date()} />
|
|
19
|
-
* <LongTime value="2023-01-01T14:30:45" />
|
|
18
|
+
* <DateTime.LongTime value={new Date()} />
|
|
19
|
+
* <DateTime.LongTime value="2023-01-01T14:30:45" />
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
|
-
declare const LongTime: {
|
|
23
|
-
(props: IDateTimeProps): React.JSX.Element;
|
|
24
|
-
displayName: string;
|
|
25
|
-
};
|
|
22
|
+
declare const LongTime: React.MemoExoticComponent<({ value, locale }: IDateTimeProps) => React.JSX.Element>;
|
|
26
23
|
export { LongTime };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { format } from 'date-fns';
|
|
3
2
|
import { toDate } from './toDate';
|
|
4
3
|
/**
|
|
5
4
|
* `LongTime` formats a date/time value to show hours, minutes, and seconds,
|
|
@@ -16,17 +15,24 @@ import { toDate } from './toDate';
|
|
|
16
15
|
*
|
|
17
16
|
* @example
|
|
18
17
|
* ```tsx
|
|
19
|
-
* <LongTime value={new Date()} />
|
|
20
|
-
* <LongTime value="2023-01-01T14:30:45" />
|
|
18
|
+
* <DateTime.LongTime value={new Date()} />
|
|
19
|
+
* <DateTime.LongTime value="2023-01-01T14:30:45" />
|
|
21
20
|
* ```
|
|
22
21
|
*/
|
|
23
|
-
var LongTime = function (
|
|
24
|
-
|
|
22
|
+
var LongTime = React.memo(function (_a) {
|
|
23
|
+
var value = _a.value, locale = _a.locale;
|
|
24
|
+
if (value == null)
|
|
25
25
|
return null;
|
|
26
|
-
var date = toDate(
|
|
26
|
+
var date = toDate(value);
|
|
27
27
|
if (isNaN(date.getTime()))
|
|
28
28
|
return null;
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
var display = React.useMemo(function () { return new Intl.DateTimeFormat(locale || undefined, {
|
|
30
|
+
hour: '2-digit',
|
|
31
|
+
minute: '2-digit',
|
|
32
|
+
second: '2-digit',
|
|
33
|
+
hour12: false
|
|
34
|
+
}).format(date); }, [date, locale]);
|
|
35
|
+
return (React.createElement("time", { dateTime: date.toISOString() }, display));
|
|
36
|
+
});
|
|
31
37
|
LongTime.displayName = "DateTime.LongTime";
|
|
32
38
|
export { LongTime };
|
|
@@ -17,12 +17,9 @@ import { IDateTimeProps } from '../DateTime';
|
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
19
|
* ```tsx
|
|
20
|
-
* <ShortDate value={new Date()} />
|
|
21
|
-
* <ShortDate value="2025-05-28" locale={someLocale} />
|
|
20
|
+
* <DateTime.ShortDate value={new Date()} />
|
|
21
|
+
* <DateTime.ShortDate value="2025-05-28" locale={someLocale} />
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
|
-
declare const ShortDate: {
|
|
25
|
-
(props: IDateTimeProps): React.JSX.Element;
|
|
26
|
-
displayName: string;
|
|
27
|
-
};
|
|
24
|
+
declare const ShortDate: React.MemoExoticComponent<({ value, locale }: IDateTimeProps) => React.JSX.Element>;
|
|
28
25
|
export { ShortDate };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { format } from 'date-fns';
|
|
3
2
|
import { toDate } from './toDate';
|
|
4
3
|
/**
|
|
5
4
|
* `ShortDate` formats a date value into a short date string,
|
|
@@ -18,20 +17,33 @@ import { toDate } from './toDate';
|
|
|
18
17
|
*
|
|
19
18
|
* @example
|
|
20
19
|
* ```tsx
|
|
21
|
-
* <ShortDate value={new Date()} />
|
|
22
|
-
* <ShortDate value="2025-05-28" locale={someLocale} />
|
|
20
|
+
* <DateTime.ShortDate value={new Date()} />
|
|
21
|
+
* <DateTime.ShortDate value="2025-05-28" locale={someLocale} />
|
|
23
22
|
* ```
|
|
24
23
|
*/
|
|
25
|
-
var ShortDate = function (
|
|
26
|
-
|
|
24
|
+
var ShortDate = React.memo(function (_a) {
|
|
25
|
+
var value = _a.value, locale = _a.locale;
|
|
26
|
+
if (value == null)
|
|
27
27
|
return null;
|
|
28
|
-
var date = toDate(
|
|
28
|
+
var date = toDate(value);
|
|
29
29
|
if (isNaN(date.getTime()))
|
|
30
30
|
return null;
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
var title = React.useMemo(function () { return new Intl.DateTimeFormat(locale || undefined, {
|
|
32
|
+
weekday: 'long', // e.g. Tuesday
|
|
33
|
+
day: 'numeric', // e.g. 28
|
|
34
|
+
month: 'long', // e.g. May
|
|
35
|
+
year: 'numeric', // e.g. 2024
|
|
36
|
+
hour: '2-digit', // e.g. 14 (24-hour format)
|
|
37
|
+
minute: '2-digit', // e.g. 30
|
|
38
|
+
second: '2-digit', // e.g. 05
|
|
39
|
+
hour12: false // 24-hour time, remove if you want 12-hour time
|
|
40
|
+
}).format(date); }, [date, locale]);
|
|
41
|
+
var display = React.useMemo(function () { return new Intl.DateTimeFormat(locale || undefined, {
|
|
42
|
+
day: '2-digit',
|
|
43
|
+
month: '2-digit',
|
|
44
|
+
year: 'numeric',
|
|
45
|
+
}).format(date); }, [date, locale]);
|
|
46
|
+
return (React.createElement("time", { dateTime: date.toISOString(), title: title }, display));
|
|
47
|
+
});
|
|
36
48
|
ShortDate.displayName = "DateTime.ShortDate";
|
|
37
49
|
export { ShortDate };
|
|
@@ -17,12 +17,9 @@ import { IDateTimeProps } from '../DateTime';
|
|
|
17
17
|
*
|
|
18
18
|
* @example
|
|
19
19
|
* ```tsx
|
|
20
|
-
* <ShortDateTime value={new Date()} />
|
|
21
|
-
* <ShortDateTime value="2025-05-28T14:30:45" locale={someLocale} />
|
|
20
|
+
* <DateTime.ShortDateTime value={new Date()} />
|
|
21
|
+
* <DateTime.ShortDateTime value="2025-05-28T14:30:45" locale={someLocale} />
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
|
-
declare const ShortDateTime: {
|
|
25
|
-
(props: IDateTimeProps): React.JSX.Element;
|
|
26
|
-
displayName: string;
|
|
27
|
-
};
|
|
24
|
+
declare const ShortDateTime: React.MemoExoticComponent<({ value, locale }: IDateTimeProps) => React.JSX.Element>;
|
|
28
25
|
export { ShortDateTime };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { format } from 'date-fns';
|
|
3
2
|
import { toDate } from './toDate';
|
|
4
3
|
/**
|
|
5
4
|
* `ShortDateTime` formats a date/time value as a short date and time string,
|
|
@@ -18,20 +17,45 @@ import { toDate } from './toDate';
|
|
|
18
17
|
*
|
|
19
18
|
* @example
|
|
20
19
|
* ```tsx
|
|
21
|
-
* <ShortDateTime value={new Date()} />
|
|
22
|
-
* <ShortDateTime value="2025-05-28T14:30:45" locale={someLocale} />
|
|
20
|
+
* <DateTime.ShortDateTime value={new Date()} />
|
|
21
|
+
* <DateTime.ShortDateTime value="2025-05-28T14:30:45" locale={someLocale} />
|
|
23
22
|
* ```
|
|
24
23
|
*/
|
|
25
|
-
var ShortDateTime = function (
|
|
26
|
-
|
|
24
|
+
var ShortDateTime = React.memo(function (_a) {
|
|
25
|
+
var value = _a.value, locale = _a.locale;
|
|
26
|
+
if (value == null)
|
|
27
27
|
return null;
|
|
28
|
-
var date = toDate(
|
|
28
|
+
var date = toDate(value);
|
|
29
29
|
if (isNaN(date.getTime()))
|
|
30
30
|
return null;
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
31
|
+
var title = React.useMemo(function () { return new Intl.DateTimeFormat(locale || undefined, {
|
|
32
|
+
weekday: 'long', // e.g. Tuesday
|
|
33
|
+
day: 'numeric', // e.g. 28
|
|
34
|
+
month: 'long', // e.g. May
|
|
35
|
+
year: 'numeric', // e.g. 2024
|
|
36
|
+
hour: '2-digit', // e.g. 14 (24-hour format)
|
|
37
|
+
minute: '2-digit', // e.g. 30
|
|
38
|
+
second: '2-digit', // e.g. 05
|
|
39
|
+
hour12: false // 24-hour time, remove if you want 12-hour time
|
|
40
|
+
}).format(date); }, [date, locale]);
|
|
41
|
+
// Format the date part with locale (will use locale separators and order)
|
|
42
|
+
var formattedDate = React.useMemo(function () { return new Intl.DateTimeFormat(locale || undefined, {
|
|
43
|
+
day: '2-digit',
|
|
44
|
+
month: '2-digit',
|
|
45
|
+
year: 'numeric',
|
|
46
|
+
}).format(date); }, [date, locale]);
|
|
47
|
+
// Format the time part - note time is more consistent but can be locale-specific (e.g., 24h vs 12h)
|
|
48
|
+
// We force 24h with hour12: false.
|
|
49
|
+
var formattedTime = React.useMemo(function () { return new Intl.DateTimeFormat(locale || undefined, {
|
|
50
|
+
hour: '2-digit',
|
|
51
|
+
minute: '2-digit',
|
|
52
|
+
second: '2-digit',
|
|
53
|
+
hour12: false,
|
|
54
|
+
}).format(date); }, [date, locale]);
|
|
55
|
+
return (React.createElement("time", { dateTime: date.toISOString(), title: title },
|
|
56
|
+
formattedDate,
|
|
57
|
+
" ",
|
|
58
|
+
formattedTime));
|
|
59
|
+
});
|
|
36
60
|
ShortDateTime.displayName = "DateTime.ShortDateTime";
|
|
37
61
|
export { ShortDateTime };
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { IDateTimeProps } from '../DateTime';
|
|
3
|
-
interface IShortTimeProps extends IDateTimeProps {
|
|
4
|
-
/**
|
|
5
|
-
* Seconds are shown if set.
|
|
6
|
-
*/
|
|
7
|
-
seconds?: boolean;
|
|
8
|
-
}
|
|
9
3
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
4
|
+
* `ShortTime` formats a time value as a short string (HH:mm),
|
|
5
|
+
* supporting localization.
|
|
12
6
|
*
|
|
7
|
+
* The component accepts a `Date` or a date string as input. If the input is `null`
|
|
8
|
+
* or invalid, it returns `null`.
|
|
9
|
+
*
|
|
10
|
+
* The output is wrapped in a semantic `<time>` element with a machine-readable
|
|
11
|
+
* `dateTime` attribute.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
13
14
|
* ```tsx
|
|
14
|
-
* <ShortTime value={new Date()} />
|
|
15
|
-
* <ShortTime value="2023-05-28T14:30:00"
|
|
15
|
+
* <DateTime.ShortTime value={new Date()} />
|
|
16
|
+
* <DateTime.ShortTime value="2023-05-28T14:30:00" locale={someLocale} />
|
|
16
17
|
* ```
|
|
17
18
|
*/
|
|
18
|
-
declare const ShortTime: React.MemoExoticComponent<({ value, locale
|
|
19
|
-
export { ShortTime
|
|
19
|
+
declare const ShortTime: React.MemoExoticComponent<({ value, locale }: IDateTimeProps) => React.JSX.Element>;
|
|
20
|
+
export { ShortTime };
|
|
@@ -1,24 +1,35 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { format } from 'date-fns';
|
|
3
2
|
import { toDate } from './toDate';
|
|
4
3
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* `ShortTime` formats a time value as a short string (HH:mm),
|
|
5
|
+
* supporting localization.
|
|
7
6
|
*
|
|
7
|
+
* The component accepts a `Date` or a date string as input. If the input is `null`
|
|
8
|
+
* or invalid, it returns `null`.
|
|
9
|
+
*
|
|
10
|
+
* The output is wrapped in a semantic `<time>` element with a machine-readable
|
|
11
|
+
* `dateTime` attribute.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
8
14
|
* ```tsx
|
|
9
|
-
* <ShortTime value={new Date()} />
|
|
10
|
-
* <ShortTime value="2023-05-28T14:30:00"
|
|
15
|
+
* <DateTime.ShortTime value={new Date()} />
|
|
16
|
+
* <DateTime.ShortTime value="2023-05-28T14:30:00" locale={someLocale} />
|
|
11
17
|
* ```
|
|
12
18
|
*/
|
|
13
19
|
var ShortTime = React.memo(function (_a) {
|
|
14
|
-
var value = _a.value, locale = _a.locale
|
|
20
|
+
var value = _a.value, locale = _a.locale;
|
|
15
21
|
if (value == null)
|
|
16
22
|
return null;
|
|
17
23
|
var date = toDate(value);
|
|
18
24
|
if (isNaN(date.getTime()))
|
|
19
|
-
return null;
|
|
20
|
-
var
|
|
21
|
-
|
|
25
|
+
return null;
|
|
26
|
+
var options = {
|
|
27
|
+
hour: '2-digit',
|
|
28
|
+
minute: '2-digit',
|
|
29
|
+
hour12: false
|
|
30
|
+
};
|
|
31
|
+
var formattedTime = React.useMemo(function () { return new Intl.DateTimeFormat(locale || undefined, options).format(date); }, [date, locale]);
|
|
32
|
+
return (React.createElement("time", { dateTime: date.toISOString() }, formattedTime));
|
|
22
33
|
});
|
|
23
34
|
ShortTime.displayName = "DateTime.ShortTime";
|
|
24
35
|
export { ShortTime };
|
|
@@ -28,7 +28,6 @@ import * as React from 'react';
|
|
|
28
28
|
import styled, { css } from 'styled-components';
|
|
29
29
|
import { createPortal } from 'react-dom';
|
|
30
30
|
import { usePopper } from 'react-popper';
|
|
31
|
-
import { parseISO } from 'date-fns';
|
|
32
31
|
import { Selector } from './Selector';
|
|
33
32
|
import { Body } from './Body';
|
|
34
33
|
var DateInputBase = function (props) {
|
|
@@ -41,7 +40,7 @@ var DateInputBase = function (props) {
|
|
|
41
40
|
return def;
|
|
42
41
|
if (str instanceof Date)
|
|
43
42
|
return str;
|
|
44
|
-
var date =
|
|
43
|
+
var date = new Date(props.value);
|
|
45
44
|
if (isNaN(date.getDate()))
|
|
46
45
|
return def;
|
|
47
46
|
return date;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Dropdown
|
|
1
|
+
export { Dropdown } from './Dropdown';
|
package/inputs/Input/Input.d.ts
CHANGED
|
@@ -66,10 +66,6 @@ interface IProps {
|
|
|
66
66
|
* If set, the value of a `type=password` input can be revealed.
|
|
67
67
|
*/
|
|
68
68
|
revealable?: boolean;
|
|
69
|
-
/** If set, dates and times (in inputs of type `date` or `time`) are shown in this format
|
|
70
|
-
* (refer to date-fns/format for format options).
|
|
71
|
-
*/
|
|
72
|
-
format?: string;
|
|
73
69
|
/**
|
|
74
70
|
* If set, time pickers have a "seconds" field.
|
|
75
71
|
* @default false
|
package/package.json
CHANGED
|
@@ -1,70 +1,66 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@longline/aqua-ui",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "AquaUI",
|
|
5
|
-
"author": "Alexander van Oostenrijk / Longline Environment",
|
|
6
|
-
"license": "Commercial",
|
|
7
|
-
"homepage": "https://github.com/henck/aqua-ui#readme",
|
|
8
|
-
"main": "/index.js",
|
|
9
|
-
"module": "/index.js",
|
|
10
|
-
"types": "/index.d.ts",
|
|
11
|
-
"repository": {
|
|
12
|
-
"type": "git",
|
|
13
|
-
"url": "git+https://github.com/henck/aqua-ui.git"
|
|
14
|
-
},
|
|
15
|
-
"bugs": {
|
|
16
|
-
"url": "https://github.com/henck/aqua-ui/issues"
|
|
17
|
-
},
|
|
18
|
-
"scripts": {
|
|
19
|
-
"build": "webpack --config webpack.config.js && tsc --version && tsc",
|
|
20
|
-
"storybook": "storybook dev -p 6006",
|
|
21
|
-
"build-storybook": "storybook build",
|
|
22
|
-
"tsc": "tsc",
|
|
23
|
-
"pub": "npm version patch && webpack --config webpack.config.js && tsc && cd dist && npm publish"
|
|
24
|
-
},
|
|
25
|
-
"devDependencies": {
|
|
26
|
-
"@chromatic-com/storybook": "^
|
|
27
|
-
"@storybook/addon-
|
|
28
|
-
"@storybook/addon-
|
|
29
|
-
"@storybook/addon-
|
|
30
|
-
"@storybook/
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
"
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"@
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
49
|
-
"@
|
|
50
|
-
"@
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
"react-transition-state": "^2.2.0",
|
|
68
|
-
"styled-components": "^6.1.13"
|
|
69
|
-
}
|
|
70
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@longline/aqua-ui",
|
|
3
|
+
"version": "1.0.187",
|
|
4
|
+
"description": "AquaUI",
|
|
5
|
+
"author": "Alexander van Oostenrijk / Longline Environment",
|
|
6
|
+
"license": "Commercial",
|
|
7
|
+
"homepage": "https://github.com/henck/aqua-ui#readme",
|
|
8
|
+
"main": "/index.js",
|
|
9
|
+
"module": "/index.js",
|
|
10
|
+
"types": "/index.d.ts",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/henck/aqua-ui.git"
|
|
14
|
+
},
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/henck/aqua-ui/issues"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "webpack --config webpack.config.js && tsc --version && tsc",
|
|
20
|
+
"storybook": "storybook dev -p 6006",
|
|
21
|
+
"build-storybook": "storybook build",
|
|
22
|
+
"tsc": "tsc",
|
|
23
|
+
"pub": "npm version patch && webpack --config webpack.config.js && tsc && cd dist && npm publish"
|
|
24
|
+
},
|
|
25
|
+
"devDependencies": {
|
|
26
|
+
"@chromatic-com/storybook": "^4.0.0",
|
|
27
|
+
"@storybook/addon-docs": "^9.0.0",
|
|
28
|
+
"@storybook/addon-links": "^9.0.0",
|
|
29
|
+
"@storybook/addon-webpack5-compiler-swc": "^3.0.0",
|
|
30
|
+
"@storybook/react-webpack5": "^9.0.0",
|
|
31
|
+
"copy-webpack-plugin": "^12.0.2",
|
|
32
|
+
"pngjs": "^7.0.0",
|
|
33
|
+
"storybook": "^9.0.0",
|
|
34
|
+
"svg-spritemap-webpack-plugin": "^4.5.1",
|
|
35
|
+
"typescript": "^5.5.4",
|
|
36
|
+
"webpack": "^5.94.0",
|
|
37
|
+
"webpack-cli": "^5.1.4"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"@popperjs/core": "^2.11.8",
|
|
41
|
+
"@react-spring/web": "^9.7.4",
|
|
42
|
+
"@tiptap/pm": "^2.7.2",
|
|
43
|
+
"@tiptap/react": "^2.7.2",
|
|
44
|
+
"@tiptap/starter-kit": "^2.7.2",
|
|
45
|
+
"@turf/helpers": "^7.1.0",
|
|
46
|
+
"@turf/tin": "^7.1.0",
|
|
47
|
+
"@types/geojson": "^7946.0.14",
|
|
48
|
+
"@types/mapbox-gl": "^3.4.1",
|
|
49
|
+
"@types/react": "^18.3.10",
|
|
50
|
+
"@types/react-dom": "^18.3.0",
|
|
51
|
+
"awesome-debounce-promise": "^2.1.0",
|
|
52
|
+
"gl-matrix": "^3.4.3",
|
|
53
|
+
"mapbox-gl": "^3.9.4",
|
|
54
|
+
"overlayscrollbars-react": "^0.5.6",
|
|
55
|
+
"react": "^18.3.1",
|
|
56
|
+
"react-dom": "^18.3.1",
|
|
57
|
+
"react-map-gl": "^8.0.1",
|
|
58
|
+
"react-popper": "^2.3.0",
|
|
59
|
+
"react-router-dom": "^6.26.2",
|
|
60
|
+
"react-transition-state": "^2.2.0",
|
|
61
|
+
"styled-components": "^6.1.13"
|
|
62
|
+
},
|
|
63
|
+
"overrides": {
|
|
64
|
+
"storybook": "$storybook"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -1,23 +0,0 @@
|
|
|
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
|
-
import * as React from 'react';
|
|
13
|
-
import { format as dFormat } from 'date-fns';
|
|
14
|
-
import { toDate } from './toDate';
|
|
15
|
-
var Custom = function (_a) {
|
|
16
|
-
var _b = _a.format, format = _b === void 0 ? "dd-MM-yyyy" : _b, props = __rest(_a, ["format"]);
|
|
17
|
-
if (props.value == null)
|
|
18
|
-
return null;
|
|
19
|
-
var date = toDate(props.value);
|
|
20
|
-
return React.createElement(React.Fragment, null, dFormat(date, format, props.locale ? { locale: props.locale } : {}));
|
|
21
|
-
};
|
|
22
|
-
Custom.displayName = "DateTime.Custom";
|
|
23
|
-
export { Custom };
|