softable-pixels-web 1.2.16 → 1.2.19

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.
Files changed (146) hide show
  1. package/dist/{BasePopover-BvMT9rNx.js → BasePopover-T1mEexwp.js} +3 -3
  2. package/dist/{BasePopover-BvMT9rNx.js.map → BasePopover-T1mEexwp.js.map} +1 -1
  3. package/dist/{Breadcrumb-D6RhaWzp.js → Breadcrumb-D1b9-7H4.js} +4 -4
  4. package/dist/{Breadcrumb-D6RhaWzp.js.map → Breadcrumb-D1b9-7H4.js.map} +1 -1
  5. package/dist/{Button-CxAl6MNt.js → Button-BPzDonEf.js} +4 -4
  6. package/dist/{Button-CxAl6MNt.js.map → Button-BPzDonEf.js.map} +1 -1
  7. package/dist/{CheckItem-DzRbPRpC.js → CheckItem-6gy0IqIA.js} +4 -4
  8. package/dist/{CheckItem-DzRbPRpC.js.map → CheckItem-6gy0IqIA.js.map} +1 -1
  9. package/dist/{Checkbox-Dn8CtTOP.js → Checkbox-CL4FsCMu.js} +4 -4
  10. package/dist/{Checkbox-Dn8CtTOP.js.map → Checkbox-CL4FsCMu.js.map} +1 -1
  11. package/dist/{Chip-BHWhib8g.js → Chip-OmaYp-Yz.js} +3 -3
  12. package/dist/{Chip-BHWhib8g.js.map → Chip-OmaYp-Yz.js.map} +1 -1
  13. package/dist/{ChipList-oW8sQ9EC.js → ChipList-D2p6LusJ.js} +5 -5
  14. package/dist/{ChipList-oW8sQ9EC.js.map → ChipList-D2p6LusJ.js.map} +1 -1
  15. package/dist/{ColorPicker-Dc83Om7x.js → ColorPicker-DRm-i16g.js} +5 -5
  16. package/dist/{ColorPicker-Dc83Om7x.js.map → ColorPicker-DRm-i16g.js.map} +1 -1
  17. package/dist/{ContextMenu-CRd1Fgl0.js → ContextMenu-BArKYfqU.js} +5 -5
  18. package/dist/{ContextMenu-CRd1Fgl0.js.map → ContextMenu-BArKYfqU.js.map} +1 -1
  19. package/dist/{DatePicker-Cj2Y6_7E.js → DatePicker-C6WesC4Z.js} +418 -160
  20. package/dist/DatePicker-C6WesC4Z.js.map +1 -0
  21. package/dist/{ErrorMessage-W0yfhfJP.js → ErrorMessage-C_XOzH00.js} +2 -2
  22. package/dist/{ErrorMessage-W0yfhfJP.js.map → ErrorMessage-C_XOzH00.js.map} +1 -1
  23. package/dist/{Icon-Ded27Khw.js → Icon-DTFfAYeH.js} +52 -2
  24. package/dist/Icon-DTFfAYeH.js.map +1 -0
  25. package/dist/{IconButton-BGiieVPY.js → IconButton-BZwW87Wk.js} +2 -2
  26. package/dist/{IconButton-BGiieVPY.js.map → IconButton-BZwW87Wk.js.map} +1 -1
  27. package/dist/{InfoSummary-CKymtoj5.js → InfoSummary-B8nraNFN.js} +3 -3
  28. package/dist/{InfoSummary-CKymtoj5.js.map → InfoSummary-B8nraNFN.js.map} +1 -1
  29. package/dist/{Input-idY5uw3s.js → Input-DYMRwPvz.js} +6 -6
  30. package/dist/{Input-idY5uw3s.js.map → Input-DYMRwPvz.js.map} +1 -1
  31. package/dist/{Label-DYeW5MAo.js → Label-CaQSxOx8.js} +2 -2
  32. package/dist/{Label-DYeW5MAo.js.map → Label-CaQSxOx8.js.map} +1 -1
  33. package/dist/{Loader-DD_kbMHz.js → Loader-I09c5F6g.js} +2 -2
  34. package/dist/{Loader-DD_kbMHz.js.map → Loader-I09c5F6g.js.map} +1 -1
  35. package/dist/{MaskModule-NVjkWlFm.js → MaskModule-ZvZ8AfTB.js} +137 -78
  36. package/dist/MaskModule-ZvZ8AfTB.js.map +1 -0
  37. package/dist/Pagination-BWNhdXyr.js +186 -0
  38. package/dist/Pagination-BWNhdXyr.js.map +1 -0
  39. package/dist/{Popover-DwxxEmVF.js → Popover-CuTHaY1m.js} +4 -4
  40. package/dist/{Popover-DwxxEmVF.js.map → Popover-CuTHaY1m.js.map} +1 -1
  41. package/dist/{SearchInput-DzFRhAYc.js → SearchInput-Bw8FJ2h_.js} +4 -4
  42. package/dist/{SearchInput-DzFRhAYc.js.map → SearchInput-Bw8FJ2h_.js.map} +1 -1
  43. package/dist/{Select-D5EznEQW.js → Select-RG9mDJW6.js} +8 -8
  44. package/dist/{Select-D5EznEQW.js.map → Select-RG9mDJW6.js.map} +1 -1
  45. package/dist/{Skeleton-BU7587-Z.js → Skeleton-D3Rik5Rl.js} +2 -2
  46. package/dist/{Skeleton-BU7587-Z.js.map → Skeleton-D3Rik5Rl.js.map} +1 -1
  47. package/dist/{Switch-DaFbtUYw.js → Switch-Bu4IlCGe.js} +2 -2
  48. package/dist/{Switch-DaFbtUYw.js.map → Switch-Bu4IlCGe.js.map} +1 -1
  49. package/dist/{TabSwitch-CHKjJNwv.js → TabSwitch-O8s4dJ84.js} +3 -3
  50. package/dist/{TabSwitch-CHKjJNwv.js.map → TabSwitch-O8s4dJ84.js.map} +1 -1
  51. package/dist/{TextArea-Cd9ybdiN.js → TextArea-KH0JdqJz.js} +5 -5
  52. package/dist/{TextArea-Cd9ybdiN.js.map → TextArea-KH0JdqJz.js.map} +1 -1
  53. package/dist/{ThemeContext-CeJlZRoI.js → ThemeContext-DxzrC3mU.js} +1 -1
  54. package/dist/{ThemeContext-CeJlZRoI.js.map → ThemeContext-DxzrC3mU.js.map} +1 -1
  55. package/dist/{Typography-DOmGYHd6.js → Typography-4iQDPw2N.js} +2 -2
  56. package/dist/{Typography-DOmGYHd6.js.map → Typography-4iQDPw2N.js.map} +1 -1
  57. package/dist/base-popover.d.ts +3 -3
  58. package/dist/base-popover.js +5 -5
  59. package/dist/breadcrumb.d.ts +1 -1
  60. package/dist/breadcrumb.js +4 -4
  61. package/dist/button.d.ts +9 -3
  62. package/dist/button.js +4 -4
  63. package/dist/check-item.d.ts +1 -1
  64. package/dist/check-item.js +4 -4
  65. package/dist/checkbox.d.ts +2 -2
  66. package/dist/checkbox.js +4 -4
  67. package/dist/chip-list.d.ts +1 -1
  68. package/dist/chip-list.js +6 -6
  69. package/dist/chip.d.ts +1 -1
  70. package/dist/chip.js +3 -3
  71. package/dist/color-picker.d.ts +1 -1
  72. package/dist/color-picker.js +6 -6
  73. package/dist/context-menu.d.ts +1 -1
  74. package/dist/context-menu.js +8 -8
  75. package/dist/date-picker.d.ts +1 -1
  76. package/dist/date-picker.js +13 -12
  77. package/dist/icon-button.d.ts +7 -2
  78. package/dist/icon-button.js +2 -2
  79. package/dist/{index-JY4VS1B7.d.ts → index-00GrQzD-.d.ts} +1 -1
  80. package/dist/{index-D3HezA0l.d.ts → index-4kEWB7a3.d.ts} +1 -1
  81. package/dist/{index-CLVlLUW1.d.ts → index-9s-FI1Gu.d.ts} +2 -2
  82. package/dist/{index-CHvftTxv.d.ts → index-BRU_Hb91.d.ts} +2 -2
  83. package/dist/index-BWoyVnHt.d.ts +24 -0
  84. package/dist/{index-Bxm90oSp.d.ts → index-BaPHRdOr.d.ts} +3 -3
  85. package/dist/{index-kc3NqscD.d.ts → index-Bi849Kr9.d.ts} +3 -3
  86. package/dist/{index-DHTU_QTw.d.ts → index-BoOHjN0S.d.ts} +2 -2
  87. package/dist/{index-vh_aAfJM.d.ts → index-CAniGLYu.d.ts} +1 -1
  88. package/dist/{index-WcZ8I-S8.d.ts → index-CZV5emQj.d.ts} +5 -5
  89. package/dist/{index-WFi4Q5f-.d.ts → index-Clu2R6GI.d.ts} +2 -2
  90. package/dist/{index-CRG-GDQG.d.ts → index-DPEtE8HG.d.ts} +3 -3
  91. package/dist/{index-2hmoLtaJ.d.ts → index-DfvWcRHm.d.ts} +4 -4
  92. package/dist/{index-CtH8kbOn.d.ts → index-DtOo3TI8.d.ts} +2 -2
  93. package/dist/{index-DYdYDKvw.d.ts → index-Dtq014nm.d.ts} +3 -3
  94. package/dist/{index-Cg9O1rrv.d.ts → index-DxxZyWpv.d.ts} +6 -6
  95. package/dist/{index-ftKfqd7S.d.ts → index-eJLVNRQW.d.ts} +3 -2
  96. package/dist/{index-ClRmImX5.d.ts → index-eSlCuBsn.d.ts} +2 -2
  97. package/dist/{index-CsubfLNp.d.ts → index-fZ04gsZ4.d.ts} +12 -14
  98. package/dist/index.d.ts +27 -24
  99. package/dist/index.js +32 -31
  100. package/dist/info-summary.js +3 -3
  101. package/dist/input.d.ts +1 -1
  102. package/dist/input.js +7 -7
  103. package/dist/mask-modules.d.ts +1 -1
  104. package/dist/mask-modules.js +1 -1
  105. package/dist/pagination.d.ts +5 -0
  106. package/dist/pagination.js +9 -0
  107. package/dist/popover.d.ts +2 -2
  108. package/dist/popover.js +4 -4
  109. package/dist/searchInput.d.ts +1 -1
  110. package/dist/searchInput.js +5 -5
  111. package/dist/select.d.ts +2 -2
  112. package/dist/select.js +11 -11
  113. package/dist/skeleton.d.ts +1 -1
  114. package/dist/skeleton.js +2 -2
  115. package/dist/{styleProps-B2q_-j9h.d.ts → styleProps-BD8T4IXg.d.ts} +1 -1
  116. package/dist/switch.d.ts +1 -1
  117. package/dist/switch.js +2 -2
  118. package/dist/tab-switch.d.ts +1 -1
  119. package/dist/tab-switch.js +3 -3
  120. package/dist/text-area.d.ts +1 -1
  121. package/dist/text-area.js +5 -5
  122. package/dist/theme-context.d.ts +1 -1
  123. package/dist/theme-context.js +1 -1
  124. package/dist/{index-BnNahlXB.d.ts → types-3y-Tdp7y.d.ts} +3 -6
  125. package/dist/{types-C4eY6XF3.d.ts → types-BX2F9tyU.d.ts} +1 -1
  126. package/dist/{index-DWfxn3wg.d.ts → types-CKTC5ZCk.d.ts} +6 -9
  127. package/dist/{types-Dr8EuEht.d.ts → types-DFnFVRW-.d.ts} +3 -3
  128. package/dist/{types-DaDG9cRW.d.ts → types-DSEbupHr.d.ts} +1 -1
  129. package/dist/{types-1ZNOd7Tt.d.ts → types-OJFbnHKr.d.ts} +4 -4
  130. package/dist/typography.d.ts +1 -1
  131. package/dist/typography.js +2 -2
  132. package/dist/use-dismiss.js +1 -1
  133. package/dist/use-floating.d.ts +1 -1
  134. package/dist/use-floating.js +1 -1
  135. package/dist/{useDismiss-B4TZHcKX.js → useDismiss-RMIXf1tT.js} +1 -1
  136. package/dist/{useDismiss-B4TZHcKX.js.map → useDismiss-RMIXf1tT.js.map} +1 -1
  137. package/dist/{useFloating-CS5NHgoq.js → useFloating-BteZz_UL.js} +1 -1
  138. package/dist/{useFloating-CS5NHgoq.js.map → useFloating-BteZz_UL.js.map} +1 -1
  139. package/dist/{useThemedStyles-B1E0m8Ih.js → useThemedStyles-CUbWXrNN.js} +1 -1
  140. package/dist/{useThemedStyles-B1E0m8Ih.js.map → useThemedStyles-CUbWXrNN.js.map} +1 -1
  141. package/dist/{useThemedStyles-B9fVE7Wy.d.ts → useThemedStyles-v_B4AMSW.d.ts} +1 -1
  142. package/package.json +8 -1
  143. package/dist/DatePicker-Cj2Y6_7E.js.map +0 -1
  144. package/dist/Icon-Ded27Khw.js.map +0 -1
  145. package/dist/MaskModule-NVjkWlFm.js.map +0 -1
  146. /package/dist/{chunk-Bv3O74iX.js → chunk-kJHbKif_.js} +0 -0
@@ -1,13 +1,15 @@
1
- import { n as styled, t as useThemedStyles } from "./useThemedStyles-B1E0m8Ih.js";
2
- import { t as Icon } from "./Icon-Ded27Khw.js";
3
- import { t as Typography } from "./Typography-DOmGYHd6.js";
4
- import { t as BasePopover } from "./BasePopover-BvMT9rNx.js";
5
- import { t as Label } from "./Label-DYeW5MAo.js";
6
- import { t as Button } from "./Button-CxAl6MNt.js";
7
- import { i as MaskModule, n as Locale, r as MaskType } from "./MaskModule-NVjkWlFm.js";
1
+ import { n as styled, t as useThemedStyles } from "./useThemedStyles-CUbWXrNN.js";
2
+ import { t as Icon } from "./Icon-DTFfAYeH.js";
3
+ import { t as Typography } from "./Typography-4iQDPw2N.js";
4
+ import { t as BasePopover } from "./BasePopover-T1mEexwp.js";
5
+ import { t as Label } from "./Label-CaQSxOx8.js";
6
+ import { t as ErrorMessage } from "./ErrorMessage-C_XOzH00.js";
7
+ import { t as Button } from "./Button-BPzDonEf.js";
8
+ import { a as Locale, i as DateMask, n as DateValidator, o as MaskType, s as MaskModule, t as TimeValidator } from "./MaskModule-ZvZ8AfTB.js";
8
9
  import { forwardRef, useEffect, useId, useMemo, useState } from "react";
9
10
  import { jsx, jsxs } from "react/jsx-runtime";
10
- import { addDays, addMonths, addYears, eachDayOfInterval, endOfMonth, endOfWeek, format, isAfter, isBefore, isSameDay, isSameMonth, isWithinInterval, parse, parseISO, setHours, setMinutes, startOfDay, startOfMonth, startOfWeek, startOfYear } from "date-fns";
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 isDisabled = !isSameMonth(day, currentMonth) || disablePastDates && isPastDate || false;
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, currentMonth, selection, disablePastDates, onClick } = props;
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 { currentDate, isDualView, position, disablePastDates } = params;
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: !isDualView ? hasPrevMonthAvailable || hasPrevYearAvailable : position !== "right",
294
- showNextButtons: !isDualView ? true : position !== "left",
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/hooks/useDateTimeInput/utils.ts
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, dateFormat = "dd/MM/yyyy") {
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
- const [hours, minutes] = time.split(":").map(Number);
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 = "dd/MM/yyyy", onChange }) {
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
- setDatetimeValue({
400
- date: format(date, dateFormat),
401
- time: format(date, "HH:mm")
402
- });
403
- }, [value, dateFormat]);
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
- onChange(buildISO(datetimeValue.date, datetimeValue.time, dateFormat));
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 formattedValue = {};
607
+ const formattedChanges = {};
608
+ setErrorMessage("");
409
609
  if (changes.date != null && changes.date !== void 0) {
410
- const module = MaskModule.getMask(Locale.BR, MaskType.DATE);
411
- formattedValue.date = module ? module.format(changes.date) : changes.date;
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.TIME);
415
- formattedValue.time = module ? module.format(changes.time) : changes.time;
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
- ...formattedValue
621
+ ...formattedChanges
420
622
  }));
421
623
  }
422
624
  return {
423
- date: datetimeValue.date,
424
- time: datetimeValue.time,
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
- flex: 1,
660
+ width: "100%",
458
661
  minWidth: 0,
459
662
  display: "flex",
460
663
  alignItems: "center",
461
- gap: "0.5rem"
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
- applyCommonProps: true,
499
- pick: (p) => [p.value]
500
- });
501
- const { date, time, emitChange, handleDateTimeChange } = useDateTimeInput(props);
502
- return /* @__PURE__ */ jsx("div", {
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
- className: classes.container,
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
- onBlur: () => emitChange(),
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: [/* @__PURE__ */ jsx(Icon, {
528
- size: "sm",
529
- name: "general-clock",
530
- color: "var(--px-text-disabled)"
531
- }), /* @__PURE__ */ jsx("input", {
532
- size: 1,
533
- value: time,
534
- placeholder: "12:00",
535
- style: styles.input,
536
- className: classes.input,
537
- onBlur: () => emitChange(),
538
- onChange: (e) => handleDateTimeChange({ time: e.target.value }),
539
- onFocus: () => emitChange()
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
- flexDirection: "column",
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 { styles } = useThemedStyles(props, createDateTimeControlStyles, {
562
- applyCommonProps: true,
563
- pick: (p) => [p.value, p.selectionMode]
564
- });
565
- function handleStartDateChange(date) {
566
- const { value, onChange } = props;
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: [/* @__PURE__ */ jsx(DateTimeInput, {
583
- dateFormat: props.dateFormat,
584
- timeFormat: props.timeFormat,
585
- value: props.value?.start ?? "",
586
- onChange: handleStartDateChange
587
- }), props.selectionMode === "range" ? /* @__PURE__ */ jsx(DateTimeInput, {
588
- value: props?.value?.end,
589
- timeFormat: props.timeFormat,
590
- dateFormat: props.dateFormat,
591
- onChange: handleEndDateChange
592
- }) : null]
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
+ size: "sm",
821
+ name: "arrows-arrow-right",
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(props) {
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 = "double", dateFormat = "dd/MM/yyyy", timeFormat = "24h", ...props }) => {
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__ */ jsxs("div", {
701
- style: styles.monthContainer,
702
- children: [
703
- /* @__PURE__ */ jsx(CalendarHeader, {
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
- }), resolvedProps.viewMode === "double" ? /* @__PURE__ */ jsxs("div", {
725
- style: styles.monthContainer,
726
- children: [/* @__PURE__ */ jsx(CalendarHeader, {
727
- isDualView: true,
728
- position: "right",
729
- currentDate: secondaryCalendar.currentDate,
730
- disablePastDates: resolvedProps.disablePastDates,
731
- onNavAction: mainCalendar.handleNavAction
732
- }), /* @__PURE__ */ jsx(CalendarMonth, {
733
- selection: resolvedProps.value,
734
- days: secondaryCalendar.days,
735
- disablePastDates: resolvedProps.disablePastDates,
736
- onDayClick: handleSelect
737
- })]
738
- }) : null]
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({ dateFormat = "dd/MM/yyyy", ...props }, ref) {
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 startDate = format(start, dateFormat);
797
- const endDate = end ? format(end, dateFormat) : "";
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-Cj2Y6_7E.js.map
1228
+ //# sourceMappingURL=DatePicker-C6WesC4Z.js.map