softable-pixels-web 1.2.16 → 1.2.17
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/{CheckItem-DzRbPRpC.js → CheckItem-BXv4Qpcs.js} +2 -2
- package/dist/{CheckItem-DzRbPRpC.js.map → CheckItem-BXv4Qpcs.js.map} +1 -1
- package/dist/{Checkbox-Dn8CtTOP.js → Checkbox-GoqzLGQ0.js} +2 -2
- package/dist/{Checkbox-Dn8CtTOP.js.map → Checkbox-GoqzLGQ0.js.map} +1 -1
- package/dist/{DatePicker-Cj2Y6_7E.js → DatePicker-CqDALumP.js} +413 -155
- package/dist/DatePicker-CqDALumP.js.map +1 -0
- package/dist/{Icon-Ded27Khw.js → Icon-Cs9B-aOe.js} +19 -1
- package/dist/Icon-Cs9B-aOe.js.map +1 -0
- package/dist/{Input-idY5uw3s.js → Input-B39L35Jq.js} +3 -3
- package/dist/{Input-idY5uw3s.js.map → Input-B39L35Jq.js.map} +1 -1
- package/dist/{MaskModule-NVjkWlFm.js → MaskModule-B29Q2AH2.js} +137 -78
- package/dist/MaskModule-B29Q2AH2.js.map +1 -0
- package/dist/{SearchInput-DzFRhAYc.js → SearchInput-BhHOCz2L.js} +2 -2
- package/dist/{SearchInput-DzFRhAYc.js.map → SearchInput-BhHOCz2L.js.map} +1 -1
- package/dist/{Select-D5EznEQW.js → Select-CrD9GfA7.js} +2 -2
- package/dist/{Select-D5EznEQW.js.map → Select-CrD9GfA7.js.map} +1 -1
- package/dist/check-item.js +2 -2
- package/dist/checkbox.js +2 -2
- package/dist/date-picker.d.ts +1 -1
- package/dist/date-picker.js +4 -3
- package/dist/{index-CsubfLNp.d.ts → index-B21HtNYS.d.ts} +12 -14
- package/dist/{index-WcZ8I-S8.d.ts → index-BisMA0v7.d.ts} +2 -2
- package/dist/{index-ftKfqd7S.d.ts → index-eVKcU6uF.d.ts} +3 -2
- package/dist/index.d.ts +3 -3
- package/dist/index.js +8 -8
- package/dist/input.d.ts +1 -1
- package/dist/input.js +3 -3
- package/dist/mask-modules.d.ts +1 -1
- package/dist/mask-modules.js +1 -1
- package/dist/searchInput.js +2 -2
- package/dist/select.js +2 -2
- package/package.json +1 -1
- package/dist/DatePicker-Cj2Y6_7E.js.map +0 -1
- package/dist/Icon-Ded27Khw.js.map +0 -1
- package/dist/MaskModule-NVjkWlFm.js.map +0 -1
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import { n as styled, t as useThemedStyles } from "./useThemedStyles-B1E0m8Ih.js";
|
|
2
|
-
import { t as Icon } from "./Icon-
|
|
2
|
+
import { t as Icon } from "./Icon-Cs9B-aOe.js";
|
|
3
3
|
import { t as Typography } from "./Typography-DOmGYHd6.js";
|
|
4
4
|
import { t as BasePopover } from "./BasePopover-BvMT9rNx.js";
|
|
5
5
|
import { t as Label } from "./Label-DYeW5MAo.js";
|
|
6
|
+
import { t as ErrorMessage } from "./ErrorMessage-W0yfhfJP.js";
|
|
6
7
|
import { t as Button } from "./Button-CxAl6MNt.js";
|
|
7
|
-
import { i as
|
|
8
|
+
import { a as Locale, i as DateMask, n as DateValidator, o as MaskType, s as MaskModule, t as TimeValidator } from "./MaskModule-B29Q2AH2.js";
|
|
8
9
|
import { forwardRef, useEffect, useId, useMemo, useState } from "react";
|
|
9
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
import {
|
|
11
|
+
import { motion } from "framer-motion";
|
|
12
|
+
import { addDays, addMonths, addYears, eachDayOfInterval, endOfDay, endOfMonth, endOfWeek, format, isAfter, isBefore, isSameDay, isSameMonth, isWithinInterval, parse, parseISO, setHours, setMinutes, startOfDay, startOfMonth, startOfWeek, startOfYear } from "date-fns";
|
|
11
13
|
import { ptBR } from "date-fns/locale";
|
|
12
14
|
|
|
13
15
|
//#region src/utils/functions/capitalize.ts
|
|
@@ -19,9 +21,11 @@ function capitalize(text) {
|
|
|
19
21
|
//#endregion
|
|
20
22
|
//#region src/components/commons/toolkit/Calendar/components/CalendarMonth/components/CalendarDay/utils.ts
|
|
21
23
|
function getDayMetadata(params) {
|
|
22
|
-
const { day, currentMonth, selection, disablePastDates } = params;
|
|
24
|
+
const { day, currentMonth, selection, disablePastDates, disableFutureDates } = params;
|
|
25
|
+
const endOfToday = endOfDay(/* @__PURE__ */ new Date());
|
|
23
26
|
const isPastDate = isBefore(day, startOfDay(/* @__PURE__ */ new Date()));
|
|
24
|
-
const
|
|
27
|
+
const isFutureDate = isAfter(day, endOfToday);
|
|
28
|
+
const isDisabled = !isSameMonth(day, currentMonth) || disablePastDates && isPastDate || disableFutureDates && isFutureDate || false;
|
|
25
29
|
if (!selection) return {
|
|
26
30
|
ariaLabel: getAriaLabel(day, {
|
|
27
31
|
isDisabled,
|
|
@@ -122,17 +126,19 @@ function getButtonBorderRadius({ isBetween, isRangeStart, isRangeEnd }) {
|
|
|
122
126
|
//#endregion
|
|
123
127
|
//#region src/components/commons/toolkit/Calendar/components/CalendarMonth/components/CalendarDay/index.tsx
|
|
124
128
|
const CalendarDay = (props) => {
|
|
125
|
-
const { day,
|
|
129
|
+
const { day, selection, currentMonth, disablePastDates, disableFutureDates, onClick } = props;
|
|
126
130
|
const dayConfig = useMemo(() => getDayMetadata({
|
|
127
131
|
day,
|
|
128
132
|
selection,
|
|
129
133
|
currentMonth,
|
|
130
|
-
disablePastDates
|
|
134
|
+
disablePastDates,
|
|
135
|
+
disableFutureDates
|
|
131
136
|
}), [
|
|
132
137
|
day,
|
|
133
138
|
selection,
|
|
134
139
|
currentMonth,
|
|
135
|
-
disablePastDates
|
|
140
|
+
disablePastDates,
|
|
141
|
+
disableFutureDates
|
|
136
142
|
]);
|
|
137
143
|
const { styles, classes } = useThemedStyles({
|
|
138
144
|
...props,
|
|
@@ -240,6 +246,7 @@ const CalendarMonth = (props) => {
|
|
|
240
246
|
selection: props.selection,
|
|
241
247
|
currentMonth,
|
|
242
248
|
disablePastDates: props.disablePastDates,
|
|
249
|
+
disableFutureDates: props.disableFutureDates,
|
|
243
250
|
onClick: props.onDayClick
|
|
244
251
|
}, day.toISOString()))
|
|
245
252
|
})] });
|
|
@@ -285,13 +292,18 @@ const NavButton = ({ visible = true, ...props }) => {
|
|
|
285
292
|
//#endregion
|
|
286
293
|
//#region src/components/commons/toolkit/Calendar/components/CalendarHeader/utils.ts
|
|
287
294
|
function getNavMetadata(params) {
|
|
288
|
-
const {
|
|
295
|
+
const { position, isDualView, currentDate, disablePastDates, disableFutureDates } = params;
|
|
289
296
|
const today = /* @__PURE__ */ new Date();
|
|
290
297
|
const hasPrevMonthAvailable = !disablePastDates || isBefore(startOfMonth(today), startOfMonth(currentDate));
|
|
291
298
|
const hasPrevYearAvailable = !disablePastDates || isBefore(startOfYear(today), startOfYear(currentDate));
|
|
299
|
+
const showPrevButtons = !isDualView ? hasPrevMonthAvailable || hasPrevYearAvailable : position !== "right";
|
|
300
|
+
function checkRenderShowNextButton() {
|
|
301
|
+
if (disableFutureDates) return false;
|
|
302
|
+
else return !isDualView ? true : position !== "left";
|
|
303
|
+
}
|
|
292
304
|
return {
|
|
293
|
-
showPrevButtons
|
|
294
|
-
showNextButtons:
|
|
305
|
+
showPrevButtons,
|
|
306
|
+
showNextButtons: checkRenderShowNextButton(),
|
|
295
307
|
hasPrevYearAvailable,
|
|
296
308
|
hasPrevMonthAvailable
|
|
297
309
|
};
|
|
@@ -309,11 +321,15 @@ function createCalendarHeaderStyles(_props) {
|
|
|
309
321
|
paddingBlock: "0.375rem"
|
|
310
322
|
},
|
|
311
323
|
leftButtonsContainer: {
|
|
324
|
+
minWidth: "3.5rem",
|
|
325
|
+
minHeight: "1.5rem",
|
|
312
326
|
display: "flex",
|
|
313
327
|
alignItems: "center",
|
|
314
328
|
gap: "0.25rem"
|
|
315
329
|
},
|
|
316
330
|
rightButtonsContainer: {
|
|
331
|
+
minWidth: "3.5rem",
|
|
332
|
+
minHeight: "1.5rem",
|
|
317
333
|
display: "flex",
|
|
318
334
|
alignItems: "center",
|
|
319
335
|
justifyContent: "flex-end",
|
|
@@ -352,7 +368,7 @@ const CalendarHeader = (props) => {
|
|
|
352
368
|
visible: hasPrevYearAvailable,
|
|
353
369
|
onClick: () => onNavAction("prev-year")
|
|
354
370
|
})]
|
|
355
|
-
}) : /* @__PURE__ */ jsx("div", {}),
|
|
371
|
+
}) : /* @__PURE__ */ jsx("div", { style: styles.leftButtonsContainer }),
|
|
356
372
|
/* @__PURE__ */ jsx(Typography, {
|
|
357
373
|
variant: "b2",
|
|
358
374
|
align: "center",
|
|
@@ -370,58 +386,244 @@ const CalendarHeader = (props) => {
|
|
|
370
386
|
icon: "chevrons-left",
|
|
371
387
|
onClick: () => onNavAction("next-month")
|
|
372
388
|
})]
|
|
373
|
-
}) : /* @__PURE__ */ jsx("div", {})
|
|
389
|
+
}) : /* @__PURE__ */ jsx("div", { style: styles.rightButtonsContainer })
|
|
374
390
|
]
|
|
375
391
|
});
|
|
376
392
|
};
|
|
377
393
|
|
|
378
394
|
//#endregion
|
|
379
|
-
//#region src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/
|
|
395
|
+
//#region src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/components/PeriodSwitch/components/PeriodSwitchItem/styles.ts
|
|
396
|
+
function createTabSwitchItemStyles({ selected }) {
|
|
397
|
+
return styled({
|
|
398
|
+
item: {
|
|
399
|
+
minHeight: "1rem",
|
|
400
|
+
position: "relative",
|
|
401
|
+
display: "inline-flex",
|
|
402
|
+
alignItems: "center",
|
|
403
|
+
justifyContent: "center",
|
|
404
|
+
gap: 4,
|
|
405
|
+
background: "transparent",
|
|
406
|
+
border: 0,
|
|
407
|
+
padding: "0.25rem",
|
|
408
|
+
userSelect: "none",
|
|
409
|
+
whiteSpace: "nowrap",
|
|
410
|
+
__rules: { "& > p": { zIndex: 1 } }
|
|
411
|
+
},
|
|
412
|
+
selectedBg: {
|
|
413
|
+
position: "absolute",
|
|
414
|
+
inset: 0,
|
|
415
|
+
borderRadius: 6,
|
|
416
|
+
border: "1px solid var(--px-border-primary)"
|
|
417
|
+
}
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
//#endregion
|
|
422
|
+
//#region src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/components/PeriodSwitch/components/PeriodSwitchItem/index.tsx
|
|
423
|
+
const PeriodSwitchItem = (props) => {
|
|
424
|
+
const { option, selected, onClick } = props;
|
|
425
|
+
const { styles, classes } = useThemedStyles(props, createTabSwitchItemStyles, { pick: (p) => [p.selected] });
|
|
426
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
427
|
+
tabIndex: 0,
|
|
428
|
+
type: "button",
|
|
429
|
+
style: styles.item,
|
|
430
|
+
className: classes.item,
|
|
431
|
+
onBlur: props.onBlur,
|
|
432
|
+
onClick: () => onClick(option.value),
|
|
433
|
+
children: [selected ? /* @__PURE__ */ jsx(motion.div, {
|
|
434
|
+
layoutId: props.layoutId,
|
|
435
|
+
style: styles.selectedBg
|
|
436
|
+
}) : null, /* @__PURE__ */ jsx(Typography, {
|
|
437
|
+
variant: "b1",
|
|
438
|
+
fontSize: "0.625rem",
|
|
439
|
+
fontWeight: "semibold",
|
|
440
|
+
children: option.label
|
|
441
|
+
})]
|
|
442
|
+
});
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
//#endregion
|
|
446
|
+
//#region src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/components/PeriodSwitch/constants.ts
|
|
447
|
+
const PERIOD_OPTIONS = [{
|
|
448
|
+
value: "am",
|
|
449
|
+
label: "AM"
|
|
450
|
+
}, {
|
|
451
|
+
value: "pm",
|
|
452
|
+
label: "PM"
|
|
453
|
+
}];
|
|
454
|
+
|
|
455
|
+
//#endregion
|
|
456
|
+
//#region src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/components/PeriodSwitch/styles.ts
|
|
457
|
+
function createTabSwitchStyles(props) {
|
|
458
|
+
return styled({ container: {
|
|
459
|
+
width: "fit-content",
|
|
460
|
+
display: "flex",
|
|
461
|
+
flexDirection: "row",
|
|
462
|
+
alignItems: "center",
|
|
463
|
+
color: "var(--px-text-primary, #4b5563)",
|
|
464
|
+
gap: 0,
|
|
465
|
+
__rules: { "& svg": { zIndex: 1 } }
|
|
466
|
+
} });
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
//#endregion
|
|
470
|
+
//#region src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/components/PeriodSwitch/index.tsx
|
|
471
|
+
const PeriodSwitch = (props) => {
|
|
472
|
+
{
|
|
473
|
+
const { currentValue, onChange } = props;
|
|
474
|
+
const { styles, classes } = useThemedStyles(props, createTabSwitchStyles, {
|
|
475
|
+
pick: (p) => [p.currentValue],
|
|
476
|
+
applyCommonProps: true
|
|
477
|
+
});
|
|
478
|
+
return /* @__PURE__ */ jsx("div", {
|
|
479
|
+
style: styles.container,
|
|
480
|
+
className: classes.container,
|
|
481
|
+
children: PERIOD_OPTIONS.map((opt) => /* @__PURE__ */ jsx(PeriodSwitchItem, {
|
|
482
|
+
option: opt,
|
|
483
|
+
layoutId: props.layoutId,
|
|
484
|
+
selected: currentValue === opt.value,
|
|
485
|
+
onClick: onChange,
|
|
486
|
+
onBlur: props.onBlur
|
|
487
|
+
}, String(opt.value)))
|
|
488
|
+
});
|
|
489
|
+
}
|
|
490
|
+
};
|
|
491
|
+
|
|
492
|
+
//#endregion
|
|
493
|
+
//#region src/components/commons/toolkit/Calendar/constants.ts
|
|
494
|
+
const DEFAULT_TIME_FORMAT = "24h";
|
|
495
|
+
const DEFAULT_VIEW_MODE = "double";
|
|
496
|
+
const DEFAULT_DATE_FORMAT = "dd/MM/yyyy";
|
|
497
|
+
const DEFAULT_DISPLAY_DATE_FORMAT = "dd MMMM yyyy";
|
|
498
|
+
|
|
499
|
+
//#endregion
|
|
500
|
+
//#region src/components/commons/toolkit/Calendar/components/DateTimeControl/constants.ts
|
|
501
|
+
const DATE_FORMAT_MASK_MAPPER = {
|
|
502
|
+
"dd/MM/yyyy": "DD/MM/YYYY",
|
|
503
|
+
"MM/dd/yyyy": "MM/DD/YYYY",
|
|
504
|
+
"yyyy/MM/dd": "YYYY/MM/DD"
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
//#endregion
|
|
508
|
+
//#region src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/hooks/useDateTimeInput/utils/buildISODate.ts
|
|
380
509
|
function makeInitialDateTime() {
|
|
381
510
|
return {
|
|
382
511
|
time: "",
|
|
383
|
-
date: ""
|
|
512
|
+
date: "",
|
|
513
|
+
period: "am"
|
|
384
514
|
};
|
|
385
515
|
}
|
|
386
|
-
function buildISO(date, time,
|
|
516
|
+
function buildISO({ date, time, period = "am", timeFormat = DEFAULT_TIME_FORMAT, dateFormat = DEFAULT_DATE_FORMAT }) {
|
|
387
517
|
const baseDate = parse(date, dateFormat, /* @__PURE__ */ new Date());
|
|
388
|
-
|
|
518
|
+
let [hours, minutes] = time.split(":").map(Number);
|
|
519
|
+
if (timeFormat === "12h") {
|
|
520
|
+
if (period === "pm" && hours !== 12) hours += 12;
|
|
521
|
+
else if (period === "am" && hours === 12) hours = 0;
|
|
522
|
+
}
|
|
389
523
|
return setMinutes(setHours(baseDate, hours || 0), minutes || 0).toISOString();
|
|
390
524
|
}
|
|
391
525
|
|
|
526
|
+
//#endregion
|
|
527
|
+
//#region src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/hooks/useDateTimeInput/utils/errors.ts
|
|
528
|
+
function checkErrors({ values, disablePastDates, disableFutureDates, timeFormat = DEFAULT_TIME_FORMAT, dateFormat = DEFAULT_DATE_FORMAT }) {
|
|
529
|
+
const maskFormat = DATE_FORMAT_MASK_MAPPER[dateFormat];
|
|
530
|
+
const dateValidator = new DateValidator({ dateFormat: maskFormat });
|
|
531
|
+
const timeValidator = new TimeValidator({ format: timeFormat });
|
|
532
|
+
const isValidDate = dateValidator.validate(values.date);
|
|
533
|
+
const isValidTime = timeValidator.validate(values.time);
|
|
534
|
+
let error = "";
|
|
535
|
+
if (!isValidTime) error = "Formato de hora inválida";
|
|
536
|
+
if (!isValidDate) error = "Formato de data inválida";
|
|
537
|
+
if (isValidDate) {
|
|
538
|
+
const endOfToday = endOfDay(/* @__PURE__ */ new Date());
|
|
539
|
+
const startOfToday = startOfDay(/* @__PURE__ */ new Date());
|
|
540
|
+
const dateISO = createISODate(values.date, dateFormat);
|
|
541
|
+
if (dateISO && disableFutureDates && isAfter(dateISO, endOfToday.toISOString())) error = "Data futura indisponível";
|
|
542
|
+
if (dateISO && disablePastDates && isBefore(dateISO, startOfToday.toISOString())) error = "Data passada indisponível";
|
|
543
|
+
}
|
|
544
|
+
return error ?? null;
|
|
545
|
+
}
|
|
546
|
+
function createISODate(value, format$1) {
|
|
547
|
+
const parts = value.split("/");
|
|
548
|
+
if (parts.length !== 3) return null;
|
|
549
|
+
let day;
|
|
550
|
+
let month;
|
|
551
|
+
let year;
|
|
552
|
+
switch (format$1) {
|
|
553
|
+
case "dd/MM/yyyy":
|
|
554
|
+
[day, month, year] = parts;
|
|
555
|
+
break;
|
|
556
|
+
case "MM/dd/yyyy":
|
|
557
|
+
[month, day, year] = parts;
|
|
558
|
+
break;
|
|
559
|
+
case "yyyy/MM/dd":
|
|
560
|
+
[year, month, day] = parts;
|
|
561
|
+
break;
|
|
562
|
+
}
|
|
563
|
+
return new Date(Number(year), Number(month) - 1, Number(day));
|
|
564
|
+
}
|
|
565
|
+
|
|
392
566
|
//#endregion
|
|
393
567
|
//#region src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/hooks/useDateTimeInput/index.ts
|
|
394
|
-
function useDateTimeInput({ value, dateFormat =
|
|
568
|
+
function useDateTimeInput({ value, disablePastDates, disableFutureDates, timeFormat = DEFAULT_TIME_FORMAT, dateFormat = DEFAULT_DATE_FORMAT, onChange }) {
|
|
569
|
+
const [errorMessage, setErrorMessage] = useState("");
|
|
395
570
|
const [datetimeValue, setDatetimeValue] = useState(makeInitialDateTime);
|
|
396
571
|
useEffect(() => {
|
|
397
572
|
if (!value) return;
|
|
398
573
|
const date = parseISO(value);
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
574
|
+
let time;
|
|
575
|
+
let period = "am";
|
|
576
|
+
if (timeFormat === "12h") {
|
|
577
|
+
time = format(date, "hh:mm");
|
|
578
|
+
period = format(date, "a").toLowerCase();
|
|
579
|
+
} else time = format(date, "HH:mm");
|
|
580
|
+
setDatetimeValue((prev) => ({
|
|
581
|
+
...prev,
|
|
582
|
+
time,
|
|
583
|
+
period,
|
|
584
|
+
date: format(date, dateFormat)
|
|
585
|
+
}));
|
|
586
|
+
}, [
|
|
587
|
+
value,
|
|
588
|
+
dateFormat,
|
|
589
|
+
timeFormat
|
|
590
|
+
]);
|
|
404
591
|
function emitChange() {
|
|
405
|
-
|
|
592
|
+
const error = checkErrors({
|
|
593
|
+
dateFormat,
|
|
594
|
+
timeFormat,
|
|
595
|
+
disablePastDates,
|
|
596
|
+
disableFutureDates,
|
|
597
|
+
values: datetimeValue
|
|
598
|
+
});
|
|
599
|
+
if (error) return setErrorMessage(error);
|
|
600
|
+
onChange(buildISO({
|
|
601
|
+
...datetimeValue,
|
|
602
|
+
dateFormat,
|
|
603
|
+
timeFormat
|
|
604
|
+
}));
|
|
406
605
|
}
|
|
407
606
|
function handleDateTimeChange(changes) {
|
|
408
|
-
const
|
|
607
|
+
const formattedChanges = {};
|
|
608
|
+
setErrorMessage("");
|
|
409
609
|
if (changes.date != null && changes.date !== void 0) {
|
|
410
|
-
const
|
|
411
|
-
|
|
610
|
+
const maskDateFormat = DATE_FORMAT_MASK_MAPPER[dateFormat];
|
|
611
|
+
const module = new DateMask({ dateFormat: maskDateFormat });
|
|
612
|
+
formattedChanges.date = module ? module.format(changes.date) : changes.date;
|
|
412
613
|
}
|
|
413
614
|
if (changes.time != null && changes.time !== void 0) {
|
|
414
|
-
const module = MaskModule.getMask(Locale.BR, MaskType.
|
|
415
|
-
|
|
615
|
+
const module = timeFormat === "12h" ? MaskModule.getMask(Locale.BR, MaskType.TIME_12H) : MaskModule.getMask(Locale.BR, MaskType.TIME_24H);
|
|
616
|
+
formattedChanges.time = module ? module.format(changes.time) : changes.time;
|
|
416
617
|
}
|
|
618
|
+
if (changes.period) formattedChanges.period = changes.period;
|
|
417
619
|
setDatetimeValue((prev) => ({
|
|
418
620
|
...prev,
|
|
419
|
-
...
|
|
621
|
+
...formattedChanges
|
|
420
622
|
}));
|
|
421
623
|
}
|
|
422
624
|
return {
|
|
423
|
-
|
|
424
|
-
|
|
625
|
+
errorMessage,
|
|
626
|
+
datetimeValue,
|
|
425
627
|
emitChange,
|
|
426
628
|
handleDateTimeChange
|
|
427
629
|
};
|
|
@@ -432,33 +634,34 @@ function useDateTimeInput({ value, dateFormat = "dd/MM/yyyy", onChange }) {
|
|
|
432
634
|
function createDateTimeInputStyles(_props) {
|
|
433
635
|
return styled({
|
|
434
636
|
container: {
|
|
637
|
+
width: "17.5rem",
|
|
638
|
+
display: "flex",
|
|
639
|
+
flexDirection: "column",
|
|
640
|
+
gap: "0.25rem"
|
|
641
|
+
},
|
|
642
|
+
content: {
|
|
435
643
|
width: "100%",
|
|
436
644
|
height: "2.5rem",
|
|
437
645
|
display: "flex",
|
|
438
646
|
alignItems: "center",
|
|
647
|
+
columnGap: "0.25rem",
|
|
439
648
|
borderWidth: 1,
|
|
440
649
|
borderStyle: "solid",
|
|
441
650
|
borderRadius: "0.5rem",
|
|
442
651
|
padding: "0.625rem 0.875rem",
|
|
443
652
|
boxShadow: "var(--px-shadow-default)",
|
|
444
|
-
borderColor: "var(--px-border-primary)",
|
|
653
|
+
borderColor: _props.errorMessage ? "var(--px-color-error)" : "var(--px-border-primary)",
|
|
445
654
|
__rules: { "&:focus-within": {
|
|
446
655
|
outlineOffset: "-1px",
|
|
447
656
|
outline: "2px solid var(--px-color-primary)"
|
|
448
657
|
} }
|
|
449
658
|
},
|
|
450
|
-
content: {
|
|
451
|
-
flex: 1,
|
|
452
|
-
display: "flex",
|
|
453
|
-
alignItems: "center",
|
|
454
|
-
columnGap: "0.25rem"
|
|
455
|
-
},
|
|
456
659
|
wrapper: {
|
|
457
|
-
|
|
660
|
+
width: "100%",
|
|
458
661
|
minWidth: 0,
|
|
459
662
|
display: "flex",
|
|
460
663
|
alignItems: "center",
|
|
461
|
-
gap: "0.
|
|
664
|
+
gap: "0.25rem"
|
|
462
665
|
},
|
|
463
666
|
divider: {
|
|
464
667
|
border: 0,
|
|
@@ -494,16 +697,19 @@ function createDateTimeInputStyles(_props) {
|
|
|
494
697
|
//#endregion
|
|
495
698
|
//#region src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/index.tsx
|
|
496
699
|
const DateTimeInput = (props) => {
|
|
497
|
-
const { styles, classes } = useThemedStyles(props, createDateTimeInputStyles, {
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
700
|
+
const { styles, classes } = useThemedStyles(props, createDateTimeInputStyles, { applyCommonProps: true });
|
|
701
|
+
const { errorMessage, datetimeValue, emitChange, handleDateTimeChange } = useDateTimeInput(props);
|
|
702
|
+
function handleKeyDown(e) {
|
|
703
|
+
if (e.key === "Enter") emitChange();
|
|
704
|
+
}
|
|
705
|
+
function handleBlur() {
|
|
706
|
+
emitChange();
|
|
707
|
+
}
|
|
708
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
503
709
|
style: styles.container,
|
|
504
|
-
|
|
505
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
710
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
506
711
|
style: styles.content,
|
|
712
|
+
className: classes.content,
|
|
507
713
|
children: [
|
|
508
714
|
/* @__PURE__ */ jsxs("div", {
|
|
509
715
|
style: styles.wrapper,
|
|
@@ -512,84 +718,119 @@ const DateTimeInput = (props) => {
|
|
|
512
718
|
name: "general-calendar",
|
|
513
719
|
color: "var(--px-text-disabled)"
|
|
514
720
|
}), /* @__PURE__ */ jsx("input", {
|
|
515
|
-
size: 1,
|
|
516
|
-
value: date,
|
|
517
721
|
style: styles.input,
|
|
518
722
|
className: classes.input,
|
|
519
|
-
|
|
723
|
+
value: datetimeValue.date,
|
|
520
724
|
placeholder: props.dateFormat,
|
|
725
|
+
onBlur: handleBlur,
|
|
726
|
+
onKeyDown: handleKeyDown,
|
|
521
727
|
onChange: (e) => handleDateTimeChange({ date: e.target.value })
|
|
522
728
|
})]
|
|
523
729
|
}),
|
|
524
730
|
/* @__PURE__ */ jsx("hr", { style: styles.divider }),
|
|
525
731
|
/* @__PURE__ */ jsxs("div", {
|
|
526
732
|
style: styles.wrapper,
|
|
527
|
-
children: [
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
733
|
+
children: [
|
|
734
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
735
|
+
size: "sm",
|
|
736
|
+
name: "general-clock",
|
|
737
|
+
color: "var(--px-text-disabled)"
|
|
738
|
+
}),
|
|
739
|
+
/* @__PURE__ */ jsx("input", {
|
|
740
|
+
placeholder: "12:00",
|
|
741
|
+
style: styles.input,
|
|
742
|
+
className: classes.input,
|
|
743
|
+
value: datetimeValue.time,
|
|
744
|
+
onBlur: handleBlur,
|
|
745
|
+
onKeyDown: handleKeyDown,
|
|
746
|
+
onChange: (e) => handleDateTimeChange({ time: e.target.value })
|
|
747
|
+
}),
|
|
748
|
+
props.timeFormat === "12h" ? /* @__PURE__ */ jsx(PeriodSwitch, {
|
|
749
|
+
layoutId: props.layoutId,
|
|
750
|
+
currentValue: datetimeValue.period,
|
|
751
|
+
onBlur: handleBlur,
|
|
752
|
+
onChange: (value) => handleDateTimeChange({ period: value })
|
|
753
|
+
}) : null
|
|
754
|
+
]
|
|
541
755
|
})
|
|
542
756
|
]
|
|
543
|
-
})
|
|
757
|
+
}), errorMessage ? /* @__PURE__ */ jsx(ErrorMessage, { message: errorMessage }) : null]
|
|
544
758
|
});
|
|
545
759
|
};
|
|
546
760
|
|
|
761
|
+
//#endregion
|
|
762
|
+
//#region src/components/commons/toolkit/Calendar/components/DateTimeControl/hooks/useDateTimeControl/index.ts
|
|
763
|
+
function useDateTimeControl({ value, onChange }) {
|
|
764
|
+
function handleDateTimeChange(changes) {
|
|
765
|
+
const draft = {
|
|
766
|
+
start: changes.start ?? value?.start,
|
|
767
|
+
end: changes.end ?? value?.end
|
|
768
|
+
};
|
|
769
|
+
if (!draft.start) return;
|
|
770
|
+
const newValues = {
|
|
771
|
+
start: draft.start,
|
|
772
|
+
end: draft.end
|
|
773
|
+
};
|
|
774
|
+
if (newValues.end) {
|
|
775
|
+
if (isAfter(newValues.start, newValues.end)) {
|
|
776
|
+
const tempStart = newValues.start;
|
|
777
|
+
newValues.start = newValues.end;
|
|
778
|
+
newValues.end = tempStart;
|
|
779
|
+
}
|
|
780
|
+
}
|
|
781
|
+
onChange(newValues);
|
|
782
|
+
}
|
|
783
|
+
return { handleDateTimeChange };
|
|
784
|
+
}
|
|
785
|
+
|
|
547
786
|
//#endregion
|
|
548
787
|
//#region src/components/commons/toolkit/Calendar/components/DateTimeControl/styles.ts
|
|
549
788
|
function createDateTimeControlStyles(_props) {
|
|
550
789
|
return styled({ container: {
|
|
551
790
|
width: "100%",
|
|
552
791
|
display: "flex",
|
|
553
|
-
|
|
792
|
+
alignItems: _props.viewMode === "double" ? "center" : void 0,
|
|
793
|
+
flexDirection: _props.viewMode === "single" ? "column" : "row",
|
|
554
794
|
gap: "0.5rem"
|
|
555
795
|
} });
|
|
556
796
|
}
|
|
557
797
|
|
|
558
798
|
//#endregion
|
|
559
799
|
//#region src/components/commons/toolkit/Calendar/components/DateTimeControl/index.tsx
|
|
560
|
-
const DateTimeControl = (props) => {
|
|
561
|
-
const
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
onChange({
|
|
568
|
-
...value,
|
|
569
|
-
start: date
|
|
570
|
-
});
|
|
571
|
-
}
|
|
572
|
-
function handleEndDateChange(date) {
|
|
573
|
-
const { value, onChange } = props;
|
|
574
|
-
if (!value?.start) return;
|
|
575
|
-
onChange({
|
|
576
|
-
...value,
|
|
577
|
-
end: date
|
|
578
|
-
});
|
|
579
|
-
}
|
|
800
|
+
const DateTimeControl = ({ viewMode = DEFAULT_VIEW_MODE, ...props }) => {
|
|
801
|
+
const resolvedProps = {
|
|
802
|
+
viewMode,
|
|
803
|
+
...props
|
|
804
|
+
};
|
|
805
|
+
const { styles } = useThemedStyles(resolvedProps, createDateTimeControlStyles, { applyCommonProps: true });
|
|
806
|
+
const { handleDateTimeChange } = useDateTimeControl(resolvedProps);
|
|
580
807
|
return /* @__PURE__ */ jsxs("div", {
|
|
581
808
|
style: styles.container,
|
|
582
|
-
children: [
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
809
|
+
children: [
|
|
810
|
+
/* @__PURE__ */ jsx(DateTimeInput, {
|
|
811
|
+
layoutId: "start-date",
|
|
812
|
+
dateFormat: resolvedProps.dateFormat,
|
|
813
|
+
timeFormat: resolvedProps.timeFormat,
|
|
814
|
+
value: resolvedProps.value?.start ?? "",
|
|
815
|
+
disablePastDates: resolvedProps.disablePastDates,
|
|
816
|
+
disableFutureDates: resolvedProps.disableFutureDates,
|
|
817
|
+
onChange: (start) => handleDateTimeChange({ start })
|
|
818
|
+
}),
|
|
819
|
+
resolvedProps.viewMode === "double" && resolvedProps.selectionMode === "range" ? /* @__PURE__ */ jsx(Icon, {
|
|
820
|
+
name: "arrows-right",
|
|
821
|
+
size: "sm",
|
|
822
|
+
color: "var(--px-text-secondary)"
|
|
823
|
+
}) : null,
|
|
824
|
+
resolvedProps.selectionMode === "range" ? /* @__PURE__ */ jsx(DateTimeInput, {
|
|
825
|
+
layoutId: "end-date",
|
|
826
|
+
value: resolvedProps?.value?.end,
|
|
827
|
+
timeFormat: resolvedProps.timeFormat,
|
|
828
|
+
dateFormat: resolvedProps.dateFormat,
|
|
829
|
+
disablePastDates: resolvedProps.disablePastDates,
|
|
830
|
+
disableFutureDates: resolvedProps.disableFutureDates,
|
|
831
|
+
onChange: (end) => handleDateTimeChange({ end })
|
|
832
|
+
}) : null
|
|
833
|
+
]
|
|
593
834
|
});
|
|
594
835
|
};
|
|
595
836
|
|
|
@@ -638,10 +879,20 @@ function useCalendar(initialDate = /* @__PURE__ */ new Date()) {
|
|
|
638
879
|
|
|
639
880
|
//#endregion
|
|
640
881
|
//#region src/components/commons/toolkit/Calendar/styles.ts
|
|
641
|
-
function createCalendarStyles(
|
|
882
|
+
function createCalendarStyles() {
|
|
642
883
|
return styled({
|
|
643
884
|
container: {
|
|
644
885
|
display: "flex",
|
|
886
|
+
flexDirection: "column"
|
|
887
|
+
},
|
|
888
|
+
dateTimeControlContent: {
|
|
889
|
+
display: "flex",
|
|
890
|
+
padding: "0.75rem 1rem",
|
|
891
|
+
paddingBottom: "0"
|
|
892
|
+
},
|
|
893
|
+
monthsContainer: {
|
|
894
|
+
display: "flex",
|
|
895
|
+
flexDirection: "row",
|
|
645
896
|
alignItems: "center"
|
|
646
897
|
},
|
|
647
898
|
monthContainer: {
|
|
@@ -649,18 +900,13 @@ function createCalendarStyles(props) {
|
|
|
649
900
|
flexDirection: "column",
|
|
650
901
|
gap: "0.75rem",
|
|
651
902
|
padding: "0.75rem 1rem"
|
|
652
|
-
},
|
|
653
|
-
timeContainer: {
|
|
654
|
-
display: "flex",
|
|
655
|
-
flexDirection: "column",
|
|
656
|
-
gap: "0.5rem"
|
|
657
903
|
}
|
|
658
904
|
});
|
|
659
905
|
}
|
|
660
906
|
|
|
661
907
|
//#endregion
|
|
662
908
|
//#region src/components/commons/toolkit/Calendar/index.tsx
|
|
663
|
-
const Calendar = ({ viewMode =
|
|
909
|
+
const Calendar = ({ viewMode = DEFAULT_VIEW_MODE, dateFormat = DEFAULT_DATE_FORMAT, timeFormat = DEFAULT_TIME_FORMAT, ...props }) => {
|
|
664
910
|
const resolvedProps = {
|
|
665
911
|
timeFormat,
|
|
666
912
|
dateFormat,
|
|
@@ -669,10 +915,7 @@ const Calendar = ({ viewMode = "double", dateFormat = "dd/MM/yyyy", timeFormat =
|
|
|
669
915
|
};
|
|
670
916
|
const mainCalendar = useCalendar();
|
|
671
917
|
const secondaryCalendar = useCalendar(addMonths(mainCalendar.currentDate, 1));
|
|
672
|
-
const { styles } = useThemedStyles(resolvedProps, createCalendarStyles, {
|
|
673
|
-
applyCommonProps: true,
|
|
674
|
-
pick: (p) => [p.viewMode]
|
|
675
|
-
});
|
|
918
|
+
const { styles } = useThemedStyles(resolvedProps, createCalendarStyles, { applyCommonProps: true });
|
|
676
919
|
useEffect(() => {
|
|
677
920
|
secondaryCalendar.setCurrentDate(addMonths(mainCalendar.currentDate, 1));
|
|
678
921
|
}, [mainCalendar.currentDate]);
|
|
@@ -697,48 +940,67 @@ const Calendar = ({ viewMode = "double", dateFormat = "dd/MM/yyyy", timeFormat =
|
|
|
697
940
|
}
|
|
698
941
|
return /* @__PURE__ */ jsxs("div", {
|
|
699
942
|
style: styles.container,
|
|
700
|
-
children: [/* @__PURE__ */
|
|
701
|
-
style: styles.
|
|
702
|
-
children:
|
|
703
|
-
|
|
943
|
+
children: [resolvedProps.isDateTimePicker ? /* @__PURE__ */ jsx("div", {
|
|
944
|
+
style: styles.dateTimeControlContent,
|
|
945
|
+
children: /* @__PURE__ */ jsx(DateTimeControl, { ...resolvedProps })
|
|
946
|
+
}) : null, /* @__PURE__ */ jsxs("div", {
|
|
947
|
+
style: styles.monthsContainer,
|
|
948
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
949
|
+
style: styles.monthContainer,
|
|
950
|
+
children: [/* @__PURE__ */ jsx(CalendarHeader, {
|
|
704
951
|
position: "left",
|
|
705
952
|
currentDate: mainCalendar.currentDate,
|
|
706
953
|
isDualView: resolvedProps.viewMode === "double",
|
|
707
954
|
disablePastDates: resolvedProps.disablePastDates,
|
|
955
|
+
disableFutureDates: resolvedProps.disableFutureDates,
|
|
708
956
|
onNavAction: mainCalendar.handleNavAction
|
|
709
|
-
}),
|
|
710
|
-
resolvedProps.isDateTimePicker ? /* @__PURE__ */ jsx(DateTimeControl, {
|
|
711
|
-
value: resolvedProps.value,
|
|
712
|
-
dateFormat: resolvedProps.dateFormat,
|
|
713
|
-
timeFormat: resolvedProps.timeFormat,
|
|
714
|
-
selectionMode: resolvedProps.selectionMode,
|
|
715
|
-
onChange: resolvedProps.onChange
|
|
716
|
-
}) : null,
|
|
717
|
-
/* @__PURE__ */ jsx(CalendarMonth, {
|
|
957
|
+
}), /* @__PURE__ */ jsx(CalendarMonth, {
|
|
718
958
|
days: mainCalendar.days,
|
|
719
959
|
selection: resolvedProps.value,
|
|
720
960
|
disablePastDates: resolvedProps.disablePastDates,
|
|
961
|
+
disableFutureDates: resolvedProps.disableFutureDates,
|
|
721
962
|
onDayClick: handleSelect
|
|
722
|
-
})
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
963
|
+
})]
|
|
964
|
+
}), resolvedProps.viewMode === "double" ? /* @__PURE__ */ jsxs("div", {
|
|
965
|
+
style: styles.monthContainer,
|
|
966
|
+
children: [/* @__PURE__ */ jsx(CalendarHeader, {
|
|
967
|
+
isDualView: true,
|
|
968
|
+
position: "right",
|
|
969
|
+
currentDate: secondaryCalendar.currentDate,
|
|
970
|
+
disablePastDates: resolvedProps.disablePastDates,
|
|
971
|
+
disableFutureDates: resolvedProps.disableFutureDates,
|
|
972
|
+
onNavAction: mainCalendar.handleNavAction
|
|
973
|
+
}), /* @__PURE__ */ jsx(CalendarMonth, {
|
|
974
|
+
days: secondaryCalendar.days,
|
|
975
|
+
selection: resolvedProps.value,
|
|
976
|
+
disablePastDates: resolvedProps.disablePastDates,
|
|
977
|
+
disableFutureDates: resolvedProps.disableFutureDates,
|
|
978
|
+
onDayClick: handleSelect
|
|
979
|
+
})]
|
|
980
|
+
}) : null]
|
|
981
|
+
})]
|
|
739
982
|
});
|
|
740
983
|
};
|
|
741
984
|
|
|
985
|
+
//#endregion
|
|
986
|
+
//#region src/components/commons/inputs/DatePicker/components/DatePickerTrigger/utils.ts
|
|
987
|
+
function hasTimeTokens(formatStr) {
|
|
988
|
+
return /(H{1,2}|h{1,2}|m{1,2}|a)/.test(formatStr);
|
|
989
|
+
}
|
|
990
|
+
function normalizeTimeFormat(formatStr, timeFormat) {
|
|
991
|
+
if (timeFormat === "24h") return formatStr.replace(/h{1,2}/g, (match) => match.length === 2 ? "HH" : "H").replace(/\s*a/g, "");
|
|
992
|
+
return formatStr.replace(/H{1,2}/g, (match) => match.length === 2 ? "hh" : "h");
|
|
993
|
+
}
|
|
994
|
+
function getDefaultTimeFormat(timeFormat) {
|
|
995
|
+
return timeFormat === "24h" ? "HH:mm" : "hh:mm a";
|
|
996
|
+
}
|
|
997
|
+
function buildDisplayFormat({ displayDateFormat, isDateTimePicker, timeFormat }) {
|
|
998
|
+
const formatHasTime = hasTimeTokens(displayDateFormat);
|
|
999
|
+
if (!isDateTimePicker) return formatHasTime ? displayDateFormat.replace(/\s*(H{1,2}|h{1,2}|m{1,2}|a|:)+/g, "") : displayDateFormat;
|
|
1000
|
+
if (formatHasTime) return normalizeTimeFormat(displayDateFormat, timeFormat);
|
|
1001
|
+
return `${displayDateFormat} ${getDefaultTimeFormat(timeFormat)}`;
|
|
1002
|
+
}
|
|
1003
|
+
|
|
742
1004
|
//#endregion
|
|
743
1005
|
//#region src/components/commons/inputs/DatePicker/components/DatePickerTrigger/styles.ts
|
|
744
1006
|
function createDatePickerTriggerStyles(props) {
|
|
@@ -781,7 +1043,7 @@ function createDatePickerTriggerStyles(props) {
|
|
|
781
1043
|
|
|
782
1044
|
//#endregion
|
|
783
1045
|
//#region src/components/commons/inputs/DatePicker/components/DatePickerTrigger/index.tsx
|
|
784
|
-
const DatePickerTrigger = forwardRef(function DatePickerTrigger$1({
|
|
1046
|
+
const DatePickerTrigger = forwardRef(function DatePickerTrigger$1({ timeFormat = DEFAULT_TIME_FORMAT, displayDateFormat = DEFAULT_DISPLAY_DATE_FORMAT, ...props }, ref) {
|
|
785
1047
|
const inputId = useId();
|
|
786
1048
|
const { styles, classes } = useThemedStyles(props, createDatePickerTriggerStyles, {
|
|
787
1049
|
pick: (p) => [p.disabled, p.errorMessage],
|
|
@@ -793,8 +1055,13 @@ const DatePickerTrigger = forwardRef(function DatePickerTrigger$1({ dateFormat =
|
|
|
793
1055
|
function renderDate() {
|
|
794
1056
|
if (!hasValue) return placeholder ?? "Selecione uma data";
|
|
795
1057
|
const { start, end } = value;
|
|
796
|
-
const
|
|
797
|
-
|
|
1058
|
+
const finalFormat = buildDisplayFormat({
|
|
1059
|
+
timeFormat,
|
|
1060
|
+
displayDateFormat,
|
|
1061
|
+
isDateTimePicker: !!props.isDateTimePicker
|
|
1062
|
+
});
|
|
1063
|
+
const startDate = format(start, finalFormat, { locale: ptBR });
|
|
1064
|
+
const endDate = end ? format(end, finalFormat, { locale: ptBR }) : "";
|
|
798
1065
|
return `${startDate}${endDate ? ` - ${endDate}` : ""}`;
|
|
799
1066
|
}
|
|
800
1067
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -886,7 +1153,7 @@ function createDatePickerStyles(props) {
|
|
|
886
1153
|
alignItems: "center",
|
|
887
1154
|
justifyContent: props.viewMode === "single" ? "center" : "flex-end",
|
|
888
1155
|
gap: "0.75rem",
|
|
889
|
-
padding: "0.5rem"
|
|
1156
|
+
padding: "0.5rem 1rem"
|
|
890
1157
|
}
|
|
891
1158
|
});
|
|
892
1159
|
}
|
|
@@ -900,13 +1167,6 @@ var types_exports = {};
|
|
|
900
1167
|
const DatePicker = (props) => {
|
|
901
1168
|
const { isOpen, selectedDate, toggleDialog, handleDateChange, handleConfirmClick } = useDatePicker(props);
|
|
902
1169
|
const { styles } = useThemedStyles(props, createDatePickerStyles, {
|
|
903
|
-
pick: (p) => [
|
|
904
|
-
p.value,
|
|
905
|
-
p.disabled,
|
|
906
|
-
p.viewMode,
|
|
907
|
-
p.errorMessage,
|
|
908
|
-
p.disablePastDates
|
|
909
|
-
],
|
|
910
1170
|
applyCommonProps: true,
|
|
911
1171
|
commonSlot: "container"
|
|
912
1172
|
});
|
|
@@ -935,10 +1195,8 @@ const DatePicker = (props) => {
|
|
|
935
1195
|
},
|
|
936
1196
|
children: [
|
|
937
1197
|
/* @__PURE__ */ jsx(Calendar, {
|
|
1198
|
+
...props,
|
|
938
1199
|
value: selectedDate,
|
|
939
|
-
viewMode: props.viewMode ?? "double",
|
|
940
|
-
isDateTimePicker: props.isDateTimePicker,
|
|
941
|
-
disablePastDates: props.disablePastDates,
|
|
942
1200
|
selectionMode: props.selectionMode ?? "range",
|
|
943
1201
|
onChange: handleDateChange
|
|
944
1202
|
}),
|
|
@@ -967,4 +1225,4 @@ const DatePicker = (props) => {
|
|
|
967
1225
|
|
|
968
1226
|
//#endregion
|
|
969
1227
|
export { types_exports as n, DatePicker as t };
|
|
970
|
-
//# sourceMappingURL=DatePicker-
|
|
1228
|
+
//# sourceMappingURL=DatePicker-CqDALumP.js.map
|