@jobber/components 4.4.5 → 4.4.6-pre.4
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/Countdown/Countdown.d.ts +4 -4
- package/dist/Countdown/index.js +5 -4
- package/dist/FormatDate/FormatDate.d.ts +4 -4
- package/dist/FormatRelativeDateTime/FormatRelativeDateTime.d.ts +4 -4
- package/dist/FormatRelativeDateTime/index.js +1 -1
- package/dist/FormatTime/FormatTime.d.ts +4 -4
- package/dist/FormatTime/index.js +1 -1
- package/dist/InputTime/InputTime.d.ts +2 -1
- package/dist/InputTime/InputTimeProps.d.ts +5 -5
- package/dist/InputTime/InputTimeSafari.d.ts +2 -1
- package/dist/InputTime/civilTimeConversions.d.ts +3 -3
- package/dist/InputTime/index.js +2 -2
- package/dist/types/index.d.ts +5 -0
- package/dist/types/index.js +2 -0
- package/package.json +5 -4
- package/types.d.ts +1 -0
- package/types.js +17 -0
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
2
|
+
import { AtlantisTemporalPlainDateTime } from "../types";
|
|
3
3
|
/**
|
|
4
4
|
* Options for deciding how much information is shown to the user
|
|
5
5
|
* days, hours, minutes, seconds
|
|
6
6
|
*/
|
|
7
7
|
type GranularityOptions = "dhms" | "hms" | "ms" | "s" | "dhm" | "dh" | "d";
|
|
8
|
-
interface CountdownProps {
|
|
8
|
+
interface CountdownProps<T extends AtlantisTemporalPlainDateTime | Date | number | string> {
|
|
9
9
|
/**
|
|
10
10
|
* The date that is being counted down to
|
|
11
11
|
* Civil Time of time is to be displayed.
|
|
12
12
|
* In the case of `date` a `string` should be in ISO 8601 format
|
|
13
13
|
*/
|
|
14
|
-
readonly date:
|
|
14
|
+
readonly date: T;
|
|
15
15
|
/**
|
|
16
16
|
* Whether or not to present the unit of time to the user, or just the raw numbers.
|
|
17
17
|
*/
|
|
@@ -28,5 +28,5 @@ interface CountdownProps {
|
|
|
28
28
|
*/
|
|
29
29
|
onComplete?(): void;
|
|
30
30
|
}
|
|
31
|
-
export declare function Countdown({ date: inputDate, onComplete, showUnits, granularity, }: CountdownProps): JSX.Element;
|
|
31
|
+
export declare function Countdown<T extends AtlantisTemporalPlainDateTime | Date | number | string>({ date: inputDate, onComplete, showUnits, granularity, }: CountdownProps<T>): JSX.Element;
|
|
32
32
|
export {};
|
package/dist/Countdown/index.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var temporal = require('@std-proposal/temporal');
|
|
7
6
|
var ReactCountdown = require('react-countdown');
|
|
8
7
|
|
|
9
8
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -18,11 +17,13 @@ function computeTimeUnit(remainder, unit) {
|
|
|
18
17
|
function Countdown({ date: inputDate, onComplete, showUnits, granularity = "dhms", }) {
|
|
19
18
|
const date = React.useMemo(() => {
|
|
20
19
|
let initDate;
|
|
21
|
-
if (inputDate
|
|
22
|
-
|
|
20
|
+
if (typeof inputDate === "string" ||
|
|
21
|
+
typeof inputDate === "number" ||
|
|
22
|
+
inputDate instanceof Date) {
|
|
23
|
+
initDate = new Date(inputDate);
|
|
23
24
|
}
|
|
24
25
|
else {
|
|
25
|
-
initDate = new Date(inputDate);
|
|
26
|
+
initDate = new Date(inputDate.year, inputDate.month - 1, inputDate.day);
|
|
26
27
|
}
|
|
27
28
|
return initDate;
|
|
28
29
|
}, [inputDate]);
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
interface FormatDateProps {
|
|
2
|
+
import { AtlantisTemporalPlainDate } from "../types";
|
|
3
|
+
interface FormatDateProps<T extends AtlantisTemporalPlainDate | Date | string> {
|
|
4
4
|
/**
|
|
5
5
|
* Date to be formatted.
|
|
6
6
|
*
|
|
7
7
|
* A `string` should be an ISO 8601 format date string.
|
|
8
8
|
*/
|
|
9
|
-
readonly date:
|
|
9
|
+
readonly date: T;
|
|
10
10
|
}
|
|
11
|
-
export declare function FormatDate({ date: inputDate }: FormatDateProps): JSX.Element;
|
|
11
|
+
export declare function FormatDate<T extends AtlantisTemporalPlainDate | Date | string>({ date: inputDate }: FormatDateProps<T>): JSX.Element;
|
|
12
12
|
export declare function strFormatDate(date: Date): string;
|
|
13
13
|
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
interface FormatRelativeDateTimeProps {
|
|
2
|
+
import { AtlantisTemporalPlainDateTime } from "../types";
|
|
3
|
+
interface FormatRelativeDateTimeProps<T extends AtlantisTemporalPlainDateTime | Date | string> {
|
|
4
4
|
/**
|
|
5
5
|
* Date to be displayed.
|
|
6
6
|
*
|
|
7
7
|
* A `string` should be an ISO 8601 format date string.
|
|
8
8
|
*/
|
|
9
|
-
readonly date:
|
|
9
|
+
readonly date: T;
|
|
10
10
|
}
|
|
11
|
-
export declare function FormatRelativeDateTime({ date: inputDate
|
|
11
|
+
export declare function FormatRelativeDateTime<T extends AtlantisTemporalPlainDateTime | Date | string>({ date: inputDate }: FormatRelativeDateTimeProps<T>): JSX.Element;
|
|
12
12
|
export {};
|
|
@@ -8,7 +8,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
8
8
|
|
|
9
9
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
10
|
|
|
11
|
-
function FormatRelativeDateTime({ date: inputDate
|
|
11
|
+
function FormatRelativeDateTime({ date: inputDate }) {
|
|
12
12
|
let dateObject;
|
|
13
13
|
if (inputDate instanceof Date) {
|
|
14
14
|
dateObject = inputDate;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import {
|
|
3
|
-
interface FormatTimeProps {
|
|
2
|
+
import { AtlantisTemporalPlainTime } from "../types";
|
|
3
|
+
interface FormatTimeProps<T extends AtlantisTemporalPlainTime | Date | string> {
|
|
4
4
|
/**
|
|
5
5
|
* Civil Time of time to be displayed.
|
|
6
6
|
*
|
|
7
7
|
* A `string` should be an ISO 8601 format date string.
|
|
8
8
|
*/
|
|
9
|
-
readonly time:
|
|
9
|
+
readonly time: T;
|
|
10
10
|
/**
|
|
11
11
|
* Optionally specify clock format. If `undefined` system format will be respected.
|
|
12
12
|
*/
|
|
13
13
|
readonly use24HourClock?: boolean;
|
|
14
14
|
}
|
|
15
|
-
export declare function FormatTime({ time: inputTime, use24HourClock
|
|
15
|
+
export declare function FormatTime<T extends AtlantisTemporalPlainTime | Date | string>({ time: inputTime, use24HourClock }: FormatTimeProps<T>): JSX.Element;
|
|
16
16
|
export {};
|
package/dist/FormatTime/index.js
CHANGED
|
@@ -8,7 +8,7 @@ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'defau
|
|
|
8
8
|
|
|
9
9
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
10
|
|
|
11
|
-
function FormatTime({ time: inputTime, use24HourClock
|
|
11
|
+
function FormatTime({ time: inputTime, use24HourClock }) {
|
|
12
12
|
let dateObject;
|
|
13
13
|
if (inputTime instanceof Date) {
|
|
14
14
|
dateObject = inputTime;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { InputTimeProps } from "./InputTimeProps";
|
|
3
|
-
|
|
3
|
+
import { AtlantisTemporalPlainTime } from "../types";
|
|
4
|
+
export declare function InputTime<T extends AtlantisTemporalPlainTime>({ defaultValue, value, onChange, ...params }: InputTimeProps<T>): JSX.Element;
|
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { CivilTime } from "@std-proposal/temporal";
|
|
2
1
|
import { CommonFormFieldProps, FormFieldProps } from "../FormField";
|
|
3
|
-
|
|
2
|
+
import { AtlantisTemporalPlainTime } from "../types";
|
|
3
|
+
export interface InputTimeProps<T extends AtlantisTemporalPlainTime> extends Pick<CommonFormFieldProps, "align" | "description" | "disabled" | "invalid" | "inline" | "loading" | "name" | "onValidation" | "placeholder" | "size">, Pick<FormFieldProps, "maxLength" | "readonly" | "autocomplete" | "max" | "min" | "onEnter" | "onFocus" | "onBlur" | "inputRef" | "validations"> {
|
|
4
4
|
/**
|
|
5
5
|
* Intial value of the input. Only use this when you need to prepopulate the
|
|
6
6
|
* field with a data that is not controlled by the components state. If a
|
|
7
7
|
* state is controlling the value, use the `value` prop instead.
|
|
8
8
|
*/
|
|
9
|
-
readonly defaultValue?:
|
|
9
|
+
readonly defaultValue?: T;
|
|
10
10
|
/**
|
|
11
11
|
* Set the component to the given value.
|
|
12
12
|
*/
|
|
13
|
-
readonly value?:
|
|
13
|
+
readonly value?: T;
|
|
14
14
|
/**
|
|
15
15
|
* Function called when user changes input value.
|
|
16
16
|
*/
|
|
17
|
-
onChange?(newValue?:
|
|
17
|
+
onChange?(newValue?: T): void;
|
|
18
18
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { InputTimeProps } from "./InputTimeProps";
|
|
3
|
-
|
|
3
|
+
import { AtlantisTemporalPlainTime } from "../types";
|
|
4
|
+
export declare function InputTimeSafari<T extends AtlantisTemporalPlainTime>({ defaultValue, value, onChange, ...params }: InputTimeProps<T>): JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare function civilTimeToHTMLTime(civilTime?:
|
|
3
|
-
export declare function htmlTimeToCivilTime(timeString: string):
|
|
1
|
+
import { AtlantisTemporalPlainTime } from "../types";
|
|
2
|
+
export declare function civilTimeToHTMLTime(civilTime?: AtlantisTemporalPlainTime): string;
|
|
3
|
+
export declare function htmlTimeToCivilTime<T extends AtlantisTemporalPlainTime>(timeString: string): T | undefined;
|
package/dist/InputTime/index.js
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var tslib_es6 = require('../tslib.es6-5b8768b7.js');
|
|
6
6
|
var React = require('react');
|
|
7
7
|
var debounce = require('lodash/debounce');
|
|
8
|
-
var
|
|
8
|
+
var polyfill = require('@js-temporal/polyfill');
|
|
9
9
|
var FormField = require('../FormField-bdfb7a5a.js');
|
|
10
10
|
require('uuid');
|
|
11
11
|
require('react-hook-form');
|
|
@@ -729,7 +729,7 @@ function civilTimeToHTMLTime(civilTime) {
|
|
|
729
729
|
}
|
|
730
730
|
function htmlTimeToCivilTime(timeString) {
|
|
731
731
|
try {
|
|
732
|
-
return
|
|
732
|
+
return polyfill.Temporal.PlainTime.from(timeString + ":00.000000000");
|
|
733
733
|
}
|
|
734
734
|
catch (_a) {
|
|
735
735
|
return undefined;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { Temporal } from "@js-temporal/polyfill";
|
|
2
|
+
import { CivilDate, CivilDateTime, CivilTime } from "@std-proposal/temporal";
|
|
3
|
+
export type AtlantisTemporalPlainDate = Temporal.PlainDate | CivilDate;
|
|
4
|
+
export type AtlantisTemporalPlainDateTime = Temporal.PlainDate | CivilDateTime;
|
|
5
|
+
export type AtlantisTemporalPlainTime = Temporal.PlainTime | CivilTime;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "4.4.
|
|
3
|
+
"version": "4.4.6-pre.4+0dfce034",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
],
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"@jobber/design": "^0.31.1",
|
|
21
|
-
"@jobber/formatters": "
|
|
22
|
-
"@jobber/hooks": "
|
|
21
|
+
"@jobber/formatters": "^0.2.2",
|
|
22
|
+
"@jobber/hooks": "^2.0.2",
|
|
23
|
+
"@js-temporal/polyfill": "^0.4.3",
|
|
23
24
|
"@popperjs/core": "^2.0.6",
|
|
24
25
|
"@std-proposal/temporal": "0.0.1",
|
|
25
26
|
"@tanstack/react-table": "8.5.13",
|
|
@@ -81,5 +82,5 @@
|
|
|
81
82
|
"> 1%",
|
|
82
83
|
"IE 10"
|
|
83
84
|
],
|
|
84
|
-
"gitHead": "
|
|
85
|
+
"gitHead": "0dfce0348ab523604c5314b1b2310f8b851ae8c1"
|
|
85
86
|
}
|
package/types.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./dist/types";
|
package/types.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true,
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var types = require("./dist/types");
|
|
8
|
+
|
|
9
|
+
Object.keys(types).forEach(function(key) {
|
|
10
|
+
if (key === "default" || key === "__esModule") return;
|
|
11
|
+
Object.defineProperty(exports, key, {
|
|
12
|
+
enumerable: true,
|
|
13
|
+
get: function get() {
|
|
14
|
+
return types[key];
|
|
15
|
+
},
|
|
16
|
+
});
|
|
17
|
+
});
|