softable-pixels-web 1.3.2 → 1.3.3

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.
@@ -6,7 +6,7 @@ import { t as BasePopover } from "./BasePopover-BsPsBQj2.js";
6
6
  import { t as Label } from "./Label-bfESBaYl.js";
7
7
  import { t as ErrorMessage } from "./ErrorMessage-DE8DECL9.js";
8
8
  import { t as Button } from "./Button-DXCUuf_n.js";
9
- import { a as DateMask, c as MaskModule, n as DateValidator, o as Locale, s as MaskType, t as TimeValidator } from "./MaskModule-Bt6ofS1m.js";
9
+ import { a as DateMask, c as MaskModule, n as DateValidator, o as Locale, s as MaskType, t as TimeValidator } from "./MaskModule-C69d7U3p.js";
10
10
  import { forwardRef, useEffect, useId, useMemo, useRef, useState } from "react";
11
11
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
12
12
  import { motion } from "framer-motion";
@@ -1269,4 +1269,4 @@ const DatePicker = ({ placementContainer = "bottom-start", ...props }) => {
1269
1269
 
1270
1270
  //#endregion
1271
1271
  export { types_exports as n, DatePicker as t };
1272
- //# sourceMappingURL=DatePicker-Cir92mgT.js.map
1272
+ //# sourceMappingURL=DatePicker-BbradBP7.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker-Cir92mgT.js","names":["CalendarDay: React.FC<CalendarDayProps>","CalendarMonth: React.FC<CalendarMonthProps>","NavButton: React.FC<NavButtonProps>","CalendarHeader: React.FC<Props>","PeriodSwitchItem: React.FC<Props>","PERIOD_OPTIONS: PeriodOption[]","PeriodSwitch: React.FC<PeriodSwitchProps>","DEFAULT_TIME_FORMAT: TimeFormat","DEFAULT_VIEW_MODE: CalendarViewMode","DEFAULT_DATE_FORMAT: DateFormat","DATE_FORMAT_MASK_MAPPER: Record<DateFormat, DateMaskFormat>","maskFormat: DateMaskFormat","day: string","month: string","year: string","format","time: string","period: 'am' | 'pm'","formattedChanges: Partial<DateTimeValues>","DateTimeInput: React.FC<DateTimeInputProps>","draft: DraftPickedDate","newValues: PickedDate","DateTimeControl: React.FC<DateTimeControlProps>","days","Calendar: React.FC<CalendarProps>","DatePickerTrigger","DatePicker: React.FC<DatePickerProps>"],"sources":["../src/components/commons/toolkit/Calendar/components/CalendarMonth/components/CalendarDay/utils.ts","../src/components/commons/toolkit/Calendar/components/CalendarMonth/components/CalendarDay/styles.ts","../src/components/commons/toolkit/Calendar/components/CalendarMonth/components/CalendarDay/index.tsx","../src/components/commons/toolkit/Calendar/components/CalendarMonth/constants.ts","../src/components/commons/toolkit/Calendar/components/CalendarMonth/styles.ts","../src/components/commons/toolkit/Calendar/components/CalendarMonth/index.tsx","../src/components/commons/toolkit/Calendar/components/CalendarHeader/components/NavButton/styles.ts","../src/components/commons/toolkit/Calendar/components/CalendarHeader/components/NavButton/index.tsx","../src/components/commons/toolkit/Calendar/components/CalendarHeader/utils.ts","../src/components/commons/toolkit/Calendar/components/CalendarHeader/styles.ts","../src/components/commons/toolkit/Calendar/components/CalendarHeader/index.tsx","../src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/components/PeriodSwitch/components/PeriodSwitchItem/styles.ts","../src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/components/PeriodSwitch/components/PeriodSwitchItem/index.tsx","../src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/components/PeriodSwitch/constants.ts","../src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/components/PeriodSwitch/styles.ts","../src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/components/PeriodSwitch/index.tsx","../src/components/commons/toolkit/Calendar/constants.ts","../src/components/commons/toolkit/Calendar/components/DateTimeControl/constants.ts","../src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/hooks/useDateTimeInput/utils/buildISODate.ts","../src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/hooks/useDateTimeInput/utils/errors.ts","../src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/hooks/useDateTimeInput/index.ts","../src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/styles.ts","../src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/index.tsx","../src/components/commons/toolkit/Calendar/components/DateTimeControl/hooks/useDateTimeControl/index.ts","../src/components/commons/toolkit/Calendar/components/DateTimeControl/styles.ts","../src/components/commons/toolkit/Calendar/components/DateTimeControl/index.tsx","../src/components/commons/toolkit/Calendar/hooks/useCalendar.ts","../src/components/commons/toolkit/Calendar/styles.ts","../src/components/commons/toolkit/Calendar/index.tsx","../src/components/commons/inputs/DatePicker/components/DatePickerTrigger/utils.ts","../src/components/commons/inputs/DatePicker/components/DatePickerTrigger/styles.ts","../src/components/commons/inputs/DatePicker/components/DatePickerTrigger/index.tsx","../src/components/commons/inputs/DatePicker/hooks/useDatePicker.ts","../src/components/commons/inputs/DatePicker/styles.ts","../src/components/commons/inputs/DatePicker/types.ts","../src/components/commons/inputs/DatePicker/index.tsx"],"sourcesContent":["// External Libraries\nimport { ptBR } from 'date-fns/locale'\nimport { format } from 'date-fns/format'\nimport { isAfter } from 'date-fns/isAfter'\nimport { isBefore } from 'date-fns/isBefore'\nimport { endOfDay } from 'date-fns/endOfDay'\nimport { isSameDay } from 'date-fns/isSameDay'\nimport { startOfDay } from 'date-fns/startOfDay'\nimport { isSameMonth } from 'date-fns/isSameMonth'\nimport { isWithinInterval } from 'date-fns/isWithinInterval'\n\n// Types\nimport type { PickedDate } from '../../../../types'\n\ninterface DayMetadataParams {\n day: Date\n currentMonth: Date\n selection?: PickedDate\n disablePastDates?: boolean | Date\n disableFutureDates?: boolean | Date\n}\n\nfunction resolveReferenceDate(prop: boolean | Date | undefined): Date | null {\n if (!prop) return null\n if (prop === true) return new Date()\n return prop\n}\n\nexport function getDayMetadata(params: DayMetadataParams) {\n const { day, currentMonth, selection, disablePastDates, disableFutureDates } =\n params\n\n const pastRef = resolveReferenceDate(disablePastDates)\n const futureRef = resolveReferenceDate(disableFutureDates)\n const isPastDate = pastRef ? isBefore(day, startOfDay(pastRef)) : false\n const isFutureDate = futureRef ? isAfter(day, endOfDay(futureRef)) : false\n const isOutsideMonth = !isSameMonth(day, currentMonth)\n const isDisabled = isOutsideMonth || isPastDate || isFutureDate\n\n if (!selection) {\n const ariaLabel = getAriaLabel(day, {\n isDisabled,\n isBetween: false,\n isSelected: false\n })\n\n return {\n ariaLabel,\n isDisabled,\n isSelected: false,\n isBetween: false,\n isRangeEnd: false,\n isRangeStart: false\n }\n }\n\n const { start, end } = selection\n\n const isRangeStart = start ? isSameDay(day, start) : false\n const isRangeEnd = end ? isSameDay(day, end) : false\n\n const isBetween =\n start && end\n ? isWithinInterval(startOfDay(day), {\n start: startOfDay(start),\n end: startOfDay(end)\n })\n : false\n const isSelected = isRangeStart || isRangeEnd\n\n const ariaLabel = getAriaLabel(day, { isSelected, isBetween, isDisabled })\n\n return {\n ariaLabel,\n isBetween,\n isDisabled,\n isSelected,\n isRangeEnd,\n isRangeStart\n }\n}\n\nfunction getAriaLabel(\n day: Date,\n options: { isSelected: boolean; isBetween: boolean; isDisabled: boolean }\n) {\n const { isSelected, isBetween, isDisabled } = options\n const baseLabel = format(day, \"d 'de' MMMM 'de' yyyy\", { locale: ptBR })\n\n if (isSelected) return `${baseLabel}, selecionado`\n if (isBetween) return `${baseLabel}, dentro do intervalo`\n if (isDisabled) return `${baseLabel}, indisponível`\n\n return baseLabel\n}\n","import type { CalendarDayProps } from './types'\nimport { styled } from '@hooks/useThemedStyles/types'\n\ninterface StylesProps extends CalendarDayProps {\n isBetween: boolean\n isSelected: boolean\n isRangeStart: boolean\n isRangeEnd: boolean\n isDisabled: boolean\n}\n\nexport function createCalendarDayStyles(params: StylesProps) {\n return styled({\n container: {\n width: '100%',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n\n backgroundColor: getContainerBackgroundColor(params),\n\n borderTopLeftRadius: getContainerBorderLeft(params),\n borderBottomLeftRadius: getContainerBorderLeft(params),\n borderTopRightRadius: getContainerBorderRight(params),\n borderBottomRightRadius: getContainerBorderRight(params)\n },\n\n button: {\n display: 'flex',\n width: '2.2rem',\n height: '2.2rem',\n alignItems: 'center',\n justifyContent: 'center',\n\n backgroundColor: getButtonBackgroundColor(params),\n borderRadius: getButtonBorderRadius(params),\n\n transition: 'all 200ms ease-in-out',\n cursor: params.isDisabled ? 'not-allowed' : 'pointer',\n opacity: params.isDisabled ? 0.5 : 1,\n\n __rules: {\n '&:hover': {\n opacity: '0.85'\n },\n '&:disabled': {\n opacity: '0.5',\n cursor: 'not-allowed'\n }\n }\n }\n })\n}\n\nfunction getContainerBackgroundColor({ isBetween }: StylesProps): string {\n if (isBetween) {\n return 'rgba(14, 178, 76, 0.1)'\n }\n\n return 'transparent'\n}\n\nfunction getContainerBorderLeft({ isRangeStart }: StylesProps) {\n return isRangeStart ? '50%' : '0'\n}\n\nfunction getContainerBorderRight({ isRangeEnd }: StylesProps) {\n return isRangeEnd ? '50%' : '0'\n}\n\nfunction getButtonBackgroundColor({\n isSelected,\n isRangeStart,\n isRangeEnd\n}: StylesProps): string {\n if (isSelected || isRangeStart || isRangeEnd) {\n return 'var(--px-btn-filled-bg)'\n }\n\n return 'transparent'\n}\n\nfunction getButtonBorderRadius({\n isBetween,\n isRangeStart,\n isRangeEnd\n}: StylesProps): string {\n if (isBetween && !isRangeStart && !isRangeEnd) {\n return '0'\n }\n\n return '50%'\n}\n","// External Libraries\nimport type React from 'react'\nimport { useMemo } from 'react'\n\n// Components\nimport { Typography } from '@components/commons/toolkit/Typography'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Utils\nimport { getDayMetadata } from './utils'\n\n// Types\nimport type { CalendarDayProps } from './types'\n\n// Styles\nimport { createCalendarDayStyles } from './styles'\n\nexport const CalendarDay: React.FC<CalendarDayProps> = props => {\n // Constants\n const {\n day,\n selection,\n currentMonth,\n disablePastDates,\n disableFutureDates,\n onClick\n } = props\n const dayConfig = useMemo(\n () =>\n getDayMetadata({\n day,\n selection,\n currentMonth,\n disablePastDates,\n disableFutureDates\n }),\n [day, selection, currentMonth, disablePastDates, disableFutureDates]\n )\n\n // Hooks\n const { styles, classes } = useThemedStyles(\n { ...props, ...dayConfig },\n createCalendarDayStyles,\n {\n applyCommonProps: true\n }\n )\n\n // Functions\n function handleClick() {\n onClick(day)\n }\n\n return (\n <div style={styles.container}>\n <button\n type=\"button\"\n style={styles.button}\n className={classes.button}\n disabled={dayConfig.isDisabled}\n aria-label={dayConfig.ariaLabel}\n onClick={handleClick}\n >\n <Typography\n variant=\"b2\"\n color={dayConfig.isSelected ? 'white' : 'var(--px-text-secondary)'}\n fontWeight={\n dayConfig.isSelected || dayConfig.isBetween ? 'medium' : 'regular'\n }\n >\n {day.getDate()}\n </Typography>\n </button>\n </div>\n )\n}\n","export const WEEK_DAYS = [\n { short: 'D', full: 'Domingo' },\n { short: 'S', full: 'Segunda' },\n { short: 'T', full: 'Terça' },\n { short: 'Q', full: 'Quarta' },\n { short: 'Q', full: 'Quinta' },\n { short: 'S', full: 'Sexta' },\n { short: 'S', full: 'Sábado' }\n] as const\n","import { styled } from '@hooks/useThemedStyles/types'\nimport type { CalendarMonthProps } from './types'\n\nexport function createCalendarMonthStyles(props: CalendarMonthProps) {\n return styled({\n weekDays: {\n display: 'grid',\n gridTemplateColumns: 'repeat(7, 2.5rem)'\n },\n calendarDays: {\n display: 'grid',\n gridTemplateColumns: 'repeat(7, 2.5rem)'\n },\n weekDay: {\n width: '2.5rem',\n height: '2.5rem',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center'\n }\n })\n}\n","// External Libraries\nimport type React from 'react'\n\n// Components\nimport { CalendarDay } from './components/CalendarDay'\nimport { Typography } from '@components/commons/toolkit/Typography'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Utils\nimport { WEEK_DAYS } from './constants'\n\n// Types\nimport type { CalendarMonthProps } from './types'\n\n// Styles\nimport { createCalendarMonthStyles } from './styles'\n\nexport const CalendarMonth: React.FC<CalendarMonthProps> = props => {\n // Hooks\n const { styles } = useThemedStyles(props, createCalendarMonthStyles)\n\n // Constants\n const currentMonth = props.days.length\n ? props.days[Math.floor(props.days.length / 2)]\n : new Date()\n\n // Functions\n function renderWeekDays() {\n return WEEK_DAYS.map(day => (\n <div key={day.full} style={styles.weekDay}>\n <Typography variant=\"b2\" className=\"text-tx-primary\">\n {day.short}\n </Typography>\n </div>\n ))\n }\n\n return (\n <div>\n <div style={styles.weekDays}>{renderWeekDays()}</div>\n\n <div style={styles.calendarDays}>\n {props.days.map(day => (\n <CalendarDay\n day={day}\n key={day.toISOString()}\n selection={props.selection}\n currentMonth={currentMonth}\n disablePastDates={props.disablePastDates}\n disableFutureDates={props.disableFutureDates}\n onClick={props.onDayClick}\n />\n ))}\n </div>\n </div>\n )\n}\n","import { styled } from '@hooks/useThemedStyles/types'\nimport type { NavButtonProps } from './types'\n\nexport function createNavButtonStyles(_props: NavButtonProps) {\n return styled({\n container: {\n display: 'flex',\n\n cursor: 'pointer',\n padding: '0.125rem',\n\n borderRadius: '50%',\n transition: 'background-color 0.2s ease-out',\n rotate: _props.next ? '180deg' : '0deg',\n\n __rules: {\n '&:hover': {\n backgroundColor: 'var(--color-gray-50)'\n }\n }\n }\n })\n}\n","// External Libraries\nimport type React from 'react'\n\n// Components\nimport { Icon } from '@components/commons/toolkit/Icon'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Types\nimport type { NavButtonProps } from './types'\n\n// Styles\nimport { createNavButtonStyles } from './styles'\n\nexport const NavButton: React.FC<NavButtonProps> = ({\n visible = true,\n ...props\n}) => {\n // Hooks\n\n const { styles, classes } = useThemedStyles(\n { visible, ...props },\n createNavButtonStyles,\n {\n applyCommonProps: true,\n pick: p => [p.next, p.visible]\n }\n )\n\n if (!visible) return null\n\n return (\n <button\n type=\"button\"\n style={styles.container}\n className={classes.container}\n onClick={props.onClick}\n >\n <Icon name={props.icon} color=\"var(--px-text-secondary)\" />\n </button>\n )\n}\n","// External Libraries\nimport { isBefore } from 'date-fns/isBefore'\nimport { startOfYear } from 'date-fns/startOfYear'\nimport { startOfMonth } from 'date-fns/startOfMonth'\n\ninterface NavMetadataParams {\n currentDate: Date\n isDualView: boolean\n position: 'left' | 'right'\n disablePastDates?: boolean | Date\n disableFutureDates?: boolean | Date\n}\n\nexport function getNavMetadata(params: NavMetadataParams) {\n const { currentDate, disablePastDates } = params\n\n const pastRef = !disablePastDates\n ? null\n : disablePastDates instanceof Date\n ? disablePastDates\n : new Date()\n\n const hasPrevMonthAvailable =\n !pastRef || isBefore(startOfMonth(pastRef), startOfMonth(currentDate))\n\n const hasPrevYearAvailable =\n !pastRef || isBefore(startOfYear(pastRef), startOfYear(currentDate))\n\n return {\n hasPrevYearAvailable,\n hasPrevMonthAvailable\n }\n}\n","import { styled } from '@hooks/useThemedStyles/types'\nimport type { CalendarHeaderProps } from './types'\n\nexport function createCalendarHeaderStyles(_props: CalendarHeaderProps) {\n return styled({\n container: {\n width: '100%',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n paddingBlock: '0.375rem'\n },\n\n leftButtonsContainer: {\n minWidth: '3.5rem',\n minHeight: '1.5rem',\n\n display: 'flex',\n alignItems: 'center',\n gap: '0.25rem'\n },\n\n rightButtonsContainer: {\n minWidth: '3.5rem',\n minHeight: '1.5rem',\n\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'flex-end',\n gap: '0.25rem'\n }\n })\n}\n","// External Libraries\nimport type React from 'react'\nimport { ptBR } from 'date-fns/locale'\nimport { format } from 'date-fns/format'\n\n// Components\nimport { NavButton } from './components/NavButton'\nimport { Typography } from '@components/commons/toolkit/Typography'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Utils\nimport { getNavMetadata } from './utils'\nimport { capitalize } from '@utils/functions'\n\n// Types\nimport type { CalendarNavAction } from '../../types'\n\n// Styles\nimport { createCalendarHeaderStyles } from './styles'\n\ninterface Props {\n currentDate: Date\n isDualView: boolean\n position: 'left' | 'right'\n disablePastDates?: boolean | Date\n disableFutureDates?: boolean | Date\n onNavAction: (action: CalendarNavAction) => void\n}\n\nexport const CalendarHeader: React.FC<Props> = props => {\n // Constants\n const { onNavAction, ...rest } = props\n const { hasPrevYearAvailable, hasPrevMonthAvailable } = getNavMetadata(rest)\n\n // Hooks\n const { styles } = useThemedStyles(props, createCalendarHeaderStyles, {\n applyCommonProps: true,\n pick: p => [p.currentDate, p.isDualView, p.position]\n })\n\n // Functions\n function renderMonthName() {\n const name = format(rest.currentDate, 'MMMM yyyy', { locale: ptBR })\n return capitalize(name)\n }\n\n return (\n <div style={styles.container}>\n <div style={styles.leftButtonsContainer}>\n <NavButton\n icon=\"chevrons-left\"\n visible={hasPrevMonthAvailable}\n onClick={() => onNavAction('prev-month')}\n />\n\n <NavButton\n icon=\"chevrons-double-left\"\n visible={hasPrevYearAvailable}\n onClick={() => onNavAction('prev-year')}\n />\n </div>\n\n <Typography variant=\"b2\" align=\"center\" fontWeight=\"semibold\">\n {renderMonthName()}\n </Typography>\n\n <div style={styles.rightButtonsContainer}>\n <NavButton\n next\n icon=\"chevrons-double-left\"\n onClick={() => onNavAction('next-year')}\n />\n\n <NavButton\n next\n icon=\"chevrons-left\"\n onClick={() => onNavAction('next-month')}\n />\n </div>\n </div>\n )\n}\n","// External Libraries\nimport { styled } from '@hooks/useThemedStyles/types'\n\ninterface Params {\n selected?: boolean\n}\n\nexport function createTabSwitchItemStyles({ selected }: Params) {\n return styled({\n item: {\n minHeight: '1rem',\n position: 'relative',\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 4,\n background: 'transparent',\n border: 0,\n padding: '0.25rem',\n\n userSelect: 'none',\n whiteSpace: 'nowrap',\n __rules: { '& > p': { zIndex: 1 } }\n },\n\n selectedBg: {\n position: 'absolute',\n inset: 0,\n borderRadius: 6,\n border: '1px solid var(--px-border-primary)'\n }\n })\n}\n","// External Libraries\nimport { motion } from 'framer-motion'\n\n// Components\nimport { Typography } from '@components/commons/toolkit/Typography'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Types\nimport type { PeriodOption } from '../../types'\nimport type { DateTimePeriod } from '../../../../types'\n\n// Styles\nimport { createTabSwitchItemStyles } from './styles'\n\ninterface Props {\n layoutId: string\n selected: boolean\n option: PeriodOption\n onClick: (value: DateTimePeriod) => void\n onBlur?: () => void\n}\n\nexport const PeriodSwitchItem: React.FC<Props> = props => {\n const { option, selected, onClick } = props\n\n const { styles, classes } = useThemedStyles(\n props,\n createTabSwitchItemStyles,\n {\n pick: p => [p.selected]\n }\n )\n\n return (\n <button\n tabIndex={0}\n type=\"button\"\n style={styles.item}\n className={classes.item}\n onBlur={props.onBlur}\n onClick={() => onClick(option.value)}\n >\n {selected ? (\n <motion.div layoutId={props.layoutId} style={styles.selectedBg} />\n ) : null}\n\n <Typography variant=\"b1\" fontSize=\"0.625rem\" fontWeight=\"semibold\">\n {option.label}\n </Typography>\n </button>\n )\n}\n","import type { PeriodOption } from './types'\n\nexport const PERIOD_OPTIONS: PeriodOption[] = [\n { value: 'am', label: 'AM' },\n { value: 'pm', label: 'PM' }\n]\n","// Types\nimport type { PeriodSwitchProps } from './types'\nimport { styled } from '@hooks/useThemedStyles/types'\n\nexport function createTabSwitchStyles(props: PeriodSwitchProps) {\n return styled({\n container: {\n width: 'fit-content',\n\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n color: 'var(--px-text-primary, #4b5563)',\n\n gap: 0,\n __rules: { '& svg': { zIndex: 1 } }\n }\n })\n}\n","// External Libraries\nimport type React from 'react'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Components\nimport { PeriodSwitchItem } from './components/PeriodSwitchItem'\n\n// Utils\nimport { PERIOD_OPTIONS } from './constants'\n\n// Types\nimport type { PeriodSwitchProps } from './types'\n\n// Styles\nimport { createTabSwitchStyles } from './styles'\n\nexport * from './types'\n\nexport const PeriodSwitch: React.FC<PeriodSwitchProps> = props => {\n {\n const { currentValue, onChange } = props\n\n const { styles, classes } = useThemedStyles(props, createTabSwitchStyles, {\n pick: p => [p.currentValue],\n applyCommonProps: true\n })\n\n return (\n <div style={styles.container} className={classes.container}>\n {PERIOD_OPTIONS.map(opt => (\n <PeriodSwitchItem\n option={opt}\n key={String(opt.value)}\n layoutId={props.layoutId}\n selected={currentValue === opt.value}\n onClick={onChange}\n onBlur={props.onBlur}\n />\n ))}\n </div>\n )\n }\n}\n","import type { CalendarViewMode, DateFormat, TimeFormat } from './types'\n\nexport const DEFAULT_TIME_FORMAT: TimeFormat = '24h'\nexport const DEFAULT_VIEW_MODE: CalendarViewMode = 'double'\nexport const DEFAULT_DATE_FORMAT: DateFormat = 'dd/MM/yyyy'\nexport const DEFAULT_DISPLAY_DATE_FORMAT = 'dd MMMM yyyy'\n","import type { DateFormat } from '@components/commons/toolkit/Calendar/types'\nimport type { DateMaskFormat } from '@services/MaskModule/locales/br/masks/DateMask'\n\nexport const DATE_FORMAT_MASK_MAPPER: Record<DateFormat, DateMaskFormat> = {\n 'dd/MM/yyyy': 'DD/MM/YYYY',\n 'MM/dd/yyyy': 'MM/DD/YYYY',\n 'yyyy/MM/dd': 'YYYY/MM/DD'\n}\n","// External Libraries\nimport { parse } from 'date-fns/parse'\nimport { setHours } from 'date-fns/setHours'\nimport { setMinutes } from 'date-fns/setMinutes'\n\n// Utils\nimport {\n DEFAULT_DATE_FORMAT,\n DEFAULT_TIME_FORMAT\n} from '@components/commons/toolkit/Calendar/constants'\n\n// Types\nimport type { DateTimeValues } from '../../../types'\nimport type { CalendarFormatValues } from '@components/commons/toolkit/Calendar/types'\n\nexport function makeInitialDateTime(): DateTimeValues {\n return { time: '', date: '', period: 'am' }\n}\n\ninterface BuildISOParams extends CalendarFormatValues {\n date: string\n time: string\n period?: string\n}\n\nexport function buildISO({\n date,\n time,\n period = 'am',\n timeFormat = DEFAULT_TIME_FORMAT,\n dateFormat = DEFAULT_DATE_FORMAT\n}: BuildISOParams) {\n const baseDate = parse(date, dateFormat, new Date())\n let [hours, minutes] = time.split(':').map(Number)\n\n if (timeFormat === '12h') {\n if (period === 'pm' && hours !== 12) {\n hours += 12\n } else if (period === 'am' && hours === 12) {\n hours = 0\n }\n }\n\n const withTime = setMinutes(setHours(baseDate, hours || 0), minutes || 0)\n\n return withTime.toISOString()\n}\n","// External Libraries\nimport { isAfter } from 'date-fns/isAfter'\nimport { endOfDay } from 'date-fns/endOfDay'\nimport { isBefore } from 'date-fns/isBefore'\nimport { startOfDay } from 'date-fns/startOfDay'\n\n// Services\nimport { DateValidator } from '@services/MaskModule/locales/br/validators/DateValidator'\nimport { TimeValidator } from '@services/MaskModule/locales/br/validators/TimeValidator'\n\n// Utils\nimport {\n DEFAULT_DATE_FORMAT,\n DEFAULT_TIME_FORMAT\n} from '@components/commons/toolkit/Calendar/constants'\nimport { DATE_FORMAT_MASK_MAPPER } from '../../../../../constants'\n\n// Types\nimport type {\n DateFormat,\n TimeFormat\n} from '@components/commons/toolkit/Calendar/types'\nimport type { DateTimeValues } from '../../../types'\nimport type { DateMaskFormat } from '@services/MaskModule/locales/br/masks/DateMask'\n\ninterface CheckErrorsParams {\n values: DateTimeValues\n dateFormat?: DateFormat\n timeFormat?: TimeFormat\n disableFutureDates?: boolean\n disablePastDates?: boolean\n isDateTimePicker?: boolean\n}\n\nexport function checkErrors({\n values,\n disablePastDates,\n disableFutureDates,\n isDateTimePicker,\n timeFormat = DEFAULT_TIME_FORMAT,\n dateFormat = DEFAULT_DATE_FORMAT\n}: CheckErrorsParams): string | null {\n const maskFormat: DateMaskFormat = DATE_FORMAT_MASK_MAPPER[dateFormat]\n\n const dateValidator = new DateValidator({ dateFormat: maskFormat })\n const timeValidator = new TimeValidator({ format: timeFormat })\n\n const isValidDate = dateValidator.validate(values.date)\n const isValidTime = isDateTimePicker\n ? timeValidator.validate(values.time)\n : true\n\n let error = ''\n\n if (!isValidTime) error = 'Formato de hora inválida'\n\n if (!isValidDate) error = 'Formato de data inválida'\n\n if (isValidDate) {\n const endOfToday = endOfDay(new Date())\n const startOfToday = startOfDay(new Date())\n\n const dateISO = createISODate(values.date, dateFormat)\n\n if (\n dateISO &&\n disableFutureDates &&\n isAfter(dateISO, endOfToday.toISOString())\n ) {\n error = 'Data futura indisponível'\n }\n\n if (\n dateISO &&\n disablePastDates &&\n isBefore(dateISO, startOfToday.toISOString())\n ) {\n error = 'Data passada indisponível'\n }\n }\n\n return error ?? null\n}\n\nexport function createISODate(value: string, format: DateFormat): Date | null {\n const parts = value.split('/')\n\n if (parts.length !== 3) return null\n\n let day: string\n let month: string\n let year: string\n\n switch (format) {\n case 'dd/MM/yyyy':\n ;[day, month, year] = parts\n break\n\n case 'MM/dd/yyyy':\n ;[month, day, year] = parts\n break\n\n case 'yyyy/MM/dd':\n ;[year, month, day] = parts\n break\n }\n\n return new Date(Number(year), Number(month) - 1, Number(day))\n}\n","// External Libraries\nimport { useEffect, useState } from 'react'\nimport { format } from 'date-fns/format'\nimport { parseISO } from 'date-fns/parseISO'\n\n// Utils\nimport {\n DEFAULT_DATE_FORMAT,\n DEFAULT_TIME_FORMAT\n} from '@components/commons/toolkit/Calendar/constants'\nimport { DATE_FORMAT_MASK_MAPPER } from '../../../../constants'\nimport { buildISO, checkErrors, makeInitialDateTime } from './utils'\n\n// Types\nimport type { UseDateTimeInputParams } from './types'\nimport type { DateTimePeriod, DateTimeValues } from '../../types'\nimport { Locale, MaskModule, MaskType } from '@services/MaskModule'\nimport { DateMask } from '@services/MaskModule/locales/br/masks/DateMask'\n\nexport function useDateTimeInput({\n value,\n disablePastDates,\n disableFutureDates,\n isDateTimePicker,\n timeFormat = DEFAULT_TIME_FORMAT,\n dateFormat = DEFAULT_DATE_FORMAT,\n onError,\n onChange\n}: UseDateTimeInputParams) {\n // States\n const [errorMessage, setErrorMessage] = useState('')\n const [datetimeValue, setDatetimeValue] = useState(makeInitialDateTime)\n\n useEffect(() => {\n if (!value) return\n\n const date = parseISO(value)\n\n let time: string\n let period: 'am' | 'pm' = 'am'\n\n if (timeFormat === '12h') {\n time = format(date, 'hh:mm')\n period = format(date, 'a').toLowerCase() as DateTimePeriod\n } else {\n time = format(date, 'HH:mm')\n }\n\n setDatetimeValue(prev => ({\n ...prev,\n time,\n period,\n date: format(date, dateFormat)\n }))\n }, [value, dateFormat, timeFormat])\n\n function emitChange() {\n const error = checkErrors({\n dateFormat,\n timeFormat,\n disablePastDates,\n disableFutureDates,\n isDateTimePicker,\n values: datetimeValue\n })\n\n if (error) {\n setErrorMessage(error)\n onError?.(true)\n return\n }\n\n onError?.(false)\n const iso = buildISO({ ...datetimeValue, dateFormat, timeFormat })\n\n onChange(iso)\n }\n\n function handleDateTimeChange(changes: Partial<DateTimeValues>) {\n const formattedChanges: Partial<DateTimeValues> = {}\n setErrorMessage('')\n\n if (changes.date != null && changes.date !== undefined) {\n const maskDateFormat = DATE_FORMAT_MASK_MAPPER[dateFormat]\n\n const module = new DateMask({ dateFormat: maskDateFormat })\n formattedChanges.date = module\n ? module.format(changes.date)\n : changes.date\n }\n\n if (changes.time != null && changes.time !== undefined) {\n const module =\n timeFormat === '12h'\n ? MaskModule.getMask(Locale.BR, MaskType.TIME_12H)\n : MaskModule.getMask(Locale.BR, MaskType.TIME_24H)\n\n formattedChanges.time = module\n ? module.format(changes.time)\n : changes.time\n }\n\n if (changes.period) {\n formattedChanges.period = changes.period\n }\n\n setDatetimeValue(prev => ({ ...prev, ...formattedChanges }))\n }\n\n return {\n errorMessage,\n datetimeValue,\n emitChange,\n handleDateTimeChange\n }\n}\n","import type { DateTimeInputProps } from './types'\nimport { styled } from '@hooks/useThemedStyles/types'\n\nexport function createDateTimeInputStyles(_props: DateTimeInputProps) {\n return styled({\n container: {\n width: '17.5rem',\n\n display: 'flex',\n flexDirection: 'column',\n gap: '0.25rem'\n },\n\n content: {\n width: '100%',\n height: '2.5rem',\n\n display: 'flex',\n alignItems: 'center',\n columnGap: '0.25rem',\n\n borderWidth: 1,\n borderStyle: 'solid',\n borderRadius: '0.5rem',\n padding: '0.625rem 0.875rem',\n boxShadow: 'var(--px-shadow-default)',\n borderColor: _props.errorMessage\n ? 'var(--px-color-error)'\n : 'var(--px-border-primary)',\n\n __rules: {\n '&:focus-within': {\n outlineOffset: '-1px',\n outline: '2px solid var(--px-color-primary)'\n }\n }\n },\n\n wrapper: {\n width: '100%',\n minWidth: 0,\n display: 'flex',\n alignItems: 'center',\n\n gap: '0.25rem'\n },\n\n divider: {\n border: 0,\n width: '1px',\n height: '1rem',\n\n marginInline: '0.5rem',\n backgroundColor: 'var(--px-border-primary)'\n },\n\n input: {\n flex: 1,\n width: '100%',\n minWidth: 0,\n fontWeight: 500,\n fontSize: '0.875rem',\n lineHeight: '1.5rem',\n fontFamily: 'inherit',\n color: 'var(--px-text-primary)',\n backgroundColor: 'transparent',\n border: 'none',\n padding: 0,\n __rules: {\n '&:disabled': {\n cursor: 'not-allowed'\n },\n '&:focus': {\n outline: 'none'\n },\n '&::placeholder': {\n fontWeight: 400,\n color: 'var(--px-text-secondary)'\n }\n }\n }\n })\n}\n","// External Libraries\nimport type React from 'react'\n\n// Components\nimport { Icon } from '@components/commons/toolkit/Icon'\nimport { PeriodSwitch } from './components/PeriodSwitch'\nimport { ErrorMessage } from '@components/commons/toolkit/ErrorMessage'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\nimport { useDateTimeInput } from './hooks/useDateTimeInput'\n\n// Types\nimport type { DateTimeInputProps } from './types'\n\n// Styles\nimport { createDateTimeInputStyles } from './styles'\n\nexport const DateTimeInput: React.FC<DateTimeInputProps> = props => {\n // Hooks\n const { styles, classes } = useThemedStyles(\n props,\n createDateTimeInputStyles,\n { applyCommonProps: true }\n )\n const { errorMessage, datetimeValue, emitChange, handleDateTimeChange } =\n useDateTimeInput(props)\n\n // Functions\n function handleKeyDown(e: React.KeyboardEvent<HTMLInputElement>) {\n if (e.key === 'Enter') {\n emitChange()\n }\n }\n\n function handleBlur() {\n emitChange()\n }\n\n return (\n <div style={styles.container}>\n <div style={styles.content} className={classes.content}>\n <div style={styles.wrapper}>\n <Icon\n size=\"sm\"\n name=\"general-calendar\"\n color=\"var(--px-text-disabled)\"\n />\n\n <input\n style={styles.input}\n className={classes.input}\n value={datetimeValue.date}\n placeholder={props.dateFormat}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n onChange={e => handleDateTimeChange({ date: e.target.value })}\n />\n </div>\n\n {props.isDateTimePicker ? (\n <>\n <hr style={styles.divider} />\n\n <div style={styles.wrapper}>\n <Icon\n size=\"sm\"\n name=\"general-clock\"\n color=\"var(--px-text-disabled)\"\n />\n\n <input\n placeholder=\"12:00\"\n style={styles.input}\n className={classes.input}\n value={datetimeValue.time}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n onChange={e => handleDateTimeChange({ time: e.target.value })}\n />\n\n {props.timeFormat === '12h' ? (\n <PeriodSwitch\n layoutId={props.layoutId}\n currentValue={datetimeValue.period}\n onBlur={handleBlur}\n onChange={value => handleDateTimeChange({ period: value })}\n />\n ) : null}\n </div>\n </>\n ) : null}\n </div>\n\n {errorMessage ? <ErrorMessage message={errorMessage} /> : null}\n </div>\n )\n}\n","// External Libraries\nimport { isAfter } from 'date-fns/isAfter'\n\n// Types\nimport type { UseDateTimeControlParams } from './types'\nimport type { PickedDate } from '@components/commons/toolkit/Calendar/types'\n\ntype DraftPickedDate = {\n start?: string\n end?: string\n}\n\nexport function useDateTimeControl({\n value,\n onChange\n}: UseDateTimeControlParams) {\n function handleDateTimeChange(changes: DraftPickedDate) {\n const draft: DraftPickedDate = {\n start: changes.start ?? value?.start,\n end: changes.end ?? value?.end\n }\n\n if (!draft.start) {\n return\n }\n\n const newValues: PickedDate = {\n start: draft.start,\n end: draft.end\n }\n\n if (newValues.end) {\n const startIsAfterEnd = isAfter(newValues.start, newValues.end)\n\n if (startIsAfterEnd) {\n const tempStart = newValues.start\n const tempEnd = newValues.end\n\n newValues.start = tempEnd\n newValues.end = tempStart\n }\n }\n\n onChange(newValues)\n }\n\n return { handleDateTimeChange }\n}\n","// Types\nimport type { DateTimeControlProps } from './types'\nimport type { StyleMap } from '@hooks/useThemedStyles/types'\n\n// Hooks\nimport { styled } from '@hooks/useThemedStyles/types'\n\nexport function createDateTimeControlStyles(\n _props: DateTimeControlProps\n): StyleMap {\n return styled({\n container: {\n width: '100%',\n\n display: 'flex',\n alignItems: _props.viewMode === 'double' ? 'center' : undefined,\n flexDirection: _props.viewMode === 'single' ? 'column' : 'row',\n\n gap: '0.5rem'\n }\n })\n}\n","// External Libraries\nimport type React from 'react'\nimport { useRef } from 'react'\n\n// Components\nimport { Icon } from '@components/commons/toolkit/Icon'\nimport { DateTimeInput } from './components/DateTimeInput'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\nimport { useDateTimeControl } from './hooks/useDateTimeControl'\n\n// Utils\nimport { DEFAULT_VIEW_MODE } from '../../constants'\n\n// Types\nimport type { DateTimeControlProps } from './types'\n\n// Styles\nimport { createDateTimeControlStyles } from './styles'\n\nexport const DateTimeControl: React.FC<DateTimeControlProps> = ({\n viewMode = DEFAULT_VIEW_MODE,\n ...props\n}) => {\n // Constants\n const resolvedProps = { viewMode, ...props }\n\n // Hooks\n const { styles } = useThemedStyles(\n resolvedProps,\n createDateTimeControlStyles,\n {\n applyCommonProps: true\n }\n )\n const { handleDateTimeChange } = useDateTimeControl(resolvedProps)\n\n const startErrorRef = useRef(false)\n const endErrorRef = useRef(false)\n\n function handleStartError(hasError: boolean) {\n startErrorRef.current = hasError\n resolvedProps.onError?.(startErrorRef.current || endErrorRef.current)\n }\n\n function handleEndError(hasError: boolean) {\n endErrorRef.current = hasError\n resolvedProps.onError?.(startErrorRef.current || endErrorRef.current)\n }\n\n return (\n <div style={styles.container}>\n <DateTimeInput\n layoutId=\"start-date\"\n dateFormat={resolvedProps.dateFormat}\n timeFormat={resolvedProps.timeFormat}\n isDateTimePicker={resolvedProps.isDateTimePicker}\n value={resolvedProps.value?.start ?? ''}\n disablePastDates={resolvedProps.disablePastDates}\n disableFutureDates={resolvedProps.disableFutureDates}\n onChange={start => handleDateTimeChange({ start })}\n onError={handleStartError}\n />\n\n {resolvedProps.viewMode === 'double' &&\n resolvedProps.selectionMode === 'range' ? (\n <Icon\n size=\"sm\"\n name=\"arrows-arrow-right\"\n color=\"var(--px-text-secondary)\"\n />\n ) : null}\n\n {resolvedProps.selectionMode === 'range' ? (\n <DateTimeInput\n layoutId=\"end-date\"\n value={resolvedProps?.value?.end}\n timeFormat={resolvedProps.timeFormat}\n dateFormat={resolvedProps.dateFormat}\n isDateTimePicker={resolvedProps.isDateTimePicker}\n disablePastDates={resolvedProps.disablePastDates}\n disableFutureDates={resolvedProps.disableFutureDates}\n onChange={end => handleDateTimeChange({ end })}\n onError={handleEndError}\n />\n ) : null}\n </div>\n )\n}\n","// External Libraries\nimport { useMemo, useState } from 'react'\nimport { addDays } from 'date-fns/addDays'\nimport { addYears } from 'date-fns/addYears'\nimport { addMonths } from 'date-fns/addMonths'\nimport { endOfWeek } from 'date-fns/endOfWeek'\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { startOfWeek } from 'date-fns/startOfWeek'\nimport { startOfMonth } from 'date-fns/startOfMonth'\nimport { eachDayOfInterval } from 'date-fns/eachDayOfInterval'\n\n// Types\nimport type { CalendarNavAction } from '../types'\n\nexport function useCalendar(initialDate = new Date()) {\n // States\n const [currentDate, setCurrentDate] = useState(initialDate)\n\n // Constants\n const days = useMemo(() => {\n const start = startOfWeek(startOfMonth(currentDate), { weekStartsOn: 0 })\n const end = endOfWeek(endOfMonth(currentDate), { weekStartsOn: 0 })\n let days = eachDayOfInterval({ start, end })\n\n if (days.length < 42) {\n const diff = 42 - days.length\n const last = end\n\n const extraDays = Array.from({ length: diff }, (_, i) =>\n addDays(last, i + 1)\n )\n\n days = [...days, ...extraDays]\n }\n\n return days\n }, [currentDate])\n\n // Functions\n function handleNavAction(action: CalendarNavAction) {\n switch (action) {\n case 'next-month':\n setCurrentDate(prev => addMonths(prev, 1))\n break\n\n case 'prev-month':\n setCurrentDate(prev => addMonths(prev, -1))\n break\n\n case 'next-year':\n setCurrentDate(prev => addYears(prev, 1))\n break\n\n case 'prev-year':\n setCurrentDate(prev => addYears(prev, -1))\n break\n }\n }\n\n return { currentDate, days, handleNavAction, setCurrentDate }\n}\n","import { styled } from '@hooks/useThemedStyles/types'\n\nexport function createCalendarStyles() {\n return styled({\n container: {\n display: 'flex',\n flexDirection: 'column'\n },\n dateTimeControlContent: {\n display: 'flex',\n\n padding: '0.75rem 1rem',\n paddingBottom: '0'\n },\n monthsContainer: {\n display: 'flex',\n flexDirection: 'row',\n\n alignItems: 'center'\n },\n monthContainer: {\n display: 'flex',\n flexDirection: 'column',\n\n gap: '0.75rem',\n padding: '0.75rem 1rem'\n }\n })\n}\n","// External Libraries\nimport type React from 'react'\nimport { useEffect } from 'react'\nimport { isAfter } from 'date-fns/isAfter'\nimport { parseISO } from 'date-fns/parseISO'\nimport { addMonths } from 'date-fns/addMonths'\nimport { isSameDay } from 'date-fns/isSameDay'\n\n// Components\nimport { CalendarMonth } from './components/CalendarMonth'\nimport { CalendarHeader } from './components/CalendarHeader'\nimport { DateTimeControl } from './components/DateTimeControl'\n\n// Hooks\nimport { useCalendar } from './hooks/useCalendar'\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Utils\nimport {\n DEFAULT_VIEW_MODE,\n DEFAULT_DATE_FORMAT,\n DEFAULT_TIME_FORMAT\n} from './constants'\n\n// Types\nimport type { CalendarProps } from './types'\n\n// Styles\nimport { createCalendarStyles } from './styles'\n\nexport const Calendar: React.FC<CalendarProps> = ({\n viewMode = DEFAULT_VIEW_MODE,\n dateFormat = DEFAULT_DATE_FORMAT,\n timeFormat = DEFAULT_TIME_FORMAT,\n ...props\n}) => {\n const resolvedProps = { timeFormat, dateFormat, viewMode, ...props }\n\n // Hooks\n const mainCalendar = useCalendar()\n const secondaryCalendar = useCalendar(addMonths(mainCalendar.currentDate, 1))\n const { styles } = useThemedStyles(resolvedProps, createCalendarStyles, {\n applyCommonProps: true\n })\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>\n useEffect(() => {\n secondaryCalendar.setCurrentDate(addMonths(mainCalendar.currentDate, 1))\n }, [mainCalendar.currentDate])\n\n // Functions\n function handleSelect(day: Date) {\n const { value, selectionMode, onChange } = resolvedProps\n\n if (selectionMode === 'single') {\n onChange({ start: day.toISOString() })\n } else {\n const start = value?.start ? parseISO(value.start) : null\n const end = value?.end ? parseISO(value.end) : null\n\n if (!start || (start && end)) {\n onChange({ start: day.toISOString(), end: undefined })\n } else if (start && !end) {\n const [from, to] =\n isAfter(day, start) || isSameDay(day, start)\n ? [start, day]\n : [day, start]\n\n onChange({ start: from.toISOString(), end: to.toISOString() })\n }\n }\n }\n\n return (\n <div style={styles.container}>\n <div style={styles.dateTimeControlContent}>\n <DateTimeControl\n {...resolvedProps}\n onError={resolvedProps.onDateTimeError}\n />\n </div>\n\n <div style={styles.monthsContainer}>\n <div style={styles.monthContainer}>\n <CalendarHeader\n position=\"left\"\n currentDate={mainCalendar.currentDate}\n isDualView={resolvedProps.viewMode === 'double'}\n disablePastDates={resolvedProps.disablePastDates}\n disableFutureDates={resolvedProps.disableFutureDates}\n onNavAction={mainCalendar.handleNavAction}\n />\n\n <CalendarMonth\n days={mainCalendar.days}\n selection={resolvedProps.value}\n disablePastDates={resolvedProps.disablePastDates}\n disableFutureDates={resolvedProps.disableFutureDates}\n onDayClick={handleSelect}\n />\n </div>\n\n {resolvedProps.viewMode === 'double' ? (\n <div style={styles.monthContainer}>\n <CalendarHeader\n isDualView\n position=\"right\"\n currentDate={secondaryCalendar.currentDate}\n disablePastDates={resolvedProps.disablePastDates}\n disableFutureDates={resolvedProps.disableFutureDates}\n onNavAction={mainCalendar.handleNavAction}\n />\n\n <CalendarMonth\n days={secondaryCalendar.days}\n selection={resolvedProps.value}\n disablePastDates={resolvedProps.disablePastDates}\n disableFutureDates={resolvedProps.disableFutureDates}\n onDayClick={handleSelect}\n />\n </div>\n ) : null}\n </div>\n </div>\n )\n}\n","import type { TimeFormat } from '../../types'\n\ninterface BuildDisplayFormatParams {\n displayDateFormat: string\n isDateTimePicker: boolean\n timeFormat: TimeFormat\n}\n\nfunction hasTimeTokens(formatStr: string) {\n return /(H{1,2}|h{1,2}|m{1,2}|a)/.test(formatStr)\n}\n\nfunction normalizeTimeFormat(formatStr: string, timeFormat: '12h' | '24h') {\n if (timeFormat === '24h') {\n return formatStr\n .replace(/h{1,2}/g, match => (match.length === 2 ? 'HH' : 'H'))\n .replace(/\\s*a/g, '')\n }\n\n return formatStr.replace(/H{1,2}/g, match =>\n match.length === 2 ? 'hh' : 'h'\n )\n}\n\nfunction getDefaultTimeFormat(timeFormat: '12h' | '24h') {\n return timeFormat === '24h' ? 'HH:mm' : 'hh:mm a'\n}\n\nexport function buildDisplayFormat({\n displayDateFormat,\n isDateTimePicker,\n timeFormat\n}: BuildDisplayFormatParams) {\n const formatHasTime = hasTimeTokens(displayDateFormat)\n\n if (!isDateTimePicker) {\n return formatHasTime\n ? displayDateFormat.replace(/\\s*(H{1,2}|h{1,2}|m{1,2}|a|:)+/g, '')\n : displayDateFormat\n }\n\n if (formatHasTime) {\n return normalizeTimeFormat(displayDateFormat, timeFormat)\n }\n\n const timeFormatStr = getDefaultTimeFormat(timeFormat)\n return `${displayDateFormat} ${timeFormatStr}`\n}\n","import { styled } from '@hooks/useThemedStyles/types'\nimport type { DatePickerTriggerProps } from './types'\n\nexport function createDatePickerTriggerStyles(props: DatePickerTriggerProps) {\n return styled({\n container: {\n width: '100%',\n\n display: 'flex',\n flexDirection: 'column',\n\n gap: '0.5rem',\n\n opacity: props.disabled ? 0.5 : 1,\n cursor: props.disabled ? 'not-allowed' : 'pointer'\n },\n button: {\n width: '100%',\n\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n\n gap: '0.5rem',\n borderRadius: '0.5rem',\n padding: '0.625rem 0.875rem',\n\n border: props.errorMessage\n ? '1px solid var(--px-color-error)'\n : '1px solid var(--px-border-primary)',\n\n __rules: {\n '&:hover': {\n boxShadow: 'var(--px-shadow-default)',\n borderColor: 'var(--px-color-primary)'\n },\n '&:focus-within': {\n outlineOffset: '-1px',\n outline: props.errorMessage\n ? '2px solid var(--px-color-error)'\n : `2px solid var(--px-color-primary)`\n }\n }\n },\n buttonContent: {\n display: 'flex',\n alignItems: 'center',\n gap: '0.5rem'\n }\n })\n}\n","// External Libraries\nimport { ptBR } from 'date-fns/locale'\nimport { format } from 'date-fns/format'\nimport { forwardRef, useId } from 'react'\nimport { parseISO } from 'date-fns/parseISO'\n\n// Components\nimport { Icon } from '@components/commons/toolkit/Icon'\nimport { Label } from '@components/commons/toolkit/Label'\nimport { Typography } from '@components/commons/toolkit/Typography'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Utils\nimport { buildDisplayFormat } from './utils'\nimport {\n DEFAULT_TIME_FORMAT,\n DEFAULT_DISPLAY_DATE_FORMAT\n} from '@components/commons/toolkit/Calendar/constants'\n\n// Types\nimport type { DatePickerTriggerProps } from './types'\n\n// Styles\nimport { createDatePickerTriggerStyles } from './styles'\n\nexport const DatePickerTrigger = forwardRef<\n HTMLButtonElement,\n DatePickerTriggerProps\n>(function DatePickerTrigger(\n {\n timeFormat = DEFAULT_TIME_FORMAT,\n displayDateFormat = DEFAULT_DISPLAY_DATE_FORMAT,\n ...props\n },\n ref\n) {\n // Hooks\n const inputId = useId()\n const { styles, classes } = useThemedStyles(\n props,\n createDatePickerTriggerStyles,\n {\n pick: p => [p.disabled, p.errorMessage],\n applyCommonProps: true,\n commonSlot: 'container'\n }\n )\n\n // Constants\n const { label, value, disabled, required, placeholder, onClick } = props\n const hasValue = !!value?.start\n\n // Functions\n function renderDate() {\n if (!hasValue) return placeholder ?? 'Selecione uma data'\n\n const { start, end } = value\n\n const finalFormat = buildDisplayFormat({\n timeFormat,\n displayDateFormat,\n isDateTimePicker: !!props.isDateTimePicker\n })\n\n const startDate = format(parseISO(start), finalFormat, { locale: ptBR })\n const endDate = end\n ? format(parseISO(end), finalFormat, { locale: ptBR })\n : ''\n\n return `${startDate}${endDate ? ` - ${endDate}` : ''}`\n }\n\n return (\n <div style={styles.container}>\n <Label\n label={label}\n htmlFor={inputId}\n required={required}\n requiredColor=\"var(--color-error)\"\n />\n\n <button\n ref={ref}\n type=\"button\"\n disabled={disabled}\n style={styles.button}\n aria-labelledby={inputId}\n aria-expanded={props.ariaExpanded}\n className={classes.button}\n onClick={onClick}\n >\n <div style={styles.buttonContent}>\n <Icon\n size=\"sm\"\n name=\"general-calendar\"\n color=\"var(--px-text-primary)\"\n />\n\n <Typography variant=\"b1\" className=\"font-normal\">\n {renderDate()}\n </Typography>\n </div>\n\n <Icon\n size=\"sm\"\n color=\"var(--px-text-primary)\"\n name={props.ariaExpanded ? 'chevrons-up' : 'chevrons-down'}\n />\n </button>\n\n {props.errorMessage ? (\n <Typography\n variant=\"b2\"\n fontSize=\"0.75rem\"\n fontWeight=\"regular\"\n color=\"var(--px-color-error)\"\n >\n {props.errorMessage}\n </Typography>\n ) : null}\n </div>\n )\n})\n","// External Libraries\nimport { useState } from 'react'\n\n// Types\nimport type { DatePickerProps } from '../types'\nimport type { PickedDate } from '@components/commons/toolkit/Calendar/types'\n\nexport function useDatePicker(params: DatePickerProps) {\n // States\n const [isOpen, setOpen] = useState(false)\n const [selectedDate, setSelectedDate] = useState<PickedDate>()\n const [hasDateTimeError, setHasDateTimeError] = useState(false)\n\n // Functions\n function toggleDialog(status: boolean) {\n if (status) setSelectedDate(params.value)\n\n setOpen(status)\n }\n\n function handleDateChange(value: PickedDate) {\n const isAutoConfirm =\n params.selectionMode === 'single' && !params.isDateTimePicker\n\n if (isAutoConfirm) {\n setOpen(false)\n params.onChange(value)\n return\n }\n\n setSelectedDate(value)\n }\n\n function handleDateTimeError(hasError: boolean) {\n setHasDateTimeError(hasError)\n }\n\n function handleConfirmClick() {\n if (!selectedDate || hasDateTimeError) return\n\n setOpen(false)\n params.onChange(selectedDate)\n }\n\n return {\n isOpen,\n selectedDate,\n toggleDialog,\n handleDateChange,\n handleDateTimeError,\n handleConfirmClick\n }\n}\n","import { styled } from '@hooks/useThemedStyles/types'\nimport type { DatePickerProps } from './types'\n\nexport function createDatePickerStyles(props: DatePickerProps) {\n return styled({\n container: {\n width: '100%'\n },\n\n divider: {\n border: 0,\n display: 'flex',\n marginBlock: '0.1rem',\n borderTop: '1px solid var(--px-border-primary)'\n },\n\n buttonsContainer: {\n width: '100%',\n display: 'flex',\n\n alignItems: 'center',\n justifyContent: props.viewMode === 'single' ? 'center' : 'flex-end',\n\n gap: '0.75rem',\n padding: '0.5rem 1rem'\n }\n })\n}\n","import type { CalendarProps } from '@components/commons/toolkit/Calendar/types'\n\nexport * from '@components/commons/toolkit/Calendar/types'\n\nexport interface DatePickerProps extends CalendarProps {\n label: string\n\n required?: boolean\n disabled?: boolean\n placeholder?: string\n errorMessage?: string\n scrollContainerId: string\n placementContainer?: 'bottom' | 'bottom-end' | 'bottom-start'\n}\n","// External Libraries\nimport type React from 'react'\n\n// Components\nimport { Button } from '@components/commons/buttons/Button'\nimport { Calendar } from '@components/commons/toolkit/Calendar'\nimport { DatePickerTrigger } from './components/DatePickerTrigger'\nimport { BasePopover } from '@components/commons/structure/BasePopover'\n\n// Hooks\nimport { useDatePicker } from './hooks/useDatePicker'\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Types\nimport type { DatePickerProps } from './types'\nimport type { PopoverTriggerRenderProps } from '@components/commons/toolkit/Popover/types'\n\n// Styles\nimport { createDatePickerStyles } from './styles'\n\nexport * as DatePickerTypes from './types'\n\nexport const DatePicker: React.FC<DatePickerProps> = ({\n placementContainer = 'bottom-start',\n ...props\n}) => {\n // Hooks\n const {\n isOpen,\n selectedDate,\n toggleDialog,\n handleDateChange,\n handleConfirmClick,\n handleDateTimeError\n } = useDatePicker(props)\n const { styles } = useThemedStyles(props, createDatePickerStyles, {\n applyCommonProps: true,\n commonSlot: 'container'\n })\n\n // Constants\n const isSingleMode = props.viewMode === 'single'\n const isAutoClose =\n props.selectionMode === 'single' && !props.isDateTimePicker\n\n // Functions\n function renderTrigger({\n ref,\n ariaExpanded,\n onClick\n }: PopoverTriggerRenderProps) {\n return (\n <DatePickerTrigger\n {...props}\n ref={ref as any}\n ariaExpanded={ariaExpanded}\n onClick={onClick}\n />\n )\n }\n\n return (\n <div style={styles.container}>\n <BasePopover\n open={isOpen}\n maxWidth=\"fit-content\"\n minWidth=\"fit-content\"\n maxHeight=\"fit-content\"\n portalId={props.portalId}\n trigger={renderTrigger}\n onOpenChange={toggleDialog}\n floatingOptions={{\n strategy: 'fixed',\n placement: placementContainer,\n scrollContainerId: props.scrollContainerId\n }}\n >\n <Calendar\n {...props}\n value={selectedDate}\n selectionMode={props.selectionMode ?? 'range'}\n onChange={handleDateChange}\n onDateTimeError={handleDateTimeError}\n />\n\n {!isAutoClose && isSingleMode ? <hr style={styles.divider} /> : null}\n\n {!isAutoClose ? (\n <div style={styles.buttonsContainer}>\n <Button\n size=\"sm\"\n type=\"button\"\n label=\"Cancelar\"\n variant=\"outlined\"\n fullWidth={isSingleMode}\n onClick={() => toggleDialog(false)}\n />\n\n <Button\n type=\"button\"\n label=\"Aplicar\"\n variant=\"filled\"\n fullWidth={isSingleMode}\n onClick={handleConfirmClick}\n />\n </div>\n ) : null}\n </BasePopover>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAS,qBAAqB,MAA+C;AAC3E,KAAI,CAAC,KAAM,QAAO;AAClB,KAAI,SAAS,KAAM,wBAAO,IAAI,MAAM;AACpC,QAAO;;AAGT,SAAgB,eAAe,QAA2B;CACxD,MAAM,EAAE,KAAK,cAAc,WAAW,kBAAkB,uBACtD;CAEF,MAAM,UAAU,qBAAqB,iBAAiB;CAC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O,QACR;EAED,SAAS;GACP,QAAQ;GACR,SAAS;GACT,aAAa;GACb,WAAW;GACZ;EAED,kBAAkB;GAChB,OAAO;GACP,SAAS;GAET,YAAY;GACZ,gBAAgB,MAAM,aAAa,WAAW,WAAW;GAEzD,KAAK;GACL,SAAS;GACV;EACF,CAAC;;;;;;;;;AEJJ,MAAaC,cAAyC,EACpD,qBAAqB,gBACrB,GAAG,YACC;CAEJ,MAAM,EACJ,QACA,cACA,cACA,kBACA,oBACA,wBACE,cAAc,MAAM;CACxB,MAAM,EAAE,WAAW,gBAAgB,OAAO,wBAAwB;EAChE,kBAAkB;EAClB,YAAY;EACb,CAAC;CAGF,MAAM,eAAe,MAAM,aAAa;CACxC,MAAM,cACJ,MAAM,kBAAkB,YAAY,CAAC,MAAM;CAG7C,SAAS,cAAc,EACrB,KACA,cACA,WAC4B;AAC5B,SACE,oBAAC;GACC,GAAI;GACC;GACS;GACL;IACT;;AAIN,QACE,oBAAC;EAAI,OAAO,OAAO;YACjB,qBAAC;GACC,MAAM;GACN,UAAS;GACT,UAAS;GACT,WAAU;GACV,UAAU,MAAM;GAChB,SAAS;GACT,cAAc;GACd,iBAAiB;IACf,UAAU;IACV,WAAW;IACX,mBAAmB,MAAM;IAC1B;;IAED,oBAAC;KACC,GAAI;KACJ,OAAO;KACP,eAAe,MAAM,iBAAiB;KACtC,UAAU;KACV,iBAAiB;MACjB;IAED,CAAC,eAAe,eAAe,oBAAC,QAAG,OAAO,OAAO,UAAW,GAAG;IAE/D,CAAC,cACA,qBAAC;KAAI,OAAO,OAAO;gBACjB,oBAAC;MACC,MAAK;MACL,MAAK;MACL,OAAM;MACN,SAAQ;MACR,WAAW;MACX,eAAe,aAAa,MAAM;OAClC,EAEF,oBAAC;MACC,MAAK;MACL,OAAM;MACN,SAAQ;MACR,WAAW;MACX,SAAS;OACT;MACE,GACJ;;IACQ;GACV"}
1
+ {"version":3,"file":"DatePicker-BbradBP7.js","names":["CalendarDay: React.FC<CalendarDayProps>","CalendarMonth: React.FC<CalendarMonthProps>","NavButton: React.FC<NavButtonProps>","CalendarHeader: React.FC<Props>","PeriodSwitchItem: React.FC<Props>","PERIOD_OPTIONS: PeriodOption[]","PeriodSwitch: React.FC<PeriodSwitchProps>","DEFAULT_TIME_FORMAT: TimeFormat","DEFAULT_VIEW_MODE: CalendarViewMode","DEFAULT_DATE_FORMAT: DateFormat","DATE_FORMAT_MASK_MAPPER: Record<DateFormat, DateMaskFormat>","maskFormat: DateMaskFormat","day: string","month: string","year: string","format","time: string","period: 'am' | 'pm'","formattedChanges: Partial<DateTimeValues>","DateTimeInput: React.FC<DateTimeInputProps>","draft: DraftPickedDate","newValues: PickedDate","DateTimeControl: React.FC<DateTimeControlProps>","days","Calendar: React.FC<CalendarProps>","DatePickerTrigger","DatePicker: React.FC<DatePickerProps>"],"sources":["../src/components/commons/toolkit/Calendar/components/CalendarMonth/components/CalendarDay/utils.ts","../src/components/commons/toolkit/Calendar/components/CalendarMonth/components/CalendarDay/styles.ts","../src/components/commons/toolkit/Calendar/components/CalendarMonth/components/CalendarDay/index.tsx","../src/components/commons/toolkit/Calendar/components/CalendarMonth/constants.ts","../src/components/commons/toolkit/Calendar/components/CalendarMonth/styles.ts","../src/components/commons/toolkit/Calendar/components/CalendarMonth/index.tsx","../src/components/commons/toolkit/Calendar/components/CalendarHeader/components/NavButton/styles.ts","../src/components/commons/toolkit/Calendar/components/CalendarHeader/components/NavButton/index.tsx","../src/components/commons/toolkit/Calendar/components/CalendarHeader/utils.ts","../src/components/commons/toolkit/Calendar/components/CalendarHeader/styles.ts","../src/components/commons/toolkit/Calendar/components/CalendarHeader/index.tsx","../src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/components/PeriodSwitch/components/PeriodSwitchItem/styles.ts","../src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/components/PeriodSwitch/components/PeriodSwitchItem/index.tsx","../src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/components/PeriodSwitch/constants.ts","../src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/components/PeriodSwitch/styles.ts","../src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/components/PeriodSwitch/index.tsx","../src/components/commons/toolkit/Calendar/constants.ts","../src/components/commons/toolkit/Calendar/components/DateTimeControl/constants.ts","../src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/hooks/useDateTimeInput/utils/buildISODate.ts","../src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/hooks/useDateTimeInput/utils/errors.ts","../src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/hooks/useDateTimeInput/index.ts","../src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/styles.ts","../src/components/commons/toolkit/Calendar/components/DateTimeControl/components/DateTimeInput/index.tsx","../src/components/commons/toolkit/Calendar/components/DateTimeControl/hooks/useDateTimeControl/index.ts","../src/components/commons/toolkit/Calendar/components/DateTimeControl/styles.ts","../src/components/commons/toolkit/Calendar/components/DateTimeControl/index.tsx","../src/components/commons/toolkit/Calendar/hooks/useCalendar.ts","../src/components/commons/toolkit/Calendar/styles.ts","../src/components/commons/toolkit/Calendar/index.tsx","../src/components/commons/inputs/DatePicker/components/DatePickerTrigger/utils.ts","../src/components/commons/inputs/DatePicker/components/DatePickerTrigger/styles.ts","../src/components/commons/inputs/DatePicker/components/DatePickerTrigger/index.tsx","../src/components/commons/inputs/DatePicker/hooks/useDatePicker.ts","../src/components/commons/inputs/DatePicker/styles.ts","../src/components/commons/inputs/DatePicker/types.ts","../src/components/commons/inputs/DatePicker/index.tsx"],"sourcesContent":["// External Libraries\nimport { ptBR } from 'date-fns/locale'\nimport { format } from 'date-fns/format'\nimport { isAfter } from 'date-fns/isAfter'\nimport { isBefore } from 'date-fns/isBefore'\nimport { endOfDay } from 'date-fns/endOfDay'\nimport { isSameDay } from 'date-fns/isSameDay'\nimport { startOfDay } from 'date-fns/startOfDay'\nimport { isSameMonth } from 'date-fns/isSameMonth'\nimport { isWithinInterval } from 'date-fns/isWithinInterval'\n\n// Types\nimport type { PickedDate } from '../../../../types'\n\ninterface DayMetadataParams {\n day: Date\n currentMonth: Date\n selection?: PickedDate\n disablePastDates?: boolean | Date\n disableFutureDates?: boolean | Date\n}\n\nfunction resolveReferenceDate(prop: boolean | Date | undefined): Date | null {\n if (!prop) return null\n if (prop === true) return new Date()\n return prop\n}\n\nexport function getDayMetadata(params: DayMetadataParams) {\n const { day, currentMonth, selection, disablePastDates, disableFutureDates } =\n params\n\n const pastRef = resolveReferenceDate(disablePastDates)\n const futureRef = resolveReferenceDate(disableFutureDates)\n const isPastDate = pastRef ? isBefore(day, startOfDay(pastRef)) : false\n const isFutureDate = futureRef ? isAfter(day, endOfDay(futureRef)) : false\n const isOutsideMonth = !isSameMonth(day, currentMonth)\n const isDisabled = isOutsideMonth || isPastDate || isFutureDate\n\n if (!selection) {\n const ariaLabel = getAriaLabel(day, {\n isDisabled,\n isBetween: false,\n isSelected: false\n })\n\n return {\n ariaLabel,\n isDisabled,\n isSelected: false,\n isBetween: false,\n isRangeEnd: false,\n isRangeStart: false\n }\n }\n\n const { start, end } = selection\n\n const isRangeStart = start ? isSameDay(day, start) : false\n const isRangeEnd = end ? isSameDay(day, end) : false\n\n const isBetween =\n start && end\n ? isWithinInterval(startOfDay(day), {\n start: startOfDay(start),\n end: startOfDay(end)\n })\n : false\n const isSelected = isRangeStart || isRangeEnd\n\n const ariaLabel = getAriaLabel(day, { isSelected, isBetween, isDisabled })\n\n return {\n ariaLabel,\n isBetween,\n isDisabled,\n isSelected,\n isRangeEnd,\n isRangeStart\n }\n}\n\nfunction getAriaLabel(\n day: Date,\n options: { isSelected: boolean; isBetween: boolean; isDisabled: boolean }\n) {\n const { isSelected, isBetween, isDisabled } = options\n const baseLabel = format(day, \"d 'de' MMMM 'de' yyyy\", { locale: ptBR })\n\n if (isSelected) return `${baseLabel}, selecionado`\n if (isBetween) return `${baseLabel}, dentro do intervalo`\n if (isDisabled) return `${baseLabel}, indisponível`\n\n return baseLabel\n}\n","import type { CalendarDayProps } from './types'\nimport { styled } from '@hooks/useThemedStyles/types'\n\ninterface StylesProps extends CalendarDayProps {\n isBetween: boolean\n isSelected: boolean\n isRangeStart: boolean\n isRangeEnd: boolean\n isDisabled: boolean\n}\n\nexport function createCalendarDayStyles(params: StylesProps) {\n return styled({\n container: {\n width: '100%',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n\n backgroundColor: getContainerBackgroundColor(params),\n\n borderTopLeftRadius: getContainerBorderLeft(params),\n borderBottomLeftRadius: getContainerBorderLeft(params),\n borderTopRightRadius: getContainerBorderRight(params),\n borderBottomRightRadius: getContainerBorderRight(params)\n },\n\n button: {\n display: 'flex',\n width: '2.2rem',\n height: '2.2rem',\n alignItems: 'center',\n justifyContent: 'center',\n\n backgroundColor: getButtonBackgroundColor(params),\n borderRadius: getButtonBorderRadius(params),\n\n transition: 'all 200ms ease-in-out',\n cursor: params.isDisabled ? 'not-allowed' : 'pointer',\n opacity: params.isDisabled ? 0.5 : 1,\n\n __rules: {\n '&:hover': {\n opacity: '0.85'\n },\n '&:disabled': {\n opacity: '0.5',\n cursor: 'not-allowed'\n }\n }\n }\n })\n}\n\nfunction getContainerBackgroundColor({ isBetween }: StylesProps): string {\n if (isBetween) {\n return 'rgba(14, 178, 76, 0.1)'\n }\n\n return 'transparent'\n}\n\nfunction getContainerBorderLeft({ isRangeStart }: StylesProps) {\n return isRangeStart ? '50%' : '0'\n}\n\nfunction getContainerBorderRight({ isRangeEnd }: StylesProps) {\n return isRangeEnd ? '50%' : '0'\n}\n\nfunction getButtonBackgroundColor({\n isSelected,\n isRangeStart,\n isRangeEnd\n}: StylesProps): string {\n if (isSelected || isRangeStart || isRangeEnd) {\n return 'var(--px-btn-filled-bg)'\n }\n\n return 'transparent'\n}\n\nfunction getButtonBorderRadius({\n isBetween,\n isRangeStart,\n isRangeEnd\n}: StylesProps): string {\n if (isBetween && !isRangeStart && !isRangeEnd) {\n return '0'\n }\n\n return '50%'\n}\n","// External Libraries\nimport type React from 'react'\nimport { useMemo } from 'react'\n\n// Components\nimport { Typography } from '@components/commons/toolkit/Typography'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Utils\nimport { getDayMetadata } from './utils'\n\n// Types\nimport type { CalendarDayProps } from './types'\n\n// Styles\nimport { createCalendarDayStyles } from './styles'\n\nexport const CalendarDay: React.FC<CalendarDayProps> = props => {\n // Constants\n const {\n day,\n selection,\n currentMonth,\n disablePastDates,\n disableFutureDates,\n onClick\n } = props\n const dayConfig = useMemo(\n () =>\n getDayMetadata({\n day,\n selection,\n currentMonth,\n disablePastDates,\n disableFutureDates\n }),\n [day, selection, currentMonth, disablePastDates, disableFutureDates]\n )\n\n // Hooks\n const { styles, classes } = useThemedStyles(\n { ...props, ...dayConfig },\n createCalendarDayStyles,\n {\n applyCommonProps: true\n }\n )\n\n // Functions\n function handleClick() {\n onClick(day)\n }\n\n return (\n <div style={styles.container}>\n <button\n type=\"button\"\n style={styles.button}\n className={classes.button}\n disabled={dayConfig.isDisabled}\n aria-label={dayConfig.ariaLabel}\n onClick={handleClick}\n >\n <Typography\n variant=\"b2\"\n color={dayConfig.isSelected ? 'white' : 'var(--px-text-secondary)'}\n fontWeight={\n dayConfig.isSelected || dayConfig.isBetween ? 'medium' : 'regular'\n }\n >\n {day.getDate()}\n </Typography>\n </button>\n </div>\n )\n}\n","export const WEEK_DAYS = [\n { short: 'D', full: 'Domingo' },\n { short: 'S', full: 'Segunda' },\n { short: 'T', full: 'Terça' },\n { short: 'Q', full: 'Quarta' },\n { short: 'Q', full: 'Quinta' },\n { short: 'S', full: 'Sexta' },\n { short: 'S', full: 'Sábado' }\n] as const\n","import { styled } from '@hooks/useThemedStyles/types'\nimport type { CalendarMonthProps } from './types'\n\nexport function createCalendarMonthStyles(props: CalendarMonthProps) {\n return styled({\n weekDays: {\n display: 'grid',\n gridTemplateColumns: 'repeat(7, 2.5rem)'\n },\n calendarDays: {\n display: 'grid',\n gridTemplateColumns: 'repeat(7, 2.5rem)'\n },\n weekDay: {\n width: '2.5rem',\n height: '2.5rem',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center'\n }\n })\n}\n","// External Libraries\nimport type React from 'react'\n\n// Components\nimport { CalendarDay } from './components/CalendarDay'\nimport { Typography } from '@components/commons/toolkit/Typography'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Utils\nimport { WEEK_DAYS } from './constants'\n\n// Types\nimport type { CalendarMonthProps } from './types'\n\n// Styles\nimport { createCalendarMonthStyles } from './styles'\n\nexport const CalendarMonth: React.FC<CalendarMonthProps> = props => {\n // Hooks\n const { styles } = useThemedStyles(props, createCalendarMonthStyles)\n\n // Constants\n const currentMonth = props.days.length\n ? props.days[Math.floor(props.days.length / 2)]\n : new Date()\n\n // Functions\n function renderWeekDays() {\n return WEEK_DAYS.map(day => (\n <div key={day.full} style={styles.weekDay}>\n <Typography variant=\"b2\" className=\"text-tx-primary\">\n {day.short}\n </Typography>\n </div>\n ))\n }\n\n return (\n <div>\n <div style={styles.weekDays}>{renderWeekDays()}</div>\n\n <div style={styles.calendarDays}>\n {props.days.map(day => (\n <CalendarDay\n day={day}\n key={day.toISOString()}\n selection={props.selection}\n currentMonth={currentMonth}\n disablePastDates={props.disablePastDates}\n disableFutureDates={props.disableFutureDates}\n onClick={props.onDayClick}\n />\n ))}\n </div>\n </div>\n )\n}\n","import { styled } from '@hooks/useThemedStyles/types'\nimport type { NavButtonProps } from './types'\n\nexport function createNavButtonStyles(_props: NavButtonProps) {\n return styled({\n container: {\n display: 'flex',\n\n cursor: 'pointer',\n padding: '0.125rem',\n\n borderRadius: '50%',\n transition: 'background-color 0.2s ease-out',\n rotate: _props.next ? '180deg' : '0deg',\n\n __rules: {\n '&:hover': {\n backgroundColor: 'var(--color-gray-50)'\n }\n }\n }\n })\n}\n","// External Libraries\nimport type React from 'react'\n\n// Components\nimport { Icon } from '@components/commons/toolkit/Icon'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Types\nimport type { NavButtonProps } from './types'\n\n// Styles\nimport { createNavButtonStyles } from './styles'\n\nexport const NavButton: React.FC<NavButtonProps> = ({\n visible = true,\n ...props\n}) => {\n // Hooks\n\n const { styles, classes } = useThemedStyles(\n { visible, ...props },\n createNavButtonStyles,\n {\n applyCommonProps: true,\n pick: p => [p.next, p.visible]\n }\n )\n\n if (!visible) return null\n\n return (\n <button\n type=\"button\"\n style={styles.container}\n className={classes.container}\n onClick={props.onClick}\n >\n <Icon name={props.icon} color=\"var(--px-text-secondary)\" />\n </button>\n )\n}\n","// External Libraries\nimport { isBefore } from 'date-fns/isBefore'\nimport { startOfYear } from 'date-fns/startOfYear'\nimport { startOfMonth } from 'date-fns/startOfMonth'\n\ninterface NavMetadataParams {\n currentDate: Date\n isDualView: boolean\n position: 'left' | 'right'\n disablePastDates?: boolean | Date\n disableFutureDates?: boolean | Date\n}\n\nexport function getNavMetadata(params: NavMetadataParams) {\n const { currentDate, disablePastDates } = params\n\n const pastRef = !disablePastDates\n ? null\n : disablePastDates instanceof Date\n ? disablePastDates\n : new Date()\n\n const hasPrevMonthAvailable =\n !pastRef || isBefore(startOfMonth(pastRef), startOfMonth(currentDate))\n\n const hasPrevYearAvailable =\n !pastRef || isBefore(startOfYear(pastRef), startOfYear(currentDate))\n\n return {\n hasPrevYearAvailable,\n hasPrevMonthAvailable\n }\n}\n","import { styled } from '@hooks/useThemedStyles/types'\nimport type { CalendarHeaderProps } from './types'\n\nexport function createCalendarHeaderStyles(_props: CalendarHeaderProps) {\n return styled({\n container: {\n width: '100%',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n paddingBlock: '0.375rem'\n },\n\n leftButtonsContainer: {\n minWidth: '3.5rem',\n minHeight: '1.5rem',\n\n display: 'flex',\n alignItems: 'center',\n gap: '0.25rem'\n },\n\n rightButtonsContainer: {\n minWidth: '3.5rem',\n minHeight: '1.5rem',\n\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'flex-end',\n gap: '0.25rem'\n }\n })\n}\n","// External Libraries\nimport type React from 'react'\nimport { ptBR } from 'date-fns/locale'\nimport { format } from 'date-fns/format'\n\n// Components\nimport { NavButton } from './components/NavButton'\nimport { Typography } from '@components/commons/toolkit/Typography'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Utils\nimport { getNavMetadata } from './utils'\nimport { capitalize } from '@utils/functions'\n\n// Types\nimport type { CalendarNavAction } from '../../types'\n\n// Styles\nimport { createCalendarHeaderStyles } from './styles'\n\ninterface Props {\n currentDate: Date\n isDualView: boolean\n position: 'left' | 'right'\n disablePastDates?: boolean | Date\n disableFutureDates?: boolean | Date\n onNavAction: (action: CalendarNavAction) => void\n}\n\nexport const CalendarHeader: React.FC<Props> = props => {\n // Constants\n const { onNavAction, ...rest } = props\n const { hasPrevYearAvailable, hasPrevMonthAvailable } = getNavMetadata(rest)\n\n // Hooks\n const { styles } = useThemedStyles(props, createCalendarHeaderStyles, {\n applyCommonProps: true,\n pick: p => [p.currentDate, p.isDualView, p.position]\n })\n\n // Functions\n function renderMonthName() {\n const name = format(rest.currentDate, 'MMMM yyyy', { locale: ptBR })\n return capitalize(name)\n }\n\n return (\n <div style={styles.container}>\n <div style={styles.leftButtonsContainer}>\n <NavButton\n icon=\"chevrons-left\"\n visible={hasPrevMonthAvailable}\n onClick={() => onNavAction('prev-month')}\n />\n\n <NavButton\n icon=\"chevrons-double-left\"\n visible={hasPrevYearAvailable}\n onClick={() => onNavAction('prev-year')}\n />\n </div>\n\n <Typography variant=\"b2\" align=\"center\" fontWeight=\"semibold\">\n {renderMonthName()}\n </Typography>\n\n <div style={styles.rightButtonsContainer}>\n <NavButton\n next\n icon=\"chevrons-double-left\"\n onClick={() => onNavAction('next-year')}\n />\n\n <NavButton\n next\n icon=\"chevrons-left\"\n onClick={() => onNavAction('next-month')}\n />\n </div>\n </div>\n )\n}\n","// External Libraries\nimport { styled } from '@hooks/useThemedStyles/types'\n\ninterface Params {\n selected?: boolean\n}\n\nexport function createTabSwitchItemStyles({ selected }: Params) {\n return styled({\n item: {\n minHeight: '1rem',\n position: 'relative',\n display: 'inline-flex',\n alignItems: 'center',\n justifyContent: 'center',\n gap: 4,\n background: 'transparent',\n border: 0,\n padding: '0.25rem',\n\n userSelect: 'none',\n whiteSpace: 'nowrap',\n __rules: { '& > p': { zIndex: 1 } }\n },\n\n selectedBg: {\n position: 'absolute',\n inset: 0,\n borderRadius: 6,\n border: '1px solid var(--px-border-primary)'\n }\n })\n}\n","// External Libraries\nimport { motion } from 'framer-motion'\n\n// Components\nimport { Typography } from '@components/commons/toolkit/Typography'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Types\nimport type { PeriodOption } from '../../types'\nimport type { DateTimePeriod } from '../../../../types'\n\n// Styles\nimport { createTabSwitchItemStyles } from './styles'\n\ninterface Props {\n layoutId: string\n selected: boolean\n option: PeriodOption\n onClick: (value: DateTimePeriod) => void\n onBlur?: () => void\n}\n\nexport const PeriodSwitchItem: React.FC<Props> = props => {\n const { option, selected, onClick } = props\n\n const { styles, classes } = useThemedStyles(\n props,\n createTabSwitchItemStyles,\n {\n pick: p => [p.selected]\n }\n )\n\n return (\n <button\n tabIndex={0}\n type=\"button\"\n style={styles.item}\n className={classes.item}\n onBlur={props.onBlur}\n onClick={() => onClick(option.value)}\n >\n {selected ? (\n <motion.div layoutId={props.layoutId} style={styles.selectedBg} />\n ) : null}\n\n <Typography variant=\"b1\" fontSize=\"0.625rem\" fontWeight=\"semibold\">\n {option.label}\n </Typography>\n </button>\n )\n}\n","import type { PeriodOption } from './types'\n\nexport const PERIOD_OPTIONS: PeriodOption[] = [\n { value: 'am', label: 'AM' },\n { value: 'pm', label: 'PM' }\n]\n","// Types\nimport type { PeriodSwitchProps } from './types'\nimport { styled } from '@hooks/useThemedStyles/types'\n\nexport function createTabSwitchStyles(props: PeriodSwitchProps) {\n return styled({\n container: {\n width: 'fit-content',\n\n display: 'flex',\n flexDirection: 'row',\n alignItems: 'center',\n color: 'var(--px-text-primary, #4b5563)',\n\n gap: 0,\n __rules: { '& svg': { zIndex: 1 } }\n }\n })\n}\n","// External Libraries\nimport type React from 'react'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Components\nimport { PeriodSwitchItem } from './components/PeriodSwitchItem'\n\n// Utils\nimport { PERIOD_OPTIONS } from './constants'\n\n// Types\nimport type { PeriodSwitchProps } from './types'\n\n// Styles\nimport { createTabSwitchStyles } from './styles'\n\nexport * from './types'\n\nexport const PeriodSwitch: React.FC<PeriodSwitchProps> = props => {\n {\n const { currentValue, onChange } = props\n\n const { styles, classes } = useThemedStyles(props, createTabSwitchStyles, {\n pick: p => [p.currentValue],\n applyCommonProps: true\n })\n\n return (\n <div style={styles.container} className={classes.container}>\n {PERIOD_OPTIONS.map(opt => (\n <PeriodSwitchItem\n option={opt}\n key={String(opt.value)}\n layoutId={props.layoutId}\n selected={currentValue === opt.value}\n onClick={onChange}\n onBlur={props.onBlur}\n />\n ))}\n </div>\n )\n }\n}\n","import type { CalendarViewMode, DateFormat, TimeFormat } from './types'\n\nexport const DEFAULT_TIME_FORMAT: TimeFormat = '24h'\nexport const DEFAULT_VIEW_MODE: CalendarViewMode = 'double'\nexport const DEFAULT_DATE_FORMAT: DateFormat = 'dd/MM/yyyy'\nexport const DEFAULT_DISPLAY_DATE_FORMAT = 'dd MMMM yyyy'\n","import type { DateFormat } from '@components/commons/toolkit/Calendar/types'\nimport type { DateMaskFormat } from '@services/MaskModule/locales/br/masks/DateMask'\n\nexport const DATE_FORMAT_MASK_MAPPER: Record<DateFormat, DateMaskFormat> = {\n 'dd/MM/yyyy': 'DD/MM/YYYY',\n 'MM/dd/yyyy': 'MM/DD/YYYY',\n 'yyyy/MM/dd': 'YYYY/MM/DD'\n}\n","// External Libraries\nimport { parse } from 'date-fns/parse'\nimport { setHours } from 'date-fns/setHours'\nimport { setMinutes } from 'date-fns/setMinutes'\n\n// Utils\nimport {\n DEFAULT_DATE_FORMAT,\n DEFAULT_TIME_FORMAT\n} from '@components/commons/toolkit/Calendar/constants'\n\n// Types\nimport type { DateTimeValues } from '../../../types'\nimport type { CalendarFormatValues } from '@components/commons/toolkit/Calendar/types'\n\nexport function makeInitialDateTime(): DateTimeValues {\n return { time: '', date: '', period: 'am' }\n}\n\ninterface BuildISOParams extends CalendarFormatValues {\n date: string\n time: string\n period?: string\n}\n\nexport function buildISO({\n date,\n time,\n period = 'am',\n timeFormat = DEFAULT_TIME_FORMAT,\n dateFormat = DEFAULT_DATE_FORMAT\n}: BuildISOParams) {\n const baseDate = parse(date, dateFormat, new Date())\n let [hours, minutes] = time.split(':').map(Number)\n\n if (timeFormat === '12h') {\n if (period === 'pm' && hours !== 12) {\n hours += 12\n } else if (period === 'am' && hours === 12) {\n hours = 0\n }\n }\n\n const withTime = setMinutes(setHours(baseDate, hours || 0), minutes || 0)\n\n return withTime.toISOString()\n}\n","// External Libraries\nimport { isAfter } from 'date-fns/isAfter'\nimport { endOfDay } from 'date-fns/endOfDay'\nimport { isBefore } from 'date-fns/isBefore'\nimport { startOfDay } from 'date-fns/startOfDay'\n\n// Services\nimport { DateValidator } from '@services/MaskModule/locales/br/validators/DateValidator'\nimport { TimeValidator } from '@services/MaskModule/locales/br/validators/TimeValidator'\n\n// Utils\nimport {\n DEFAULT_DATE_FORMAT,\n DEFAULT_TIME_FORMAT\n} from '@components/commons/toolkit/Calendar/constants'\nimport { DATE_FORMAT_MASK_MAPPER } from '../../../../../constants'\n\n// Types\nimport type {\n DateFormat,\n TimeFormat\n} from '@components/commons/toolkit/Calendar/types'\nimport type { DateTimeValues } from '../../../types'\nimport type { DateMaskFormat } from '@services/MaskModule/locales/br/masks/DateMask'\n\ninterface CheckErrorsParams {\n values: DateTimeValues\n dateFormat?: DateFormat\n timeFormat?: TimeFormat\n disableFutureDates?: boolean\n disablePastDates?: boolean\n isDateTimePicker?: boolean\n}\n\nexport function checkErrors({\n values,\n disablePastDates,\n disableFutureDates,\n isDateTimePicker,\n timeFormat = DEFAULT_TIME_FORMAT,\n dateFormat = DEFAULT_DATE_FORMAT\n}: CheckErrorsParams): string | null {\n const maskFormat: DateMaskFormat = DATE_FORMAT_MASK_MAPPER[dateFormat]\n\n const dateValidator = new DateValidator({ dateFormat: maskFormat })\n const timeValidator = new TimeValidator({ format: timeFormat })\n\n const isValidDate = dateValidator.validate(values.date)\n const isValidTime = isDateTimePicker\n ? timeValidator.validate(values.time)\n : true\n\n let error = ''\n\n if (!isValidTime) error = 'Formato de hora inválida'\n\n if (!isValidDate) error = 'Formato de data inválida'\n\n if (isValidDate) {\n const endOfToday = endOfDay(new Date())\n const startOfToday = startOfDay(new Date())\n\n const dateISO = createISODate(values.date, dateFormat)\n\n if (\n dateISO &&\n disableFutureDates &&\n isAfter(dateISO, endOfToday.toISOString())\n ) {\n error = 'Data futura indisponível'\n }\n\n if (\n dateISO &&\n disablePastDates &&\n isBefore(dateISO, startOfToday.toISOString())\n ) {\n error = 'Data passada indisponível'\n }\n }\n\n return error ?? null\n}\n\nexport function createISODate(value: string, format: DateFormat): Date | null {\n const parts = value.split('/')\n\n if (parts.length !== 3) return null\n\n let day: string\n let month: string\n let year: string\n\n switch (format) {\n case 'dd/MM/yyyy':\n ;[day, month, year] = parts\n break\n\n case 'MM/dd/yyyy':\n ;[month, day, year] = parts\n break\n\n case 'yyyy/MM/dd':\n ;[year, month, day] = parts\n break\n }\n\n return new Date(Number(year), Number(month) - 1, Number(day))\n}\n","// External Libraries\nimport { useEffect, useState } from 'react'\nimport { format } from 'date-fns/format'\nimport { parseISO } from 'date-fns/parseISO'\n\n// Utils\nimport {\n DEFAULT_DATE_FORMAT,\n DEFAULT_TIME_FORMAT\n} from '@components/commons/toolkit/Calendar/constants'\nimport { DATE_FORMAT_MASK_MAPPER } from '../../../../constants'\nimport { buildISO, checkErrors, makeInitialDateTime } from './utils'\n\n// Types\nimport type { UseDateTimeInputParams } from './types'\nimport type { DateTimePeriod, DateTimeValues } from '../../types'\nimport { Locale, MaskModule, MaskType } from '@services/MaskModule'\nimport { DateMask } from '@services/MaskModule/locales/br/masks/DateMask'\n\nexport function useDateTimeInput({\n value,\n disablePastDates,\n disableFutureDates,\n isDateTimePicker,\n timeFormat = DEFAULT_TIME_FORMAT,\n dateFormat = DEFAULT_DATE_FORMAT,\n onError,\n onChange\n}: UseDateTimeInputParams) {\n // States\n const [errorMessage, setErrorMessage] = useState('')\n const [datetimeValue, setDatetimeValue] = useState(makeInitialDateTime)\n\n useEffect(() => {\n if (!value) return\n\n const date = parseISO(value)\n\n let time: string\n let period: 'am' | 'pm' = 'am'\n\n if (timeFormat === '12h') {\n time = format(date, 'hh:mm')\n period = format(date, 'a').toLowerCase() as DateTimePeriod\n } else {\n time = format(date, 'HH:mm')\n }\n\n setDatetimeValue(prev => ({\n ...prev,\n time,\n period,\n date: format(date, dateFormat)\n }))\n }, [value, dateFormat, timeFormat])\n\n function emitChange() {\n const error = checkErrors({\n dateFormat,\n timeFormat,\n disablePastDates,\n disableFutureDates,\n isDateTimePicker,\n values: datetimeValue\n })\n\n if (error) {\n setErrorMessage(error)\n onError?.(true)\n return\n }\n\n onError?.(false)\n const iso = buildISO({ ...datetimeValue, dateFormat, timeFormat })\n\n onChange(iso)\n }\n\n function handleDateTimeChange(changes: Partial<DateTimeValues>) {\n const formattedChanges: Partial<DateTimeValues> = {}\n setErrorMessage('')\n\n if (changes.date != null && changes.date !== undefined) {\n const maskDateFormat = DATE_FORMAT_MASK_MAPPER[dateFormat]\n\n const module = new DateMask({ dateFormat: maskDateFormat })\n formattedChanges.date = module\n ? module.format(changes.date)\n : changes.date\n }\n\n if (changes.time != null && changes.time !== undefined) {\n const module =\n timeFormat === '12h'\n ? MaskModule.getMask(Locale.BR, MaskType.TIME_12H)\n : MaskModule.getMask(Locale.BR, MaskType.TIME_24H)\n\n formattedChanges.time = module\n ? module.format(changes.time)\n : changes.time\n }\n\n if (changes.period) {\n formattedChanges.period = changes.period\n }\n\n setDatetimeValue(prev => ({ ...prev, ...formattedChanges }))\n }\n\n return {\n errorMessage,\n datetimeValue,\n emitChange,\n handleDateTimeChange\n }\n}\n","import type { DateTimeInputProps } from './types'\nimport { styled } from '@hooks/useThemedStyles/types'\n\nexport function createDateTimeInputStyles(_props: DateTimeInputProps) {\n return styled({\n container: {\n width: '17.5rem',\n\n display: 'flex',\n flexDirection: 'column',\n gap: '0.25rem'\n },\n\n content: {\n width: '100%',\n height: '2.5rem',\n\n display: 'flex',\n alignItems: 'center',\n columnGap: '0.25rem',\n\n borderWidth: 1,\n borderStyle: 'solid',\n borderRadius: '0.5rem',\n padding: '0.625rem 0.875rem',\n boxShadow: 'var(--px-shadow-default)',\n borderColor: _props.errorMessage\n ? 'var(--px-color-error)'\n : 'var(--px-border-primary)',\n\n __rules: {\n '&:focus-within': {\n outlineOffset: '-1px',\n outline: '2px solid var(--px-color-primary)'\n }\n }\n },\n\n wrapper: {\n width: '100%',\n minWidth: 0,\n display: 'flex',\n alignItems: 'center',\n\n gap: '0.25rem'\n },\n\n divider: {\n border: 0,\n width: '1px',\n height: '1rem',\n\n marginInline: '0.5rem',\n backgroundColor: 'var(--px-border-primary)'\n },\n\n input: {\n flex: 1,\n width: '100%',\n minWidth: 0,\n fontWeight: 500,\n fontSize: '0.875rem',\n lineHeight: '1.5rem',\n fontFamily: 'inherit',\n color: 'var(--px-text-primary)',\n backgroundColor: 'transparent',\n border: 'none',\n padding: 0,\n __rules: {\n '&:disabled': {\n cursor: 'not-allowed'\n },\n '&:focus': {\n outline: 'none'\n },\n '&::placeholder': {\n fontWeight: 400,\n color: 'var(--px-text-secondary)'\n }\n }\n }\n })\n}\n","// External Libraries\nimport type React from 'react'\n\n// Components\nimport { Icon } from '@components/commons/toolkit/Icon'\nimport { PeriodSwitch } from './components/PeriodSwitch'\nimport { ErrorMessage } from '@components/commons/toolkit/ErrorMessage'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\nimport { useDateTimeInput } from './hooks/useDateTimeInput'\n\n// Types\nimport type { DateTimeInputProps } from './types'\n\n// Styles\nimport { createDateTimeInputStyles } from './styles'\n\nexport const DateTimeInput: React.FC<DateTimeInputProps> = props => {\n // Hooks\n const { styles, classes } = useThemedStyles(\n props,\n createDateTimeInputStyles,\n { applyCommonProps: true }\n )\n const { errorMessage, datetimeValue, emitChange, handleDateTimeChange } =\n useDateTimeInput(props)\n\n // Functions\n function handleKeyDown(e: React.KeyboardEvent<HTMLInputElement>) {\n if (e.key === 'Enter') {\n emitChange()\n }\n }\n\n function handleBlur() {\n emitChange()\n }\n\n return (\n <div style={styles.container}>\n <div style={styles.content} className={classes.content}>\n <div style={styles.wrapper}>\n <Icon\n size=\"sm\"\n name=\"general-calendar\"\n color=\"var(--px-text-disabled)\"\n />\n\n <input\n style={styles.input}\n className={classes.input}\n value={datetimeValue.date}\n placeholder={props.dateFormat}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n onChange={e => handleDateTimeChange({ date: e.target.value })}\n />\n </div>\n\n {props.isDateTimePicker ? (\n <>\n <hr style={styles.divider} />\n\n <div style={styles.wrapper}>\n <Icon\n size=\"sm\"\n name=\"general-clock\"\n color=\"var(--px-text-disabled)\"\n />\n\n <input\n placeholder=\"12:00\"\n style={styles.input}\n className={classes.input}\n value={datetimeValue.time}\n onBlur={handleBlur}\n onKeyDown={handleKeyDown}\n onChange={e => handleDateTimeChange({ time: e.target.value })}\n />\n\n {props.timeFormat === '12h' ? (\n <PeriodSwitch\n layoutId={props.layoutId}\n currentValue={datetimeValue.period}\n onBlur={handleBlur}\n onChange={value => handleDateTimeChange({ period: value })}\n />\n ) : null}\n </div>\n </>\n ) : null}\n </div>\n\n {errorMessage ? <ErrorMessage message={errorMessage} /> : null}\n </div>\n )\n}\n","// External Libraries\nimport { isAfter } from 'date-fns/isAfter'\n\n// Types\nimport type { UseDateTimeControlParams } from './types'\nimport type { PickedDate } from '@components/commons/toolkit/Calendar/types'\n\ntype DraftPickedDate = {\n start?: string\n end?: string\n}\n\nexport function useDateTimeControl({\n value,\n onChange\n}: UseDateTimeControlParams) {\n function handleDateTimeChange(changes: DraftPickedDate) {\n const draft: DraftPickedDate = {\n start: changes.start ?? value?.start,\n end: changes.end ?? value?.end\n }\n\n if (!draft.start) {\n return\n }\n\n const newValues: PickedDate = {\n start: draft.start,\n end: draft.end\n }\n\n if (newValues.end) {\n const startIsAfterEnd = isAfter(newValues.start, newValues.end)\n\n if (startIsAfterEnd) {\n const tempStart = newValues.start\n const tempEnd = newValues.end\n\n newValues.start = tempEnd\n newValues.end = tempStart\n }\n }\n\n onChange(newValues)\n }\n\n return { handleDateTimeChange }\n}\n","// Types\nimport type { DateTimeControlProps } from './types'\nimport type { StyleMap } from '@hooks/useThemedStyles/types'\n\n// Hooks\nimport { styled } from '@hooks/useThemedStyles/types'\n\nexport function createDateTimeControlStyles(\n _props: DateTimeControlProps\n): StyleMap {\n return styled({\n container: {\n width: '100%',\n\n display: 'flex',\n alignItems: _props.viewMode === 'double' ? 'center' : undefined,\n flexDirection: _props.viewMode === 'single' ? 'column' : 'row',\n\n gap: '0.5rem'\n }\n })\n}\n","// External Libraries\nimport type React from 'react'\nimport { useRef } from 'react'\n\n// Components\nimport { Icon } from '@components/commons/toolkit/Icon'\nimport { DateTimeInput } from './components/DateTimeInput'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\nimport { useDateTimeControl } from './hooks/useDateTimeControl'\n\n// Utils\nimport { DEFAULT_VIEW_MODE } from '../../constants'\n\n// Types\nimport type { DateTimeControlProps } from './types'\n\n// Styles\nimport { createDateTimeControlStyles } from './styles'\n\nexport const DateTimeControl: React.FC<DateTimeControlProps> = ({\n viewMode = DEFAULT_VIEW_MODE,\n ...props\n}) => {\n // Constants\n const resolvedProps = { viewMode, ...props }\n\n // Hooks\n const { styles } = useThemedStyles(\n resolvedProps,\n createDateTimeControlStyles,\n {\n applyCommonProps: true\n }\n )\n const { handleDateTimeChange } = useDateTimeControl(resolvedProps)\n\n const startErrorRef = useRef(false)\n const endErrorRef = useRef(false)\n\n function handleStartError(hasError: boolean) {\n startErrorRef.current = hasError\n resolvedProps.onError?.(startErrorRef.current || endErrorRef.current)\n }\n\n function handleEndError(hasError: boolean) {\n endErrorRef.current = hasError\n resolvedProps.onError?.(startErrorRef.current || endErrorRef.current)\n }\n\n return (\n <div style={styles.container}>\n <DateTimeInput\n layoutId=\"start-date\"\n dateFormat={resolvedProps.dateFormat}\n timeFormat={resolvedProps.timeFormat}\n isDateTimePicker={resolvedProps.isDateTimePicker}\n value={resolvedProps.value?.start ?? ''}\n disablePastDates={resolvedProps.disablePastDates}\n disableFutureDates={resolvedProps.disableFutureDates}\n onChange={start => handleDateTimeChange({ start })}\n onError={handleStartError}\n />\n\n {resolvedProps.viewMode === 'double' &&\n resolvedProps.selectionMode === 'range' ? (\n <Icon\n size=\"sm\"\n name=\"arrows-arrow-right\"\n color=\"var(--px-text-secondary)\"\n />\n ) : null}\n\n {resolvedProps.selectionMode === 'range' ? (\n <DateTimeInput\n layoutId=\"end-date\"\n value={resolvedProps?.value?.end}\n timeFormat={resolvedProps.timeFormat}\n dateFormat={resolvedProps.dateFormat}\n isDateTimePicker={resolvedProps.isDateTimePicker}\n disablePastDates={resolvedProps.disablePastDates}\n disableFutureDates={resolvedProps.disableFutureDates}\n onChange={end => handleDateTimeChange({ end })}\n onError={handleEndError}\n />\n ) : null}\n </div>\n )\n}\n","// External Libraries\nimport { useMemo, useState } from 'react'\nimport { addDays } from 'date-fns/addDays'\nimport { addYears } from 'date-fns/addYears'\nimport { addMonths } from 'date-fns/addMonths'\nimport { endOfWeek } from 'date-fns/endOfWeek'\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { startOfWeek } from 'date-fns/startOfWeek'\nimport { startOfMonth } from 'date-fns/startOfMonth'\nimport { eachDayOfInterval } from 'date-fns/eachDayOfInterval'\n\n// Types\nimport type { CalendarNavAction } from '../types'\n\nexport function useCalendar(initialDate = new Date()) {\n // States\n const [currentDate, setCurrentDate] = useState(initialDate)\n\n // Constants\n const days = useMemo(() => {\n const start = startOfWeek(startOfMonth(currentDate), { weekStartsOn: 0 })\n const end = endOfWeek(endOfMonth(currentDate), { weekStartsOn: 0 })\n let days = eachDayOfInterval({ start, end })\n\n if (days.length < 42) {\n const diff = 42 - days.length\n const last = end\n\n const extraDays = Array.from({ length: diff }, (_, i) =>\n addDays(last, i + 1)\n )\n\n days = [...days, ...extraDays]\n }\n\n return days\n }, [currentDate])\n\n // Functions\n function handleNavAction(action: CalendarNavAction) {\n switch (action) {\n case 'next-month':\n setCurrentDate(prev => addMonths(prev, 1))\n break\n\n case 'prev-month':\n setCurrentDate(prev => addMonths(prev, -1))\n break\n\n case 'next-year':\n setCurrentDate(prev => addYears(prev, 1))\n break\n\n case 'prev-year':\n setCurrentDate(prev => addYears(prev, -1))\n break\n }\n }\n\n return { currentDate, days, handleNavAction, setCurrentDate }\n}\n","import { styled } from '@hooks/useThemedStyles/types'\n\nexport function createCalendarStyles() {\n return styled({\n container: {\n display: 'flex',\n flexDirection: 'column'\n },\n dateTimeControlContent: {\n display: 'flex',\n\n padding: '0.75rem 1rem',\n paddingBottom: '0'\n },\n monthsContainer: {\n display: 'flex',\n flexDirection: 'row',\n\n alignItems: 'center'\n },\n monthContainer: {\n display: 'flex',\n flexDirection: 'column',\n\n gap: '0.75rem',\n padding: '0.75rem 1rem'\n }\n })\n}\n","// External Libraries\nimport type React from 'react'\nimport { useEffect } from 'react'\nimport { isAfter } from 'date-fns/isAfter'\nimport { parseISO } from 'date-fns/parseISO'\nimport { addMonths } from 'date-fns/addMonths'\nimport { isSameDay } from 'date-fns/isSameDay'\n\n// Components\nimport { CalendarMonth } from './components/CalendarMonth'\nimport { CalendarHeader } from './components/CalendarHeader'\nimport { DateTimeControl } from './components/DateTimeControl'\n\n// Hooks\nimport { useCalendar } from './hooks/useCalendar'\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Utils\nimport {\n DEFAULT_VIEW_MODE,\n DEFAULT_DATE_FORMAT,\n DEFAULT_TIME_FORMAT\n} from './constants'\n\n// Types\nimport type { CalendarProps } from './types'\n\n// Styles\nimport { createCalendarStyles } from './styles'\n\nexport const Calendar: React.FC<CalendarProps> = ({\n viewMode = DEFAULT_VIEW_MODE,\n dateFormat = DEFAULT_DATE_FORMAT,\n timeFormat = DEFAULT_TIME_FORMAT,\n ...props\n}) => {\n const resolvedProps = { timeFormat, dateFormat, viewMode, ...props }\n\n // Hooks\n const mainCalendar = useCalendar()\n const secondaryCalendar = useCalendar(addMonths(mainCalendar.currentDate, 1))\n const { styles } = useThemedStyles(resolvedProps, createCalendarStyles, {\n applyCommonProps: true\n })\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>\n useEffect(() => {\n secondaryCalendar.setCurrentDate(addMonths(mainCalendar.currentDate, 1))\n }, [mainCalendar.currentDate])\n\n // Functions\n function handleSelect(day: Date) {\n const { value, selectionMode, onChange } = resolvedProps\n\n if (selectionMode === 'single') {\n onChange({ start: day.toISOString() })\n } else {\n const start = value?.start ? parseISO(value.start) : null\n const end = value?.end ? parseISO(value.end) : null\n\n if (!start || (start && end)) {\n onChange({ start: day.toISOString(), end: undefined })\n } else if (start && !end) {\n const [from, to] =\n isAfter(day, start) || isSameDay(day, start)\n ? [start, day]\n : [day, start]\n\n onChange({ start: from.toISOString(), end: to.toISOString() })\n }\n }\n }\n\n return (\n <div style={styles.container}>\n <div style={styles.dateTimeControlContent}>\n <DateTimeControl\n {...resolvedProps}\n onError={resolvedProps.onDateTimeError}\n />\n </div>\n\n <div style={styles.monthsContainer}>\n <div style={styles.monthContainer}>\n <CalendarHeader\n position=\"left\"\n currentDate={mainCalendar.currentDate}\n isDualView={resolvedProps.viewMode === 'double'}\n disablePastDates={resolvedProps.disablePastDates}\n disableFutureDates={resolvedProps.disableFutureDates}\n onNavAction={mainCalendar.handleNavAction}\n />\n\n <CalendarMonth\n days={mainCalendar.days}\n selection={resolvedProps.value}\n disablePastDates={resolvedProps.disablePastDates}\n disableFutureDates={resolvedProps.disableFutureDates}\n onDayClick={handleSelect}\n />\n </div>\n\n {resolvedProps.viewMode === 'double' ? (\n <div style={styles.monthContainer}>\n <CalendarHeader\n isDualView\n position=\"right\"\n currentDate={secondaryCalendar.currentDate}\n disablePastDates={resolvedProps.disablePastDates}\n disableFutureDates={resolvedProps.disableFutureDates}\n onNavAction={mainCalendar.handleNavAction}\n />\n\n <CalendarMonth\n days={secondaryCalendar.days}\n selection={resolvedProps.value}\n disablePastDates={resolvedProps.disablePastDates}\n disableFutureDates={resolvedProps.disableFutureDates}\n onDayClick={handleSelect}\n />\n </div>\n ) : null}\n </div>\n </div>\n )\n}\n","import type { TimeFormat } from '../../types'\n\ninterface BuildDisplayFormatParams {\n displayDateFormat: string\n isDateTimePicker: boolean\n timeFormat: TimeFormat\n}\n\nfunction hasTimeTokens(formatStr: string) {\n return /(H{1,2}|h{1,2}|m{1,2}|a)/.test(formatStr)\n}\n\nfunction normalizeTimeFormat(formatStr: string, timeFormat: '12h' | '24h') {\n if (timeFormat === '24h') {\n return formatStr\n .replace(/h{1,2}/g, match => (match.length === 2 ? 'HH' : 'H'))\n .replace(/\\s*a/g, '')\n }\n\n return formatStr.replace(/H{1,2}/g, match =>\n match.length === 2 ? 'hh' : 'h'\n )\n}\n\nfunction getDefaultTimeFormat(timeFormat: '12h' | '24h') {\n return timeFormat === '24h' ? 'HH:mm' : 'hh:mm a'\n}\n\nexport function buildDisplayFormat({\n displayDateFormat,\n isDateTimePicker,\n timeFormat\n}: BuildDisplayFormatParams) {\n const formatHasTime = hasTimeTokens(displayDateFormat)\n\n if (!isDateTimePicker) {\n return formatHasTime\n ? displayDateFormat.replace(/\\s*(H{1,2}|h{1,2}|m{1,2}|a|:)+/g, '')\n : displayDateFormat\n }\n\n if (formatHasTime) {\n return normalizeTimeFormat(displayDateFormat, timeFormat)\n }\n\n const timeFormatStr = getDefaultTimeFormat(timeFormat)\n return `${displayDateFormat} ${timeFormatStr}`\n}\n","import { styled } from '@hooks/useThemedStyles/types'\nimport type { DatePickerTriggerProps } from './types'\n\nexport function createDatePickerTriggerStyles(props: DatePickerTriggerProps) {\n return styled({\n container: {\n width: '100%',\n\n display: 'flex',\n flexDirection: 'column',\n\n gap: '0.5rem',\n\n opacity: props.disabled ? 0.5 : 1,\n cursor: props.disabled ? 'not-allowed' : 'pointer'\n },\n button: {\n width: '100%',\n\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n\n gap: '0.5rem',\n borderRadius: '0.5rem',\n padding: '0.625rem 0.875rem',\n\n border: props.errorMessage\n ? '1px solid var(--px-color-error)'\n : '1px solid var(--px-border-primary)',\n\n __rules: {\n '&:hover': {\n boxShadow: 'var(--px-shadow-default)',\n borderColor: 'var(--px-color-primary)'\n },\n '&:focus-within': {\n outlineOffset: '-1px',\n outline: props.errorMessage\n ? '2px solid var(--px-color-error)'\n : `2px solid var(--px-color-primary)`\n }\n }\n },\n buttonContent: {\n display: 'flex',\n alignItems: 'center',\n gap: '0.5rem'\n }\n })\n}\n","// External Libraries\nimport { ptBR } from 'date-fns/locale'\nimport { format } from 'date-fns/format'\nimport { forwardRef, useId } from 'react'\nimport { parseISO } from 'date-fns/parseISO'\n\n// Components\nimport { Icon } from '@components/commons/toolkit/Icon'\nimport { Label } from '@components/commons/toolkit/Label'\nimport { Typography } from '@components/commons/toolkit/Typography'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Utils\nimport { buildDisplayFormat } from './utils'\nimport {\n DEFAULT_TIME_FORMAT,\n DEFAULT_DISPLAY_DATE_FORMAT\n} from '@components/commons/toolkit/Calendar/constants'\n\n// Types\nimport type { DatePickerTriggerProps } from './types'\n\n// Styles\nimport { createDatePickerTriggerStyles } from './styles'\n\nexport const DatePickerTrigger = forwardRef<\n HTMLButtonElement,\n DatePickerTriggerProps\n>(function DatePickerTrigger(\n {\n timeFormat = DEFAULT_TIME_FORMAT,\n displayDateFormat = DEFAULT_DISPLAY_DATE_FORMAT,\n ...props\n },\n ref\n) {\n // Hooks\n const inputId = useId()\n const { styles, classes } = useThemedStyles(\n props,\n createDatePickerTriggerStyles,\n {\n pick: p => [p.disabled, p.errorMessage],\n applyCommonProps: true,\n commonSlot: 'container'\n }\n )\n\n // Constants\n const { label, value, disabled, required, placeholder, onClick } = props\n const hasValue = !!value?.start\n\n // Functions\n function renderDate() {\n if (!hasValue) return placeholder ?? 'Selecione uma data'\n\n const { start, end } = value\n\n const finalFormat = buildDisplayFormat({\n timeFormat,\n displayDateFormat,\n isDateTimePicker: !!props.isDateTimePicker\n })\n\n const startDate = format(parseISO(start), finalFormat, { locale: ptBR })\n const endDate = end\n ? format(parseISO(end), finalFormat, { locale: ptBR })\n : ''\n\n return `${startDate}${endDate ? ` - ${endDate}` : ''}`\n }\n\n return (\n <div style={styles.container}>\n <Label\n label={label}\n htmlFor={inputId}\n required={required}\n requiredColor=\"var(--color-error)\"\n />\n\n <button\n ref={ref}\n type=\"button\"\n disabled={disabled}\n style={styles.button}\n aria-labelledby={inputId}\n aria-expanded={props.ariaExpanded}\n className={classes.button}\n onClick={onClick}\n >\n <div style={styles.buttonContent}>\n <Icon\n size=\"sm\"\n name=\"general-calendar\"\n color=\"var(--px-text-primary)\"\n />\n\n <Typography variant=\"b1\" className=\"font-normal\">\n {renderDate()}\n </Typography>\n </div>\n\n <Icon\n size=\"sm\"\n color=\"var(--px-text-primary)\"\n name={props.ariaExpanded ? 'chevrons-up' : 'chevrons-down'}\n />\n </button>\n\n {props.errorMessage ? (\n <Typography\n variant=\"b2\"\n fontSize=\"0.75rem\"\n fontWeight=\"regular\"\n color=\"var(--px-color-error)\"\n >\n {props.errorMessage}\n </Typography>\n ) : null}\n </div>\n )\n})\n","// External Libraries\nimport { useState } from 'react'\n\n// Types\nimport type { DatePickerProps } from '../types'\nimport type { PickedDate } from '@components/commons/toolkit/Calendar/types'\n\nexport function useDatePicker(params: DatePickerProps) {\n // States\n const [isOpen, setOpen] = useState(false)\n const [selectedDate, setSelectedDate] = useState<PickedDate>()\n const [hasDateTimeError, setHasDateTimeError] = useState(false)\n\n // Functions\n function toggleDialog(status: boolean) {\n if (status) setSelectedDate(params.value)\n\n setOpen(status)\n }\n\n function handleDateChange(value: PickedDate) {\n const isAutoConfirm =\n params.selectionMode === 'single' && !params.isDateTimePicker\n\n if (isAutoConfirm) {\n setOpen(false)\n params.onChange(value)\n return\n }\n\n setSelectedDate(value)\n }\n\n function handleDateTimeError(hasError: boolean) {\n setHasDateTimeError(hasError)\n }\n\n function handleConfirmClick() {\n if (!selectedDate || hasDateTimeError) return\n\n setOpen(false)\n params.onChange(selectedDate)\n }\n\n return {\n isOpen,\n selectedDate,\n toggleDialog,\n handleDateChange,\n handleDateTimeError,\n handleConfirmClick\n }\n}\n","import { styled } from '@hooks/useThemedStyles/types'\nimport type { DatePickerProps } from './types'\n\nexport function createDatePickerStyles(props: DatePickerProps) {\n return styled({\n container: {\n width: '100%'\n },\n\n divider: {\n border: 0,\n display: 'flex',\n marginBlock: '0.1rem',\n borderTop: '1px solid var(--px-border-primary)'\n },\n\n buttonsContainer: {\n width: '100%',\n display: 'flex',\n\n alignItems: 'center',\n justifyContent: props.viewMode === 'single' ? 'center' : 'flex-end',\n\n gap: '0.75rem',\n padding: '0.5rem 1rem'\n }\n })\n}\n","import type { CalendarProps } from '@components/commons/toolkit/Calendar/types'\n\nexport * from '@components/commons/toolkit/Calendar/types'\n\nexport interface DatePickerProps extends CalendarProps {\n label: string\n\n required?: boolean\n disabled?: boolean\n placeholder?: string\n errorMessage?: string\n scrollContainerId: string\n placementContainer?: 'bottom' | 'bottom-end' | 'bottom-start'\n}\n","// External Libraries\nimport type React from 'react'\n\n// Components\nimport { Button } from '@components/commons/buttons/Button'\nimport { Calendar } from '@components/commons/toolkit/Calendar'\nimport { DatePickerTrigger } from './components/DatePickerTrigger'\nimport { BasePopover } from '@components/commons/structure/BasePopover'\n\n// Hooks\nimport { useDatePicker } from './hooks/useDatePicker'\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Types\nimport type { DatePickerProps } from './types'\nimport type { PopoverTriggerRenderProps } from '@components/commons/toolkit/Popover/types'\n\n// Styles\nimport { createDatePickerStyles } from './styles'\n\nexport * as DatePickerTypes from './types'\n\nexport const DatePicker: React.FC<DatePickerProps> = ({\n placementContainer = 'bottom-start',\n ...props\n}) => {\n // Hooks\n const {\n isOpen,\n selectedDate,\n toggleDialog,\n handleDateChange,\n handleConfirmClick,\n handleDateTimeError\n } = useDatePicker(props)\n const { styles } = useThemedStyles(props, createDatePickerStyles, {\n applyCommonProps: true,\n commonSlot: 'container'\n })\n\n // Constants\n const isSingleMode = props.viewMode === 'single'\n const isAutoClose =\n props.selectionMode === 'single' && !props.isDateTimePicker\n\n // Functions\n function renderTrigger({\n ref,\n ariaExpanded,\n onClick\n }: PopoverTriggerRenderProps) {\n return (\n <DatePickerTrigger\n {...props}\n ref={ref as any}\n ariaExpanded={ariaExpanded}\n onClick={onClick}\n />\n )\n }\n\n return (\n <div style={styles.container}>\n <BasePopover\n open={isOpen}\n maxWidth=\"fit-content\"\n minWidth=\"fit-content\"\n maxHeight=\"fit-content\"\n portalId={props.portalId}\n trigger={renderTrigger}\n onOpenChange={toggleDialog}\n floatingOptions={{\n strategy: 'fixed',\n placement: placementContainer,\n scrollContainerId: props.scrollContainerId\n }}\n >\n <Calendar\n {...props}\n value={selectedDate}\n selectionMode={props.selectionMode ?? 'range'}\n onChange={handleDateChange}\n onDateTimeError={handleDateTimeError}\n />\n\n {!isAutoClose && isSingleMode ? <hr style={styles.divider} /> : null}\n\n {!isAutoClose ? (\n <div style={styles.buttonsContainer}>\n <Button\n size=\"sm\"\n type=\"button\"\n label=\"Cancelar\"\n variant=\"outlined\"\n fullWidth={isSingleMode}\n onClick={() => toggleDialog(false)}\n />\n\n <Button\n type=\"button\"\n label=\"Apl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,iBAAiB;MACjB;IAED,CAAC,eAAe,eAAe,oBAAC,QAAG,OAAO,OAAO,UAAW,GAAG;IAE/D,CAAC,cACA,qBAAC;KAAI,OAAO,OAAO;gBACjB,oBAAC;MACC,MAAK;MACL,MAAK;MACL,OAAM;MACN,SAAQ;MACR,WAAW;MACX,eAAe,aAAa,MAAM;OAClC,EAEF,oBAAC;MACC,MAAK;MACL,OAAM;MACN,SAAQ;MACR,WAAW;MACX,SAAS;OACT;MACE,GACJ;;IACQ;GACV"}
@@ -2,7 +2,7 @@ import { n as styled, t as useThemedStyles } from "./useThemedStyles-BRdb57J9.js
2
2
  import { t as Icon } from "./Icon-UUxBec64.js";
3
3
  import { t as Label } from "./Label-bfESBaYl.js";
4
4
  import { t as ErrorMessage } from "./ErrorMessage-DE8DECL9.js";
5
- import { c as MaskModule, i as FloatMask, o as Locale, r as IntegerMask, s as MaskType } from "./MaskModule-Bt6ofS1m.js";
5
+ import { c as MaskModule, i as FloatMask, o as Locale, r as IntegerMask, s as MaskType } from "./MaskModule-C69d7U3p.js";
6
6
  import { forwardRef, useEffect, useId, useImperativeHandle, useMemo, useRef, useState } from "react";
7
7
  import { jsx, jsxs } from "react/jsx-runtime";
8
8
 
@@ -222,4 +222,4 @@ Input.displayName = "Input";
222
222
 
223
223
  //#endregion
224
224
  export { Input as t };
225
- //# sourceMappingURL=Input-BVqqXS88.js.map
225
+ //# sourceMappingURL=Input-Dvi973vL.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Input-BVqqXS88.js","names":["value"],"sources":["../src/components/commons/inputs/Input/hooks/utils.ts","../src/components/commons/inputs/Input/hooks/useInput/index.ts","../src/components/commons/inputs/Input/styles.ts","../src/components/commons/inputs/Input/index.tsx"],"sourcesContent":["import type { FloatProps, InputProps } from '../types'\n\nexport function checkIsFloatConfig(props: InputProps): props is FloatProps {\n return props.mask === 'FLOAT'\n}\n","// External Libraries\nimport { useState, useRef, useMemo, useEffect } from 'react'\n\n// Services\nimport { Locale, MaskModule, MaskType } from 'src/services/MaskModule'\n\n// Utils\nimport { checkIsFloatConfig } from '../utils'\n\n// Types\nimport type { InputProps } from '../../types'\nimport { FloatMask } from '@services/MaskModule/locales/br/masks/FloatMask'\nimport { IntegerMask } from '@services/MaskModule/locales/br/masks/IntegerMask'\n\nexport function useInput(props: InputProps) {\n // Constants\n const { value, delay, mask, onChange, min, max, ...rest } = props\n // Refs\n const inputRef = useRef<HTMLInputElement>(null)\n const timeoutRef = useRef<NodeJS.Timeout>(null)\n const internalValueRef = useRef(value)\n\n // States\n const [inputValue, setInputValue] = useState(value)\n const [showPassword, setShowPassword] = useState(false)\n\n // Constants\n // biome-ignore lint/correctness/useExhaustiveDependencies: Not Needed\n const { minLength, maxLength } = useMemo(() => {\n const appliedMask = getMask()\n\n const minLength = rest.minLength ?? appliedMask?.minLength\n const maxLength = rest.maxLength ?? appliedMask?.maxLength\n\n return { minLength, maxLength }\n }, [mask, rest.minLength, rest.maxLength])\n\n // Functions\n function getMask() {\n if (!mask) return undefined\n\n if (mask === MaskType.INTEGER) return new IntegerMask({ max, min })\n\n if (mask === MaskType.FLOAT && checkIsFloatConfig(props)) {\n return new FloatMask({ decimalDigits: props.decimalPlaces })\n }\n\n return MaskModule.getMask(Locale.BR, mask)\n }\n\n function togglePasswordVisibility() {\n setShowPassword(prev => !prev)\n }\n\n function handleRefMethods() {\n return { focus: handleFocus, blur: handleBlur }\n }\n\n function handleFocus() {\n inputRef.current?.focus()\n }\n\n function handleBlur() {\n inputRef.current?.blur()\n }\n\n // Sync only external value changes (not triggered by user typing)\n useEffect(() => {\n if (value !== internalValueRef.current) {\n internalValueRef.current = value\n setInputValue(value)\n }\n }, [value])\n\n function handleChange(e: React.ChangeEvent<HTMLInputElement>) {\n let value = e.target.value\n\n if (timeoutRef.current) clearTimeout(timeoutRef.current)\n\n if (mask) {\n const module = getMask()\n if (module) value = module.format(value)\n }\n\n internalValueRef.current = value\n setInputValue(value)\n\n if (!delay) onChange?.(value)\n else {\n timeoutRef.current = setTimeout(() => onChange?.(value), delay)\n }\n }\n\n return {\n inputRef,\n minLength,\n maxLength,\n inputValue,\n showPassword,\n handleChange,\n handleRefMethods,\n togglePasswordVisibility\n }\n}\n","// Hooks\nimport { styled } from '@hooks/useThemedStyles/types'\n\n// Types\nimport type { InputProps } from './types'\n\nexport function createInputStyles(props: InputProps) {\n return styled({\n container: {\n width: '100%',\n\n display: 'flex',\n flexDirection: 'column',\n\n rowGap: '0.375rem'\n },\n wrapper: {\n width: '100%',\n display: 'flex',\n alignItems: 'center',\n\n borderWidth: 1,\n columnGap: '0.25rem',\n borderRadius: '0.5rem',\n padding: '0.625rem 0.875rem',\n\n opacity: props.disabled ? 0.5 : 1,\n boxShadow: 'var(--px-shadow-default)',\n borderColor: props.errorMessage\n ? 'var(--px-color-error)'\n : 'var(--px-border-primary)',\n\n __rules: {\n '&:focus-within': {\n outlineOffset: '-1px',\n outline: `2px solid var(${props.errorMessage ? '--px-color-error' : '--px-color-primary'})`\n }\n }\n },\n\n input: {\n flex: 1,\n\n fontWeight: 500,\n fontSize: '1rem',\n lineHeight: '1.5rem',\n fontFamily: 'inherit',\n color: 'var(--px-text-primary)',\n\n __rules: {\n '&:disabled': {\n cursor: 'not-allowed'\n },\n\n '&:focus': {\n outline: 'none'\n },\n\n '&::placeholder': {\n fontWeight: 400,\n color: 'var(--px-text-secondary)'\n }\n }\n },\n\n button: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n\n cursor: 'pointer',\n padding: '0.25rem',\n borderRadius: '0.5rem',\n\n __rules: {\n '&:focus': {\n outline: '1px solid var(--px-border-primary)'\n }\n }\n }\n })\n}\n","/** biome-ignore-all lint/a11y/noAutofocus: It's a custom input component */\n// External Libraries\nimport { forwardRef, useId, useImperativeHandle, useMemo } from 'react'\n\n// Components\nimport { Label } from '../../toolkit/Label'\nimport { Icon } from '@components/commons/toolkit/Icon'\nimport { ErrorMessage } from '../../toolkit/ErrorMessage'\n\n// Types\nimport type { InputProps, InputMethods } from './types'\n\n// Hooks\nimport { useInput } from './hooks/useInput'\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Styles\nimport { createInputStyles } from './styles'\n\nexport const Input = forwardRef<InputMethods, InputProps>((props, ref) => {\n // Constants\n const reactId = useId()\n const inputId = useMemo(() => {\n return props.id || `input-${reactId}`\n }, [props.id, reactId])\n\n // Hooks\n const {\n inputRef,\n minLength,\n maxLength,\n inputValue,\n showPassword,\n handleChange,\n handleRefMethods,\n togglePasswordVisibility\n } = useInput(props)\n useImperativeHandle(ref, handleRefMethods)\n\n // Hooks\n const { styles, classes } = useThemedStyles(props, createInputStyles, {\n pick: p => [p.disabled, p.errorMessage, p.value],\n override: props.styles,\n applyCommonProps: true,\n commonSlot: 'container'\n })\n\n // Functions\n function getType() {\n if (props.type === 'password' && showPassword) return 'text'\n return props.type\n }\n\n function renderEndContent() {\n if (props.type === 'password') {\n return (\n <button\n type=\"button\"\n style={styles.button}\n className={classes.button}\n onClick={togglePasswordVisibility}\n >\n <Icon\n size=\"sm\"\n name={showPassword ? 'general-eye-off' : 'general-eye'}\n />\n </button>\n )\n }\n\n return props.endIcon ?? null\n }\n\n return (\n <div style={styles.container}>\n {props.hideLabel ? null : (\n <Label\n htmlFor={inputId}\n label={props.label}\n required={props.required}\n requiredColor={props.requiredColor}\n {...props.labelConfig}\n />\n )}\n\n <div style={styles.wrapper} className={classes.wrapper}>\n {props.startIcon}\n\n <input\n ref={inputRef}\n id={inputId}\n type={getType()}\n value={inputValue}\n style={styles.input}\n minLength={minLength}\n maxLength={maxLength}\n required={props.required}\n disabled={props.disabled}\n className={classes.input}\n autoFocus={props.autoFocus}\n spellCheck={props.spellCheck}\n autoCorrect={props.autoCorrect}\n placeholder={props.placeholder}\n autoComplete={props.autoComplete}\n autoCapitalize={props.autoCapitalize}\n aria-label={!props.hideLabel ? undefined : props.label}\n onChange={handleChange}\n />\n\n {renderEndContent()}\n </div>\n\n {props.errorMessage ? (\n <ErrorMessage message={props.err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js","names":["value"],"sources":["../src/components/commons/inputs/Input/hooks/utils.ts","../src/components/commons/inputs/Input/hooks/useInput/index.ts","../src/components/commons/inputs/Input/styles.ts","../src/components/commons/inputs/Input/index.tsx"],"sourcesContent":["import type { FloatProps, InputProps } from '../types'\n\nexport function checkIsFloatConfig(props: InputProps): props is FloatProps {\n return props.mask === 'FLOAT'\n}\n","// External Libraries\nimport { useState, useRef, useMemo, useEffect } from 'react'\n\n// Services\nimport { Locale, MaskModule, MaskType } from 'src/services/MaskModule'\n\n// Utils\nimport { checkIsFloatConfig } from '../utils'\n\n// Types\nimport type { InputProps } from '../../types'\nimport { FloatMask } from '@services/MaskModule/locales/br/masks/FloatMask'\nimport { IntegerMask } from '@services/MaskModule/locales/br/masks/IntegerMask'\n\nexport function useInput(props: InputProps) {\n // Constants\n const { value, delay, mask, onChange, min, max, ...rest } = props\n // Refs\n const inputRef = useRef<HTMLInputElement>(null)\n const timeoutRef = useRef<NodeJS.Timeout>(null)\n const internalValueRef = useRef(value)\n\n // States\n const [inputValue, setInputValue] = useState(value)\n const [showPassword, setShowPassword] = useState(false)\n\n // Constants\n // biome-ignore lint/correctness/useExhaustiveDependencies: Not Needed\n const { minLength, maxLength } = useMemo(() => {\n const appliedMask = getMask()\n\n const minLength = rest.minLength ?? appliedMask?.minLength\n const maxLength = rest.maxLength ?? appliedMask?.maxLength\n\n return { minLength, maxLength }\n }, [mask, rest.minLength, rest.maxLength])\n\n // Functions\n function getMask() {\n if (!mask) return undefined\n\n if (mask === MaskType.INTEGER) return new IntegerMask({ max, min })\n\n if (mask === MaskType.FLOAT && checkIsFloatConfig(props)) {\n return new FloatMask({ decimalDigits: props.decimalPlaces })\n }\n\n return MaskModule.getMask(Locale.BR, mask)\n }\n\n function togglePasswordVisibility() {\n setShowPassword(prev => !prev)\n }\n\n function handleRefMethods() {\n return { focus: handleFocus, blur: handleBlur }\n }\n\n function handleFocus() {\n inputRef.current?.focus()\n }\n\n function handleBlur() {\n inputRef.current?.blur()\n }\n\n // Sync only external value changes (not triggered by user typing)\n useEffect(() => {\n if (value !== internalValueRef.current) {\n internalValueRef.current = value\n setInputValue(value)\n }\n }, [value])\n\n function handleChange(e: React.ChangeEvent<HTMLInputElement>) {\n let value = e.target.value\n\n if (timeoutRef.current) clearTimeout(timeoutRef.current)\n\n if (mask) {\n const module = getMask()\n if (module) value = module.format(value)\n }\n\n internalValueRef.current = value\n setInputValue(value)\n\n if (!delay) onChange?.(value)\n else {\n timeoutRef.current = setTimeout(() => onChange?.(value), delay)\n }\n }\n\n return {\n inputRef,\n minLength,\n maxLength,\n inputValue,\n showPassword,\n handleChange,\n handleRefMethods,\n togglePasswordVisibility\n }\n}\n","// Hooks\nimport { styled } from '@hooks/useThemedStyles/types'\n\n// Types\nimport type { InputProps } from './types'\n\nexport function createInputStyles(props: InputProps) {\n return styled({\n container: {\n width: '100%',\n\n display: 'flex',\n flexDirection: 'column',\n\n rowGap: '0.375rem'\n },\n wrapper: {\n width: '100%',\n display: 'flex',\n alignItems: 'center',\n\n borderWidth: 1,\n columnGap: '0.25rem',\n borderRadius: '0.5rem',\n padding: '0.625rem 0.875rem',\n\n opacity: props.disabled ? 0.5 : 1,\n boxShadow: 'var(--px-shadow-default)',\n borderColor: props.errorMessage\n ? 'var(--px-color-error)'\n : 'var(--px-border-primary)',\n\n __rules: {\n '&:focus-within': {\n outlineOffset: '-1px',\n outline: `2px solid var(${props.errorMessage ? '--px-color-error' : '--px-color-primary'})`\n }\n }\n },\n\n input: {\n flex: 1,\n\n fontWeight: 500,\n fontSize: '1rem',\n lineHeight: '1.5rem',\n fontFamily: 'inherit',\n color: 'var(--px-text-primary)',\n\n __rules: {\n '&:disabled': {\n cursor: 'not-allowed'\n },\n\n '&:focus': {\n outline: 'none'\n },\n\n '&::placeholder': {\n fontWeight: 400,\n color: 'var(--px-text-secondary)'\n }\n }\n },\n\n button: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n\n cursor: 'pointer',\n padding: '0.25rem',\n borderRadius: '0.5rem',\n\n __rules: {\n '&:focus': {\n outline: '1px solid var(--px-border-primary)'\n }\n }\n }\n })\n}\n","/** biome-ignore-all lint/a11y/noAutofocus: It's a custom input component */\n// External Libraries\nimport { forwardRef, useId, useImperativeHandle, useMemo } from 'react'\n\n// Components\nimport { Label } from '../../toolkit/Label'\nimport { Icon } from '@components/commons/toolkit/Icon'\nimport { ErrorMessage } from '../../toolkit/ErrorMessage'\n\n// Types\nimport type { InputProps, InputMethods } from './types'\n\n// Hooks\nimport { useInput } from './hooks/useInput'\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Styles\nimport { createInputStyles } from './styles'\n\nexport const Input = forwardRef<InputMethods, InputProps>((props, ref) => {\n // Constants\n const reactId = useId()\n const inputId = useMemo(() => {\n return props.id || `input-${reactId}`\n }, [props.id, reactId])\n\n // Hooks\n const {\n inputRef,\n minLength,\n maxLength,\n inputValue,\n showPassword,\n handleChange,\n handleRefMethods,\n togglePasswordVisibility\n } = useInput(props)\n useImperativeHandle(ref, handleRefMethods)\n\n // Hooks\n const { styles, classes } = useThemedStyles(props, createInputStyles, {\n pick: p => [p.disabled, p.errorMessage, p.value],\n override: props.styles,\n applyCommonProps: true,\n commonSlot: 'container'\n })\n\n // Functions\n function getType() {\n if (props.type === 'password' && showPassword) return 'text'\n return props.type\n }\n\n function renderEndContent() {\n if (props.type === 'password') {\n return (\n <button\n type=\"button\"\n style={styles.button}\n className={classes.button}\n onClick={togglePasswordVisibility}\n >\n <Icon\n size=\"sm\"\n name={showPassword ? 'general-eye-off' : 'general-eye'}\n />\n </button>\n )\n }\n\n return props.endIcon ?? null\n }\n\n return (\n <div style={styles.container}>\n {props.hideLabel ? null : (\n <Label\n htmlFor={inputId}\n label={props.label}\n required={props.required}\n requiredColor={props.requiredColor}\n {...props.labelConfig}\n />\n )}\n\n <div style={styles.wrapper} className={classes.wrapper}>\n {props.startIcon}\n\n <input\n ref={inputRef}\n id={inputId}\n type={getType()}\n value={inputValue}\n style={styles.input}\n minLength={minLength}\n maxLength={maxLength}\n required={props.required}\n disabled={props.disabled}\n className={classes.input}\n autoFocus={props.autoFocus}\n spellCheck={props.spellCheck}\n autoCorrect={props.autoCorrect}\n placeholder={props.placeholder}\n autoComplete={props.autoComplete}\n autoCapitalize={props.autoCapitalize}\n aria-label={!props.hideLabel ? undefined : props.label}\n onChange={handleChange}\n />\n\n {renderEndContent()}\n </div>\n\n {props.errorMessage ? (\n <ErrorMessage message={props.errorMessage} />\n ) : null}\n </div>\n )\n})\n\nInput.displayName = 'Input'\n"],"mappings":";;;;;;;;;AAEA,SAAgB,mBAAmB,OAAwC;AACzE,QAAO,MAAM,SAAS;;;;;ACWxB,SAAgB,SAAS,OAAmB;CAE1C,MAAM,EAAE,OAAO,OAAO,MAAM,UAAU,KAAK,KAAK,GAAG,SAAS;CAE5D,MAAM,WAAW,OAAyB,KAAK;CAC/C,MAAM,aAAa,OAAuB,KAAK;CAC/C,MAAM,mBAAmB,OAAO,MAAM;CAGtC,MAAM,CAAC,YAAY,iBAAiB,SAAS,MAAM;CACnD,MAAM,CAAC,cAAc,mBAAmB,SAAS,MAAM;CAIvD,MAAM,EAAE,WAAW,cAAc,cAAc;EAC7C,MAAM,cAAc,SAAS;AAK7B,SAAO;GAAE,WAHS,KAAK,aAAa,aAAa;GAG7B,WAFF,KAAK,aAAa,aAAa;GAElB;IAC9B;EAAC;EAAM,KAAK;EAAW,KAAK;EAAU,CAAC;CAG1C,SAAS,UAAU;AACjB,MAAI,CAAC,KAAM,QAAO;AAElB,MAAI,SAAS,SAAS,QAAS,QAAO,IAAI,YAAY;GAAE;GAAK;GAAK,CAAC;AAEnE,MAAI,SAAS,SAAS,SAAS,mBAAmB,MAAM,CACtD,QAAO,IAAI,UAAU,EAAE,eAAe,MAAM,eAAe,CAAC;AAG9D,SAAO,WAAW,QAAQ,OAAO,IAAI,KAAK;;CAG5C,SAAS,2BAA2B;AAClC,mBAAgB,SAAQ,CAAC,KAAK;;CAGhC,SA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AAM;MACjB,YAAY,MAAM;MAClB,aAAa,MAAM;MACnB,aAAa,MAAM;MACnB,cAAc,MAAM;MACpB,gBAAgB,MAAM;MACtB,cAAY,CAAC,MAAM,YAAY,SAAY,MAAM;MACjD,UAAU;OACV;KAED,kBAAkB;;KACf;GAEL,MAAM,eACL,oBAAC,gBAAa,SAAS,MAAM,eAAgB,GAC3C;;GACA;EAER;AAEF,MAAM,cAAc"}
@@ -74,6 +74,16 @@ function onlyDigits(value) {
74
74
  return value.replace(/\D/g, "");
75
75
  }
76
76
  /**
77
+ * Removes all non-alphanumeric characters and uppercases the result.
78
+ * Used by the alphanumeric CNPJ format (RFB IN nº 2.229/2024, valid from Jul/2026).
79
+ * @param value - Input string.
80
+ * @returns Uppercase string containing only letters (A-Z) and digits (0-9).
81
+ */
82
+ function onlyAlphanumeric(value) {
83
+ if (value == null) return "";
84
+ return value.toUpperCase().replace(/[^A-Z0-9]/g, "");
85
+ }
86
+ /**
77
87
  * Applies the mask progressively according to the available characters.
78
88
  *
79
89
  * Alphanumeric characters (letters and digits) in the pattern will be replaced
@@ -169,9 +179,21 @@ var CnpjMask = class extends BaseMask {
169
179
  super(length, length);
170
180
  }
171
181
  format(value) {
172
- return limitLength(applyPattern(onlyDigits(value), CNPJ_PATTERN), this.maxLength);
182
+ return limitLength(applyPattern(sanitizeCnpj(value), CNPJ_PATTERN), this.maxLength);
183
+ }
184
+ unmask(value) {
185
+ return sanitizeCnpj(value);
173
186
  }
174
187
  };
188
+ /**
189
+ * Sanitizes a CNPJ keeping the new alphanumeric format:
190
+ * the first 12 positions (root + establishment order) are alphanumeric,
191
+ * the last 2 (check digits) remain strictly numeric.
192
+ */
193
+ function sanitizeCnpj(value) {
194
+ const cleaned = onlyAlphanumeric(value);
195
+ return cleaned.slice(0, 12) + onlyDigits(cleaned.slice(12));
196
+ }
175
197
 
176
198
  //#endregion
177
199
  //#region src/services/MaskModule/locales/br/masks/DateMask.ts
@@ -632,33 +654,48 @@ var CnpjValidator = class extends BaseValidator {
632
654
  }
633
655
  };
634
656
  /**
635
- * Validates whether a given CNPJ number is valid.
636
- * @param cnpj The CNPJ number as a string.
657
+ * Validates a CNPJ in both the legacy numeric and the new alphanumeric format
658
+ * (RFB IN 2.229/2024, valid from Jul/2026).
659
+ *
660
+ * The 12-position base may contain letters (A-Z) and digits, while the 2 check
661
+ * digits remain strictly numeric. The check-digit calculation keeps the módulo 11
662
+ * formula, replacing each character by its ASCII code minus 48 (so '0'=0..'9'=9,
663
+ * 'A'=17, 'B'=18, ...). For legacy numeric CNPJs this is identical to the old rule.
664
+ *
665
+ * @param cnpj The CNPJ as a string (masked or unmasked).
637
666
  * @returns True if valid, false otherwise.
638
667
  */
639
668
  function isCnpjValid(cnpj) {
640
669
  if (!cnpj) return false;
641
- const cleanedCnpj = cnpj.replace(/[^\d]+/g, "");
670
+ const cleanedCnpj = onlyAlphanumeric(cnpj);
642
671
  if (cleanedCnpj.length !== 14) return false;
643
- if (/^(\d)\1{13}$/.test(cleanedCnpj)) return false;
672
+ if (/^(.)\1{13}$/.test(cleanedCnpj)) return false;
644
673
  const baseCnpj = cleanedCnpj.slice(0, 12);
645
674
  const checkDigits = cleanedCnpj.slice(12);
675
+ if (!/^\d{2}$/.test(checkDigits)) return false;
646
676
  const firstCheckDigit = calculateCnpjCheckDigit(calculateCnpjWeightedSum(baseCnpj, 12, 5));
647
677
  if (firstCheckDigit !== Number(checkDigits.charAt(0))) return false;
648
678
  if (calculateCnpjCheckDigit(calculateCnpjWeightedSum(baseCnpj + firstCheckDigit, 13, 6)) !== Number(checkDigits.charAt(1))) return false;
649
679
  return true;
650
680
  }
651
681
  /**
682
+ * Converts a CNPJ character to its weighting value: ASCII code minus 48.
683
+ * Digits map to themselves (0-9); letters map to 17+ ('A'=17, 'B'=18, ...).
684
+ */
685
+ function charValue(char) {
686
+ return char.charCodeAt(0) - 48;
687
+ }
688
+ /**
652
689
  * Calculates the weighted sum for CNPJ verification digits.
653
690
  * @param numbers The numeric string of the CNPJ.
654
691
  * @param size The number of digits to consider for the calculation.
655
692
  * @param position The starting multiplier position (5 or 6).
656
693
  * @returns The weighted sum.
657
694
  */
658
- function calculateCnpjWeightedSum(numbers, size, position) {
695
+ function calculateCnpjWeightedSum(chars, size, position) {
659
696
  let sum = 0;
660
697
  for (let i = 0; i < size; i++) {
661
- sum += Number(numbers.charAt(i)) * position;
698
+ sum += charValue(chars.charAt(i)) * position;
662
699
  position--;
663
700
  if (position < 2) position = 9;
664
701
  }
@@ -961,4 +998,4 @@ registerBrMasks();
961
998
 
962
999
  //#endregion
963
1000
  export { DateMask as a, MaskModule as c, FloatMask as i, DateValidator as n, Locale as o, IntegerMask as r, MaskType as s, TimeValidator as t };
964
- //# sourceMappingURL=MaskModule-Bt6ofS1m.js.map
1001
+ //# sourceMappingURL=MaskModule-C69d7U3p.js.map