@commercelayer/app-elements 0.0.21 → 0.0.23
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/dist/{Async-5520a286.js → Async-a33a71fb.js} +2 -2
- package/dist/{InputDateComponent-6a9595b7.js → InputDateComponent-a38b61c9.js} +635 -696
- package/dist/{Select-5f2d8bcf.js → Select-d21cd3a7.js} +2 -2
- package/dist/helpers/date.d.ts +45 -20
- package/dist/hooks/useIsChanged.d.ts +11 -0
- package/dist/{main-efbde4bf.js → main-017487f0.js} +3812 -3264
- package/dist/main.d.ts +3 -2
- package/dist/main.js +61 -57
- package/dist/{overrides-a8601925.js → overrides-7ddc4b65.js} +1 -1
- package/dist/providers/CoreSdkProvider/index.d.ts +1 -1
- package/dist/style.css +1 -1
- package/dist/ui/atoms/ButtonFilter.d.ts +12 -0
- package/dist/ui/atoms/Icon.d.ts +1 -0
- package/dist/ui/composite/Timeline.d.ts +2 -3
- package/dist/ui/forms/InputDate/InputDateComponent.d.ts +6 -0
- package/dist/ui/forms/ToggleButtons.d.ts +1 -1
- package/dist/ui/resources/ResourceList/reducer.d.ts +2 -0
- package/package.json +1 -1
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as r from "react";
|
|
2
2
|
import a, { forwardRef as s } from "react";
|
|
3
|
-
import { u as m, S as c, d as p, s as i } from "./overrides-
|
|
3
|
+
import { u as m, S as c, d as p, s as i } from "./overrides-7ddc4b65.js";
|
|
4
4
|
import "react-dom";
|
|
5
|
-
import "./main-
|
|
5
|
+
import "./main-017487f0.js";
|
|
6
6
|
import "@commercelayer/sdk";
|
|
7
7
|
var l = /* @__PURE__ */ s(function(e, t) {
|
|
8
8
|
var o = m(e);
|
package/dist/helpers/date.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
type Format = 'full' | '
|
|
2
|
-
|
|
1
|
+
type Format = 'date' | 'time' | 'timeWithSeconds' | 'full' | 'fullWithSeconds' | 'distanceToNow';
|
|
2
|
+
interface FormatDateOptions {
|
|
3
3
|
/**
|
|
4
4
|
* JavaScript ISO date string. Example '2022-10-06T11:59:30.371Z'
|
|
5
5
|
*/
|
|
@@ -8,32 +8,57 @@ type FormatDateOptions = {
|
|
|
8
8
|
* Set a specific timezone, when not passed default value is 'UTC'
|
|
9
9
|
*/
|
|
10
10
|
timezone?: string;
|
|
11
|
-
} & ({
|
|
12
11
|
/**
|
|
13
12
|
* How to format the date:
|
|
14
|
-
* -
|
|
15
|
-
* -
|
|
16
|
-
* -
|
|
17
|
-
*
|
|
13
|
+
* - `date` – can be `Today` when today, `Feb 28` when current year or `Feb 28, 2022` when previous year
|
|
14
|
+
* - `time` – `04:34` `18:54`
|
|
15
|
+
* - `timeWithSeconds` – `04:34:23` `18:54:12`
|
|
16
|
+
* - `full` – `Feb 28, 2023 · 15:30` the date in this string behaves like the `date` format
|
|
17
|
+
* - `fullWithSeconds` – `Feb 28, 2023 · 15:30:43` the date in this string behaves like the `date` format
|
|
18
|
+
* - `distanceToNow` – `about 1 hour ago` `10 months ago` `less than a minute ago`
|
|
19
|
+
* @default date
|
|
18
20
|
*/
|
|
19
21
|
format?: Format;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* When set as `custom` a `customTemplate` is required
|
|
23
|
-
*/
|
|
24
|
-
format: 'custom';
|
|
25
|
-
/**
|
|
26
|
-
* Custom template to override the default one ('LLL dd, yyyy').
|
|
27
|
-
* @link https://date-fns.org/v2.29.3/docs/format
|
|
28
|
-
*/
|
|
29
|
-
customTemplate: string;
|
|
30
|
-
});
|
|
22
|
+
}
|
|
31
23
|
/**
|
|
32
24
|
* Format the date as nice string also specifying a custom timezone
|
|
33
25
|
* @param opts a set of `FormatDateOptions`
|
|
34
26
|
* @returns a nice string representation. Example: 'Jul 21, 2022' or 'Jul 21, 2022 · 1:16 PM' if includeTime
|
|
35
27
|
*/
|
|
36
28
|
export declare function formatDate({ isoDate, timezone, ...opts }: FormatDateOptions): string;
|
|
37
|
-
export declare
|
|
38
|
-
|
|
29
|
+
export declare const timeSeparator = "\u00B7";
|
|
30
|
+
type DateISOString = string;
|
|
31
|
+
/**
|
|
32
|
+
* Calculate the time-zoned start or end of the day from an ISO date string.
|
|
33
|
+
* Useful when getting date from a date range picker.
|
|
34
|
+
* @param isoString a JavaScript ISO date string. Example '2022-10-06T11:59:30.371Z'
|
|
35
|
+
* @param edge 'startOfTheDay' or 'endOfTheDay'
|
|
36
|
+
* @param timezone Set a specific timezone, when not passed default value is 'UTC'
|
|
37
|
+
* @returns a JavaScript ISO date string that reflect the start or end of the day
|
|
38
|
+
* based on the user timezone. Example '2022-10-06T22:00:00.000Z' when timezone is 'Europe/Rome'
|
|
39
|
+
*/
|
|
40
|
+
export declare function getIsoDateAtDayEdge({ isoString, edge, timezone }: {
|
|
41
|
+
isoString: DateISOString;
|
|
42
|
+
edge: 'startOfTheDay' | 'endOfTheDay';
|
|
43
|
+
timezone?: string;
|
|
44
|
+
}): string | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* Subtract n days from an ISO date string
|
|
47
|
+
* to always return the correspondent time-zoned start of the day
|
|
48
|
+
*
|
|
49
|
+
* Example: if date-now is the 8th of March at 16:00 Italian time
|
|
50
|
+
* and I want to get the date at -7, the result will be
|
|
51
|
+
* '2022-03-01T23:00:00.000Z' as UTC string since my timezone is 'Europe/Rome'
|
|
52
|
+
* and on the 8th of March I was at +1 from UTC
|
|
53
|
+
*
|
|
54
|
+
* @param isoString JavaScript ISO date (eg: '2022-03-01T23:00:00.000Z')
|
|
55
|
+
* @param days positive number of days to subtract
|
|
56
|
+
* @param timezone (optional) in case of working with a specific timezone different from UTC
|
|
57
|
+
* @returns a new iso string
|
|
58
|
+
*/
|
|
59
|
+
export declare function getIsoDateAtDaysBefore({ isoString, days, timezone }: {
|
|
60
|
+
isoString: DateISOString;
|
|
61
|
+
days: number;
|
|
62
|
+
timezone?: string;
|
|
63
|
+
}): string | undefined;
|
|
39
64
|
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This hook is used to detect when a value has changed during new rendering.
|
|
3
|
+
* It is useful to trigger an action when a value has changed.
|
|
4
|
+
* @param value - the value to watch
|
|
5
|
+
* @param onChange - the action to trigger when the value has changed
|
|
6
|
+
* @returns - a boolean that is true when the value has changed
|
|
7
|
+
*/
|
|
8
|
+
export declare function useIsChanged<T>({ value, onChange }: {
|
|
9
|
+
value: T;
|
|
10
|
+
onChange?: () => void;
|
|
11
|
+
}): boolean;
|