@motor-hero/ui-kit 0.40.0 → 0.42.0
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.
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
export interface DatePickerProps {
|
|
3
|
-
/** `DatePicker`: data pura `"yyyy-MM-dd"
|
|
4
|
-
*
|
|
3
|
+
/** `DatePicker`: data pura `"yyyy-MM-dd"`. `DateTimePicker`: hora de parede
|
|
4
|
+
* `"yyyy-MM-ddTHH:mm"` — os dígitos digitados, tal qual. Nenhum dos dois
|
|
5
|
+
* passa por conversão de fuso: o significado (Brasília, local, UTC) é
|
|
6
|
+
* decisão do consumidor. `""`/`undefined` = sem valor. */
|
|
5
7
|
value?: string;
|
|
6
8
|
onChange: (value: string) => void;
|
|
7
9
|
placeholder?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../src/components/date-picker.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../src/components/date-picker.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAe9B,MAAM,WAAW,eAAe;IAC9B;;;+DAG2D;IAC3D,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;IACjC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAA;IACvC,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAA;IAC3C,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAqUD,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,qBAEhD;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,eAAe,qBAEpD"}
|
package/dist/index.cjs
CHANGED
|
@@ -1055,6 +1055,7 @@ var MASK_REPLACEMENT = { _: /\d/ };
|
|
|
1055
1055
|
var DATE_FORMAT = "dd/MM/yyyy";
|
|
1056
1056
|
var TIME_FORMAT = "HH:mm";
|
|
1057
1057
|
var DATE_VALUE_FORMAT = "yyyy-MM-dd";
|
|
1058
|
+
var DATETIME_VALUE_FORMAT = "yyyy-MM-dd'T'HH:mm";
|
|
1058
1059
|
function pad(n) {
|
|
1059
1060
|
return String(n).padStart(2, "0");
|
|
1060
1061
|
}
|
|
@@ -1070,8 +1071,8 @@ function dateOnlyToDate(value) {
|
|
|
1070
1071
|
}
|
|
1071
1072
|
function dateTimeToDate(value) {
|
|
1072
1073
|
if (!value) return void 0;
|
|
1073
|
-
const parsed = new Date(
|
|
1074
|
-
return
|
|
1074
|
+
const parsed = (0, import_date_fns.parse)(value, DATETIME_VALUE_FORMAT, /* @__PURE__ */ new Date());
|
|
1075
|
+
return (0, import_date_fns.isValid)(parsed) ? parsed : void 0;
|
|
1075
1076
|
}
|
|
1076
1077
|
function displayFor(value, withTime) {
|
|
1077
1078
|
const date = withTime ? dateTimeToDate(value) : dateOnlyToDate(value);
|
|
@@ -1166,7 +1167,7 @@ function DatePickerImpl({
|
|
|
1166
1167
|
if (!time) return;
|
|
1167
1168
|
const combined = new Date(date);
|
|
1168
1169
|
combined.setHours(time.getHours(), time.getMinutes(), 0, 0);
|
|
1169
|
-
onChange(
|
|
1170
|
+
onChange((0, import_date_fns.format)(combined, DATETIME_VALUE_FORMAT));
|
|
1170
1171
|
setOpen(false);
|
|
1171
1172
|
};
|
|
1172
1173
|
const handleCalendarSelect = (date) => {
|