@umodeapporg/ui 0.34.0 → 0.34.2

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.
@@ -0,0 +1,8 @@
1
+ import { DropdownProps } from 'react-day-picker';
2
+ import * as React from 'react';
3
+ export declare const CalendarMonthsDropdown: (props: DropdownProps) => React.JSX.Element;
4
+ export declare const CalendarYearsDropdown: (props: DropdownProps) => React.JSX.Element;
5
+ export declare const CALENDAR_DROPDOWN_COMPONENTS: {
6
+ MonthsDropdown: (props: DropdownProps) => React.JSX.Element;
7
+ YearsDropdown: (props: DropdownProps) => React.JSX.Element;
8
+ };
@@ -0,0 +1,55 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useMemo } from "react";
3
+ import { ControlledSelect } from "../Form/ControlledSelect.js";
4
+ const MONTHS_DROPDOWN_WIDTH_CLASS = "w-32";
5
+ const YEARS_DROPDOWN_WIDTH_CLASS = "w-24";
6
+ const DROPDOWN_INPUT_CLASS = "font-semibold";
7
+ const CalendarDropdown = ({
8
+ options,
9
+ value,
10
+ onChange,
11
+ disabled,
12
+ widthClassName,
13
+ "aria-label": ariaLabel
14
+ }) => {
15
+ const selectOptions = useMemo(
16
+ () => (options ?? []).map((option) => ({
17
+ value: String(option.value),
18
+ label: option.label,
19
+ disabled: option.disabled
20
+ })),
21
+ [options]
22
+ );
23
+ const handleSelectionChange = (selected) => {
24
+ const nextValue = Array.isArray(selected) ? selected[0] : selected;
25
+ if (!nextValue) return;
26
+ onChange?.({ target: { value: nextValue } });
27
+ };
28
+ return /* @__PURE__ */ jsx(
29
+ ControlledSelect,
30
+ {
31
+ compact: true,
32
+ ariaLabel,
33
+ options: selectOptions,
34
+ selectedValue: value === void 0 ? "" : String(value),
35
+ onChangeHook: handleSelectionChange,
36
+ searchable: false,
37
+ clearable: false,
38
+ disabled,
39
+ className: widthClassName,
40
+ inputClassName: DROPDOWN_INPUT_CLASS
41
+ }
42
+ );
43
+ };
44
+ const CalendarMonthsDropdown = (props) => /* @__PURE__ */ jsx(CalendarDropdown, { ...props, widthClassName: MONTHS_DROPDOWN_WIDTH_CLASS });
45
+ const CalendarYearsDropdown = (props) => /* @__PURE__ */ jsx(CalendarDropdown, { ...props, widthClassName: YEARS_DROPDOWN_WIDTH_CLASS });
46
+ const CALENDAR_DROPDOWN_COMPONENTS = {
47
+ MonthsDropdown: CalendarMonthsDropdown,
48
+ YearsDropdown: CalendarYearsDropdown
49
+ };
50
+ export {
51
+ CALENDAR_DROPDOWN_COMPONENTS,
52
+ CalendarMonthsDropdown,
53
+ CalendarYearsDropdown
54
+ };
55
+ //# sourceMappingURL=CalendarDropdown.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CalendarDropdown.js","sources":["../../../src/components/DateTime/CalendarDropdown.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport * as React from 'react';\nimport { DropdownProps } from 'react-day-picker';\n\nimport { ControlledSelect } from '../Form/ControlledSelect';\n\nconst MONTHS_DROPDOWN_WIDTH_CLASS = 'w-32';\nconst YEARS_DROPDOWN_WIDTH_CLASS = 'w-24';\nconst DROPDOWN_INPUT_CLASS = 'font-semibold';\n\ninterface ICalendarDropdownProps extends DropdownProps {\n widthClassName: string;\n}\n\nconst CalendarDropdown = ({\n options,\n value,\n onChange,\n disabled,\n widthClassName,\n 'aria-label': ariaLabel,\n}: ICalendarDropdownProps): React.JSX.Element => {\n const selectOptions = useMemo(\n () =>\n (options ?? []).map((option) => ({\n value: String(option.value),\n label: option.label,\n disabled: option.disabled,\n })),\n [options],\n );\n\n const handleSelectionChange = (selected: string | Array<string>) => {\n const nextValue = Array.isArray(selected) ? selected[0] : selected;\n if (!nextValue) return;\n onChange?.({ target: { value: nextValue } } as unknown as React.ChangeEvent<HTMLSelectElement>);\n };\n\n return (\n <ControlledSelect\n compact\n ariaLabel={ariaLabel}\n options={selectOptions}\n selectedValue={value === undefined ? '' : String(value)}\n onChangeHook={handleSelectionChange}\n searchable={false}\n clearable={false}\n disabled={disabled}\n className={widthClassName}\n inputClassName={DROPDOWN_INPUT_CLASS}\n />\n );\n};\n\nexport const CalendarMonthsDropdown = (props: DropdownProps): React.JSX.Element => (\n <CalendarDropdown {...props} widthClassName={MONTHS_DROPDOWN_WIDTH_CLASS} />\n);\n\nexport const CalendarYearsDropdown = (props: DropdownProps): React.JSX.Element => (\n <CalendarDropdown {...props} widthClassName={YEARS_DROPDOWN_WIDTH_CLASS} />\n);\n\nexport const CALENDAR_DROPDOWN_COMPONENTS = {\n MonthsDropdown: CalendarMonthsDropdown,\n YearsDropdown: CalendarYearsDropdown,\n};\n"],"names":[],"mappings":";;;AAMA,MAAM,8BAA8B;AACpC,MAAM,6BAA6B;AACnC,MAAM,uBAAuB;AAM7B,MAAM,mBAAmB,CAAC;AAAA,EACxB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,cAAc;AAChB,MAAiD;AAC/C,QAAM,gBAAgB;AAAA,IACpB,OACG,WAAW,CAAA,GAAI,IAAI,CAAC,YAAY;AAAA,MAC/B,OAAO,OAAO,OAAO,KAAK;AAAA,MAC1B,OAAO,OAAO;AAAA,MACd,UAAU,OAAO;AAAA,IAAA,EACjB;AAAA,IACJ,CAAC,OAAO;AAAA,EAAA;AAGV,QAAM,wBAAwB,CAAC,aAAqC;AAClE,UAAM,YAAY,MAAM,QAAQ,QAAQ,IAAI,SAAS,CAAC,IAAI;AAC1D,QAAI,CAAC,UAAW;AAChB,eAAW,EAAE,QAAQ,EAAE,OAAO,UAAA,GAAgE;AAAA,EAChG;AAEA,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAO;AAAA,MACP;AAAA,MACA,SAAS;AAAA,MACT,eAAe,UAAU,SAAY,KAAK,OAAO,KAAK;AAAA,MACtD,cAAc;AAAA,MACd,YAAY;AAAA,MACZ,WAAW;AAAA,MACX;AAAA,MACA,WAAW;AAAA,MACX,gBAAgB;AAAA,IAAA;AAAA,EAAA;AAGtB;AAEO,MAAM,yBAAyB,CAAC,UACrC,oBAAC,oBAAkB,GAAG,OAAO,gBAAgB,4BAAA,CAA6B;AAGrE,MAAM,wBAAwB,CAAC,UACpC,oBAAC,oBAAkB,GAAG,OAAO,gBAAgB,2BAAA,CAA4B;AAGpE,MAAM,+BAA+B;AAAA,EAC1C,gBAAgB;AAAA,EAChB,eAAe;AACjB;"}
@@ -8,6 +8,7 @@ import ControlledTooltip from "../UI/ControlledTooltip.js";
8
8
  import { mergeClasses } from "../../helpers/mergeClasses.js";
9
9
  import ControlledInput from "../Form/ControlledInput.js";
10
10
  import { MaterialSymbol } from "../UI/MaterialSymbol/index.js";
11
+ import { CALENDAR_DROPDOWN_COMPONENTS } from "./CalendarDropdown.js";
11
12
  import { resolveDateBounds, DATE_INPUT_MODE, formatTypedDate, CALENDAR_DROPDOWN_CLASS_NAMES, maskDateInput, parseTypedDate, formatDateToYYYYMMDD } from "./dateInputHelpers.js";
12
13
  import "react-day-picker/style.css";
13
14
  const DATE_PICKER_TIMEZONE = "UTC";
@@ -128,6 +129,7 @@ const DatePicker = ({
128
129
  ISOWeek: true,
129
130
  showOutsideDays: true,
130
131
  captionLayout: "dropdown",
132
+ components: CALENDAR_DROPDOWN_COMPONENTS,
131
133
  startMonth: bounds.minDate,
132
134
  endMonth: bounds.maxDate,
133
135
  labels: {
@@ -1 +1 @@
1
- {"version":3,"file":"DatePicker.js","sources":["../../../src/components/DateTime/DatePicker.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport * as React from 'react';\nimport { ptBR } from 'date-fns/locale';\nimport { DateAfter, DateBefore, DayPicker } from 'react-day-picker';\nimport { useTranslation } from 'react-i18next';\n\nimport {\n ControlledPopoverContent,\n ControlledPopoverHandler,\n ControlledPopoverRoot,\n} from '@/components/UI/ControlledPopover';\nimport ControlledTooltip from '@/components/UI/ControlledTooltip';\nimport { mergeClasses } from '@/helpers/mergeClasses';\n\nimport ControlledInput from '../Form/ControlledInput';\nimport { MaterialSymbol } from '../UI/MaterialSymbol';\n\nimport {\n CALENDAR_DROPDOWN_CLASS_NAMES,\n DATE_INPUT_MODE,\n formatDateToYYYYMMDD,\n formatTypedDate,\n maskDateInput,\n parseTypedDate,\n resolveDateBounds,\n TTypedDateStatus,\n} from './dateInputHelpers';\n\nimport 'react-day-picker/style.css';\n\nconst DATE_PICKER_TIMEZONE = 'UTC';\n\nexport interface IDatePickerProps {\n /** Reaches the field itself, so a `FieldLabel` can point at it. */\n id?: string;\n label?: string;\n /** Text shown inside the empty input. Falls back to the label for the historical behavior. */\n placeholder?: string;\n onUpdate: (value: string | undefined) => void;\n disabled?: boolean;\n minDate?: string;\n maxDate?: string;\n useIcon?: boolean;\n valueRender?: () => React.ReactNode;\n startValue?: Date;\n onFocus?: () => void;\n onBlur?: () => void;\n /** Extra classes for the inner input, which is a `ControlledInput` like any other field. */\n inputClassName?: string;\n}\n\nconst DatePicker: React.FC<IDatePickerProps> = ({\n id,\n label,\n placeholder,\n disabled,\n onUpdate,\n minDate,\n maxDate,\n useIcon,\n valueRender,\n startValue,\n onFocus,\n onBlur,\n inputClassName,\n}) => {\n const { t } = useTranslation('ui');\n const [date, setDate] = useState<Date | undefined>(startValue || undefined);\n const [popoverOpen, setPopoverOpen] = useState(false);\n\n // Hosts pass a freshly parsed Date on every render, so the sync compares\n // timestamps. Without this the picker ignored external changes (clearing\n // filters, applying a preset) and callers had to force a remount via `key`.\n const startTime = startValue ? startValue.getTime() : null;\n const syncedStartTimeRef = useRef(startTime);\n\n useEffect(() => {\n if (syncedStartTimeRef.current === startTime) return;\n syncedStartTimeRef.current = startTime;\n setDate(startTime === null ? undefined : new Date(startTime));\n }, [startTime]);\n\n const [displayedMonth, setDisplayedMonth] = useState<Date>(startValue ?? new Date());\n const [isTyping, setIsTyping] = useState(false);\n const [typedText, setTypedText] = useState('');\n const [typedStatus, setTypedStatus] = useState<TTypedDateStatus>('empty');\n\n const bounds = resolveDateBounds(minDate, maxDate);\n\n const commitDate = (nextDate: Date | undefined) => {\n setDate(nextDate);\n onUpdate(nextDate ? formatDateToYYYYMMDD(nextDate) : undefined);\n };\n\n const handleSelectedDate = (selectedDate: Date | undefined) => {\n commitDate(selectedDate);\n setTypedText(formatTypedDate(selectedDate));\n setTypedStatus(selectedDate ? 'valid' : 'empty');\n setPopoverOpen(false);\n };\n\n const handlePopoverChange = (nextOpen: boolean) => {\n if (nextOpen) setDisplayedMonth(date ?? new Date());\n setPopoverOpen(nextOpen);\n };\n\n const openPopover = () => {\n if (!popoverOpen) handlePopoverChange(true);\n };\n\n const handleInputClick = (event: React.MouseEvent<HTMLInputElement>) => {\n event.stopPropagation();\n openPopover();\n };\n\n const handleInputFocus = () => {\n setIsTyping(true);\n setTypedText(formatTypedDate(date));\n setTypedStatus(date ? 'valid' : 'empty');\n };\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const maskedText = maskDateInput(event.target.value);\n const parsed = parseTypedDate(maskedText, bounds);\n setTypedText(maskedText);\n setTypedStatus(parsed.status);\n openPopover();\n if (parsed.status === 'valid' && parsed.date) {\n commitDate(parsed.date);\n setDisplayedMonth(parsed.date);\n }\n };\n\n const handleInputBlur = () => {\n setIsTyping(false);\n if (typedStatus === 'empty' && date) commitDate(undefined);\n onBlur?.();\n };\n\n const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key !== 'Enter') return;\n event.preventDefault();\n if (typedStatus === 'valid' || typedStatus === 'empty') setPopoverOpen(false);\n };\n\n const clear = (event: React.MouseEvent<HTMLDivElement>) => {\n event.stopPropagation();\n handleSelectedDate(undefined);\n };\n\n const typedErrorMessage =\n isTyping && typedStatus === 'invalid'\n ? t('dates.invalidDate')\n : isTyping && typedStatus === 'outOfRange'\n ? t('dates.outOfRange')\n : undefined;\n\n const beforeMatcher: DateBefore = { before: bounds.minDate };\n const afterMatcher: DateAfter = { after: bounds.maxDate };\n\n return (\n <ControlledPopoverRoot placement=\"bottom\" open={popoverOpen} handler={handlePopoverChange}>\n <ControlledPopoverHandler>\n <div className=\"zIndexMax flex w-full flex-row items-center gap-x-1\" onFocus={onFocus}>\n {useIcon && <MaterialSymbol icon=\"calendar_month\" size={20} />}\n {valueRender ? (\n valueRender()\n ) : (\n <div className=\"relative w-full\">\n <ControlledInput\n id={id}\n aria-label={label}\n inputMode={DATE_INPUT_MODE}\n autoComplete=\"off\"\n placeholder={placeholder ?? label ?? t('dates.typeDatePlaceholder')}\n className={mergeClasses('focus:border-border-strong', inputClassName)}\n disabled={disabled}\n error={Boolean(typedErrorMessage)}\n errorMessage={typedErrorMessage}\n value={isTyping ? typedText : formatTypedDate(date)}\n onClick={handleInputClick}\n onFocus={handleInputFocus}\n onChange={handleInputChange}\n onBlur={handleInputBlur}\n onKeyDown={handleInputKeyDown}\n />\n\n {date && (\n <ControlledTooltip content={t('dates.clearSelection')}>\n <div onClick={clear} className=\"absolute inset-y-0 right-4 flex cursor-pointer items-center\">\n <MaterialSymbol icon=\"close_small\" size={20} color=\"rgb(var(--color-foreground-subtle))\" />\n </div>\n </ControlledTooltip>\n )}\n </div>\n )}\n </div>\n </ControlledPopoverHandler>\n <ControlledPopoverContent className=\"zIndexMax m-0 p-0\">\n <DayPicker\n ISOWeek\n showOutsideDays\n captionLayout=\"dropdown\"\n startMonth={bounds.minDate}\n endMonth={bounds.maxDate}\n labels={{\n labelMonthDropdown: () => t('dates.chooseMonth'),\n labelYearDropdown: () => t('dates.chooseYear'),\n }}\n dir=\"ltr\"\n firstWeekContainsDate={1}\n mode=\"single\"\n numberOfMonths={1}\n timeZone={DATE_PICKER_TIMEZONE}\n weekStartsOn={1}\n locale={ptBR}\n selected={date}\n month={displayedMonth}\n onMonthChange={setDisplayedMonth}\n disabled={[beforeMatcher, afterMatcher]}\n onSelect={handleSelectedDate}\n className=\"p-3\"\n classNames={{\n ...CALENDAR_DROPDOWN_CLASS_NAMES,\n chevron: `fill-foreground`,\n today: `rounded-md bg-muted-active text-foreground`,\n selected: `rounded-md bg-ink text-white hover:bg-ink hover:text-white focus:bg-ink focus:text-white`,\n }}\n />\n </ControlledPopoverContent>\n </ControlledPopoverRoot>\n );\n};\n\nexport default DatePicker;\n"],"names":[],"mappings":";;;;;;;;;;;;AA8BA,MAAM,uBAAuB;AAqB7B,MAAM,aAAyC,CAAC;AAAA,EAC9C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,EAAA,IAAM,eAAe,IAAI;AACjC,QAAM,CAAC,MAAM,OAAO,IAAI,SAA2B,cAAc,MAAS;AAC1E,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,KAAK;AAKpD,QAAM,YAAY,aAAa,WAAW,QAAA,IAAY;AACtD,QAAM,qBAAqB,OAAO,SAAS;AAE3C,YAAU,MAAM;AACd,QAAI,mBAAmB,YAAY,UAAW;AAC9C,uBAAmB,UAAU;AAC7B,YAAQ,cAAc,OAAO,SAAY,IAAI,KAAK,SAAS,CAAC;AAAA,EAC9D,GAAG,CAAC,SAAS,CAAC;AAEd,QAAM,CAAC,gBAAgB,iBAAiB,IAAI,SAAe,cAAc,oBAAI,MAAM;AACnF,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,KAAK;AAC9C,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,EAAE;AAC7C,QAAM,CAAC,aAAa,cAAc,IAAI,SAA2B,OAAO;AAExE,QAAM,SAAS,kBAAkB,SAAS,OAAO;AAEjD,QAAM,aAAa,CAAC,aAA+B;AACjD,YAAQ,QAAQ;AAChB,aAAS,WAAW,qBAAqB,QAAQ,IAAI,MAAS;AAAA,EAChE;AAEA,QAAM,qBAAqB,CAAC,iBAAmC;AAC7D,eAAW,YAAY;AACvB,iBAAa,gBAAgB,YAAY,CAAC;AAC1C,mBAAe,eAAe,UAAU,OAAO;AAC/C,mBAAe,KAAK;AAA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/C,KAAI;AAAA,QACJ,uBAAuB;AAAA,QACvB,MAAK;AAAA,QACL,gBAAgB;AAAA,QAChB,UAAU;AAAA,QACV,cAAc;AAAA,QACd,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,OAAO;AAAA,QACP,eAAe;AAAA,QACf,UAAU,CAAC,eAAe,YAAY;AAAA,QACtC,UAAU;AAAA,QACV,WAAU;AAAA,QACV,YAAY;AAAA,UACV,GAAG;AAAA,UACH,SAAS;AAAA,UACT,OAAO;AAAA,UACP,UAAU;AAAA,QAAA;AAAA,MACZ;AAAA,IAAA,EACF,CACF;AAAA,EAAA,GACF;AAEJ;"}
1
+ {"version":3,"file":"DatePicker.js","sources":["../../../src/components/DateTime/DatePicker.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react';\nimport * as React from 'react';\nimport { ptBR } from 'date-fns/locale';\nimport { DateAfter, DateBefore, DayPicker } from 'react-day-picker';\nimport { useTranslation } from 'react-i18next';\n\nimport {\n ControlledPopoverContent,\n ControlledPopoverHandler,\n ControlledPopoverRoot,\n} from '@/components/UI/ControlledPopover';\nimport ControlledTooltip from '@/components/UI/ControlledTooltip';\nimport { mergeClasses } from '@/helpers/mergeClasses';\n\nimport ControlledInput from '../Form/ControlledInput';\nimport { MaterialSymbol } from '../UI/MaterialSymbol';\n\nimport { CALENDAR_DROPDOWN_COMPONENTS } from './CalendarDropdown';\nimport {\n CALENDAR_DROPDOWN_CLASS_NAMES,\n DATE_INPUT_MODE,\n formatDateToYYYYMMDD,\n formatTypedDate,\n maskDateInput,\n parseTypedDate,\n resolveDateBounds,\n TTypedDateStatus,\n} from './dateInputHelpers';\n\nimport 'react-day-picker/style.css';\n\nconst DATE_PICKER_TIMEZONE = 'UTC';\n\nexport interface IDatePickerProps {\n /** Reaches the field itself, so a `FieldLabel` can point at it. */\n id?: string;\n label?: string;\n /** Text shown inside the empty input. Falls back to the label for the historical behavior. */\n placeholder?: string;\n onUpdate: (value: string | undefined) => void;\n disabled?: boolean;\n minDate?: string;\n maxDate?: string;\n useIcon?: boolean;\n valueRender?: () => React.ReactNode;\n startValue?: Date;\n onFocus?: () => void;\n onBlur?: () => void;\n /** Extra classes for the inner input, which is a `ControlledInput` like any other field. */\n inputClassName?: string;\n}\n\nconst DatePicker: React.FC<IDatePickerProps> = ({\n id,\n label,\n placeholder,\n disabled,\n onUpdate,\n minDate,\n maxDate,\n useIcon,\n valueRender,\n startValue,\n onFocus,\n onBlur,\n inputClassName,\n}) => {\n const { t } = useTranslation('ui');\n const [date, setDate] = useState<Date | undefined>(startValue || undefined);\n const [popoverOpen, setPopoverOpen] = useState(false);\n\n // Hosts pass a freshly parsed Date on every render, so the sync compares\n // timestamps. Without this the picker ignored external changes (clearing\n // filters, applying a preset) and callers had to force a remount via `key`.\n const startTime = startValue ? startValue.getTime() : null;\n const syncedStartTimeRef = useRef(startTime);\n\n useEffect(() => {\n if (syncedStartTimeRef.current === startTime) return;\n syncedStartTimeRef.current = startTime;\n setDate(startTime === null ? undefined : new Date(startTime));\n }, [startTime]);\n\n const [displayedMonth, setDisplayedMonth] = useState<Date>(startValue ?? new Date());\n const [isTyping, setIsTyping] = useState(false);\n const [typedText, setTypedText] = useState('');\n const [typedStatus, setTypedStatus] = useState<TTypedDateStatus>('empty');\n\n const bounds = resolveDateBounds(minDate, maxDate);\n\n const commitDate = (nextDate: Date | undefined) => {\n setDate(nextDate);\n onUpdate(nextDate ? formatDateToYYYYMMDD(nextDate) : undefined);\n };\n\n const handleSelectedDate = (selectedDate: Date | undefined) => {\n commitDate(selectedDate);\n setTypedText(formatTypedDate(selectedDate));\n setTypedStatus(selectedDate ? 'valid' : 'empty');\n setPopoverOpen(false);\n };\n\n const handlePopoverChange = (nextOpen: boolean) => {\n if (nextOpen) setDisplayedMonth(date ?? new Date());\n setPopoverOpen(nextOpen);\n };\n\n const openPopover = () => {\n if (!popoverOpen) handlePopoverChange(true);\n };\n\n const handleInputClick = (event: React.MouseEvent<HTMLInputElement>) => {\n event.stopPropagation();\n openPopover();\n };\n\n const handleInputFocus = () => {\n setIsTyping(true);\n setTypedText(formatTypedDate(date));\n setTypedStatus(date ? 'valid' : 'empty');\n };\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const maskedText = maskDateInput(event.target.value);\n const parsed = parseTypedDate(maskedText, bounds);\n setTypedText(maskedText);\n setTypedStatus(parsed.status);\n openPopover();\n if (parsed.status === 'valid' && parsed.date) {\n commitDate(parsed.date);\n setDisplayedMonth(parsed.date);\n }\n };\n\n const handleInputBlur = () => {\n setIsTyping(false);\n if (typedStatus === 'empty' && date) commitDate(undefined);\n onBlur?.();\n };\n\n const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key !== 'Enter') return;\n event.preventDefault();\n if (typedStatus === 'valid' || typedStatus === 'empty') setPopoverOpen(false);\n };\n\n const clear = (event: React.MouseEvent<HTMLDivElement>) => {\n event.stopPropagation();\n handleSelectedDate(undefined);\n };\n\n const typedErrorMessage =\n isTyping && typedStatus === 'invalid'\n ? t('dates.invalidDate')\n : isTyping && typedStatus === 'outOfRange'\n ? t('dates.outOfRange')\n : undefined;\n\n const beforeMatcher: DateBefore = { before: bounds.minDate };\n const afterMatcher: DateAfter = { after: bounds.maxDate };\n\n return (\n <ControlledPopoverRoot placement=\"bottom\" open={popoverOpen} handler={handlePopoverChange}>\n <ControlledPopoverHandler>\n <div className=\"zIndexMax flex w-full flex-row items-center gap-x-1\" onFocus={onFocus}>\n {useIcon && <MaterialSymbol icon=\"calendar_month\" size={20} />}\n {valueRender ? (\n valueRender()\n ) : (\n <div className=\"relative w-full\">\n <ControlledInput\n id={id}\n aria-label={label}\n inputMode={DATE_INPUT_MODE}\n autoComplete=\"off\"\n placeholder={placeholder ?? label ?? t('dates.typeDatePlaceholder')}\n className={mergeClasses('focus:border-border-strong', inputClassName)}\n disabled={disabled}\n error={Boolean(typedErrorMessage)}\n errorMessage={typedErrorMessage}\n value={isTyping ? typedText : formatTypedDate(date)}\n onClick={handleInputClick}\n onFocus={handleInputFocus}\n onChange={handleInputChange}\n onBlur={handleInputBlur}\n onKeyDown={handleInputKeyDown}\n />\n\n {date && (\n <ControlledTooltip content={t('dates.clearSelection')}>\n <div onClick={clear} className=\"absolute inset-y-0 right-4 flex cursor-pointer items-center\">\n <MaterialSymbol icon=\"close_small\" size={20} color=\"rgb(var(--color-foreground-subtle))\" />\n </div>\n </ControlledTooltip>\n )}\n </div>\n )}\n </div>\n </ControlledPopoverHandler>\n <ControlledPopoverContent className=\"zIndexMax m-0 p-0\">\n <DayPicker\n ISOWeek\n showOutsideDays\n captionLayout=\"dropdown\"\n components={CALENDAR_DROPDOWN_COMPONENTS}\n startMonth={bounds.minDate}\n endMonth={bounds.maxDate}\n labels={{\n labelMonthDropdown: () => t('dates.chooseMonth'),\n labelYearDropdown: () => t('dates.chooseYear'),\n }}\n dir=\"ltr\"\n firstWeekContainsDate={1}\n mode=\"single\"\n numberOfMonths={1}\n timeZone={DATE_PICKER_TIMEZONE}\n weekStartsOn={1}\n locale={ptBR}\n selected={date}\n month={displayedMonth}\n onMonthChange={setDisplayedMonth}\n disabled={[beforeMatcher, afterMatcher]}\n onSelect={handleSelectedDate}\n className=\"p-3\"\n classNames={{\n ...CALENDAR_DROPDOWN_CLASS_NAMES,\n chevron: `fill-foreground`,\n today: `rounded-md bg-muted-active text-foreground`,\n selected: `rounded-md bg-ink text-white hover:bg-ink hover:text-white focus:bg-ink focus:text-white`,\n }}\n />\n </ControlledPopoverContent>\n </ControlledPopoverRoot>\n );\n};\n\nexport default DatePicker;\n"],"names":[],"mappings":";;;;;;;;;;;;;AA+BA,MAAM,uBAAuB;AAqB7B,MAAM,aAAyC,CAAC;AAAA,EAC9C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,EAAA,I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MACZ;AAAA,IAAA,EACF,CACF;AAAA,EAAA,GACF;AAEJ;"}
@@ -9,6 +9,7 @@ import ControlledTooltip from "../UI/ControlledTooltip.js";
9
9
  import { formatDate } from "../../helpers/dateHelpers.js";
10
10
  import ControlledInput from "../Form/ControlledInput.js";
11
11
  import { MaterialSymbol } from "../UI/MaterialSymbol/index.js";
12
+ import { CALENDAR_DROPDOWN_COMPONENTS } from "./CalendarDropdown.js";
12
13
  import { resolveDateBounds, DATE_INPUT_MODE, CALENDAR_DROPDOWN_CLASS_NAMES, maskDateRangeInput, formatDateToYYYYMMDD, splitDateRangeText, parseTypedDate, joinDateRangeText, formatTypedDate } from "./dateInputHelpers.js";
13
14
  import "react-day-picker/style.css";
14
15
  const DATE_RANGE_PICKER_TIMEZONE = "UTC";
@@ -22,6 +23,7 @@ const CALENDAR_THEME_VARIABLES = [
22
23
  "![--rdp-range_middle-color:theme(colors.purple.700)]"
23
24
  ].join(" ");
24
25
  const calendarClassNames = getDefaultClassNames();
26
+ const RANGE_CALENDAR_NAV_LAYOUT = "around";
25
27
  const DateRangePicker = ({
26
28
  id,
27
29
  label,
@@ -220,6 +222,8 @@ const DateRangePicker = ({
220
222
  ISOWeek: true,
221
223
  showOutsideDays: true,
222
224
  captionLayout: "dropdown",
225
+ navLayout: RANGE_CALENDAR_NAV_LAYOUT,
226
+ components: CALENDAR_DROPDOWN_COMPONENTS,
223
227
  startMonth: bounds.minDate,
224
228
  endMonth: bounds.maxDate,
225
229
  labels: {
@@ -1 +1 @@
1
- {"version":3,"file":"DateRangePicker.js","sources":["../../../src/components/DateTime/DateRangePicker.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { ptBR } from 'date-fns/locale';\nimport { DateAfter, DateBefore, DateRange, DayPicker, getDefaultClassNames } from 'react-day-picker';\nimport { useTranslation } from 'react-i18next';\n\nimport {\n ControlledPopoverContent,\n ControlledPopoverHandler,\n ControlledPopoverRoot,\n} from '@/components/UI/ControlledPopover';\nimport ControlledTooltip from '@/components/UI/ControlledTooltip';\nimport { formatDate } from '@/helpers/dateHelpers';\n\nimport ControlledInput from '../Form/ControlledInput';\nimport { MaterialSymbol } from '../UI/MaterialSymbol';\n\nimport {\n CALENDAR_DROPDOWN_CLASS_NAMES,\n DATE_INPUT_MODE,\n formatDateToYYYYMMDD,\n formatTypedDate,\n joinDateRangeText,\n maskDateRangeInput,\n parseTypedDate,\n resolveDateBounds,\n splitDateRangeText,\n TTypedDateStatus,\n} from './dateInputHelpers';\n\nimport 'react-day-picker/style.css';\n\nconst DATE_RANGE_PICKER_TIMEZONE = 'UTC';\n\n/**\n * react-day-picker paints the selection through its own CSS variables, so the brand\n * color has to be injected there: a Tailwind background class on the day cell loses\n * to the library's compound selectors. The important modifier is required because the\n * library stylesheet ships in a lazily injected chunk, so it wins any specificity tie\n * against these utilities.\n */\nconst CALENDAR_THEME_VARIABLES = [\n '![--rdp-accent-background-color:theme(colors.purple.50)]',\n '![--rdp-accent-color:theme(colors.purple.500)]',\n '![--rdp-day-height:2.5rem]',\n '![--rdp-day-width:2.5rem]',\n '![--rdp-day_button-height:2.25rem]',\n '![--rdp-day_button-width:2.25rem]',\n '![--rdp-range_middle-color:theme(colors.purple.700)]',\n].join(' ');\n\nconst calendarClassNames = getDefaultClassNames();\n\ninterface IDateRangePickerProps {\n /** Reaches the field itself, so a `FieldLabel` can point at it. */\n id?: string;\n label?: string;\n onUpdate: (value: { from: string | undefined; to: string | undefined }) => void;\n disabled?: boolean;\n minDate?: string;\n maxDate?: string;\n useIcon?: boolean;\n valueRender?: () => React.ReactNode;\n startValue?: DateRange;\n onFocus?: () => void;\n onBlur?: () => void;\n}\n\nconst DateRangePicker: React.FC<IDateRangePickerProps> = ({\n id,\n label,\n disabled,\n onUpdate,\n minDate,\n maxDate,\n useIcon,\n valueRender,\n startValue,\n onFocus,\n onBlur,\n}) => {\n const { t } = useTranslation('ui');\n const [range, setRange] = useState<DateRange | undefined>(startValue);\n const [popoverOpen, setPopoverOpen] = useState(false);\n\n useEffect(() => {\n setRange(startValue);\n }, [startValue]);\n\n const handleSelectedRange = (newRange: DateRange | undefined) => {\n if (!newRange) {\n setRange(undefined);\n onUpdate({ from: undefined, to: undefined });\n return;\n }\n\n if (!range?.from) {\n setRange({ from: newRange.from, to: undefined });\n if (newRange.from) {\n onUpdate({\n from: formatDateToYYYYMMDD(newRange.from),\n to: undefined,\n });\n }\n return;\n }\n\n if (range.from && !range.to && newRange.to) {\n const finalRange = {\n from: range.from,\n to: newRange.to,\n };\n setRange(finalRange);\n onUpdate({\n from: formatDateToYYYYMMDD(finalRange.from),\n to: formatDateToYYYYMMDD(finalRange.to),\n });\n setPopoverOpen(false);\n return;\n }\n\n setRange({ from: newRange.from, to: undefined });\n if (newRange.from) {\n onUpdate({\n from: formatDateToYYYYMMDD(newRange.from),\n to: undefined,\n });\n }\n };\n\n const [displayedMonth, setDisplayedMonth] = useState<Date>(startValue?.from ?? new Date());\n const [isTyping, setIsTyping] = useState(false);\n const [typedText, setTypedText] = useState('');\n const [typedStatus, setTypedStatus] = useState<TTypedDateStatus>('empty');\n\n const bounds = resolveDateBounds(minDate, maxDate);\n\n const rangeToTypedText = (currentRange: DateRange | undefined) =>\n joinDateRangeText(formatTypedDate(currentRange?.from), formatTypedDate(currentRange?.to));\n\n const handlePopoverChange = (nextOpen: boolean) => {\n if (nextOpen) setDisplayedMonth(range?.from ?? new Date());\n setPopoverOpen(nextOpen);\n };\n\n const openPopover = () => {\n if (!popoverOpen) handlePopoverChange(true);\n };\n\n const handleInputClick = (event: React.MouseEvent<HTMLInputElement>) => {\n event.stopPropagation();\n openPopover();\n };\n\n const handleInputFocus = () => {\n setIsTyping(true);\n setTypedText(rangeToTypedText(range));\n setTypedStatus(range?.from ? 'valid' : 'empty');\n };\n\n const commitTypedRange = (from: Date, to: Date | undefined) => {\n setRange({ from, to });\n onUpdate({ from: formatDateToYYYYMMDD(from), to: to ? formatDateToYYYYMMDD(to) : undefined });\n setDisplayedMonth(from);\n };\n\n const resolveTypedRange = (text: string): { status: TTypedDateStatus; from?: Date; to?: Date } => {\n const { startText, endText } = splitDateRangeText(text);\n const start = parseTypedDate(startText, bounds);\n if (start.status !== 'valid' || !start.date) return { status: start.status };\n if (!endText) return { status: 'valid', from: start.date };\n\n const end = parseTypedDate(endText, bounds);\n if (end.status !== 'valid' || !end.date) return { status: end.status, from: start.date };\n if (end.date.getTime() < start.date.getTime()) return { status: 'invalid', from: start.date };\n return { status: 'valid', from: start.date, to: end.date };\n };\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const maskedText = maskDateRangeInput(event.target.value);\n const typedRange = resolveTypedRange(maskedText);\n setTypedText(maskedText);\n setTypedStatus(typedRange.status);\n openPopover();\n if (typedRange.status === 'valid' && typedRange.from) commitTypedRange(typedRange.from, typedRange.to);\n };\n\n const handleInputBlur = () => {\n setIsTyping(false);\n if (typedStatus === 'empty' && range?.from) {\n setRange(undefined);\n onUpdate({ from: undefined, to: undefined });\n }\n onBlur?.();\n };\n\n const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key !== 'Enter') return;\n event.preventDefault();\n if (typedStatus === 'valid' || typedStatus === 'empty') setPopoverOpen(false);\n };\n\n const typedErrorMessage =\n isTyping && typedStatus === 'invalid'\n ? t('dates.invalidPeriod')\n : isTyping && typedStatus === 'outOfRange'\n ? t('dates.outOfRange')\n : undefined;\n\n const clear = (e?: React.MouseEvent) => {\n if (e) {\n e.preventDefault();\n e.stopPropagation();\n }\n const emptyRange = undefined;\n setRange(emptyRange);\n onUpdate({ from: undefined, to: undefined });\n setPopoverOpen(false);\n };\n\n const beforeMatcher: DateBefore = { before: bounds.minDate };\n const afterMatcher: DateAfter = { after: bounds.maxDate };\n\n const displayValue = () => {\n if (!range?.from) return '';\n if (!range.to) return `${formatDate(range.from)} - ${t('dates.selectEndDate')}`;\n return `${formatDate(range.from)} - ${formatDate(range.to)}`;\n };\n\n const getFooter = () => {\n if (!range?.from) {\n return (\n <div className=\"flex items-center justify-center py-2\">\n <div className=\"flex items-center gap-2 text-sm text-foreground-muted\">\n <MaterialSymbol icon=\"info\" size={16} color=\"rgb(var(--color-foreground-subtle))\" />\n <span>{t('dates.selectStartDate')}</span>\n </div>\n </div>\n );\n }\n if (!range.to) {\n return (\n <div className=\"flex items-center justify-center py-2\">\n <div className=\"flex items-center gap-2 text-sm text-brand-emphasis\">\n <MaterialSymbol icon=\"schedule\" size={16} color=\"rgb(var(--color-primary))\" />\n <span>{t('dateRangePicker.nowSelectEndDate')}</span>\n </div>\n </div>\n );\n }\n return (\n <div className=\"flex items-center justify-center py-2\">\n <div className=\"flex items-center gap-2 text-sm text-success-emphasis\">\n <MaterialSymbol icon=\"check_circle\" size={16} color=\"rgb(var(--color-success))\" />\n <span>{t('dates.periodSelectedSuccess')}</span>\n </div>\n </div>\n );\n };\n\n return (\n <ControlledPopoverRoot placement=\"bottom\" open={popoverOpen} handler={handlePopoverChange}>\n <ControlledPopoverHandler>\n <div className=\"zIndexMax flex w-full flex-row items-center gap-x-2\" onFocus={onFocus}>\n {useIcon && <MaterialSymbol icon=\"calendar_month\" size={20} />}\n\n {valueRender ? (\n valueRender()\n ) : (\n <div className=\"relative w-full\">\n <ControlledInput\n id={id}\n aria-label={label}\n inputMode={DATE_INPUT_MODE}\n autoComplete=\"off\"\n error={Boolean(typedErrorMessage) || Boolean(!isTyping && range?.from && !range.to)}\n errorMessage={typedErrorMessage}\n placeholder={label || t('dateRangePicker.selectPeriod')}\n className={classNames('w-full truncate text-left', range?.from && '!pr-9')}\n disabled={disabled}\n value={isTyping ? typedText : displayValue()}\n onClick={handleInputClick}\n onFocus={handleInputFocus}\n onChange={handleInputChange}\n onBlur={handleInputBlur}\n onKeyDown={handleInputKeyDown}\n />\n\n {range?.from && (\n <ControlledTooltip content={t('dates.clearPeriod')}>\n <div\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n clear(e);\n }}\n onMouseDown={(e) => {\n e.preventDefault();\n e.stopPropagation();\n }}\n className=\"absolute inset-y-0 right-2 z-10 flex cursor-pointer items-center\"\n >\n <MaterialSymbol icon=\"close_small\" size={20} color=\"rgb(var(--color-foreground-subtle))\" />\n </div>\n </ControlledTooltip>\n )}\n </div>\n )}\n </div>\n </ControlledPopoverHandler>\n <ControlledPopoverContent className=\"zIndexMax overflow-hidden rounded-xl border-0 p-0 shadow-2xl\">\n <div className=\"bg-surface\">\n <DayPicker\n ISOWeek\n showOutsideDays\n captionLayout=\"dropdown\"\n startMonth={bounds.minDate}\n endMonth={bounds.maxDate}\n labels={{\n labelMonthDropdown: () => t('dates.chooseMonth'),\n labelYearDropdown: () => t('dates.chooseYear'),\n }}\n dir=\"ltr\"\n firstWeekContainsDate={1}\n mode=\"range\"\n numberOfMonths={2}\n timeZone={DATE_RANGE_PICKER_TIMEZONE}\n weekStartsOn={1}\n locale={ptBR}\n selected={range}\n month={displayedMonth}\n onMonthChange={setDisplayedMonth}\n disabled={[beforeMatcher, afterMatcher]}\n onSelect={handleSelectedRange}\n className={classNames('p-4', CALENDAR_THEME_VARIABLES)}\n classNames={{\n ...CALENDAR_DROPDOWN_CLASS_NAMES,\n month_caption: `${calendarClassNames.month_caption} items-center text-brand-emphasis`,\n weekday: `${calendarClassNames.weekday} text-foreground-subtle`,\n day: `${calendarClassNames.day} text-sm text-foreground transition-colors hover:bg-brand-soft hover:text-brand-emphasis`,\n day_button: `${calendarClassNames.day_button} focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-border`,\n selected: 'text-sm font-semibold',\n today: `${calendarClassNames.today} font-semibold`,\n outside: `${calendarClassNames.outside} text-foreground-faint`,\n disabled: `${calendarClassNames.disabled} text-foreground-faint`,\n }}\n footer={<div className=\"rounded-b-xl border-t border-border-subtle bg-muted\">{getFooter()}</div>}\n />\n </div>\n </ControlledPopoverContent>\n </ControlledPopoverRoot>\n );\n};\n\nexport default DateRangePicker;\n"],"names":[],"mappings":";;;;;;;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AAA,CAEJ,EAAA,CACF;AAAA,wBACC,0BAAA,EAAyB,WAAU,gEAClC,UAAA,oBAAC,OAAA,EAAI,WAAU,cACb,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,SAAO;AAAA,QACP,iBAAe;AAAA,QACf,eAAc;AAAA,QACd,YAAY,OAAO;AAAA,QACnB,UAAU,OAAO;AAAA,QACjB,QAAQ;AAAA,UACN,oBAAoB,MAAM,EAAE,mBAAmB;AAAA,UAC/C,mBAAmB,MAAM,EAAE,kBAAkB;AAAA,QAAA;AAAA,QAE/C,KAAI;AAAA,QACJ,uBAAuB;AAAA,QACvB,MAAK;AAAA,QACL,gBAAgB;AAAA,QAChB,UAAU;AAAA,QACV,cAAc;AAAA,QACd,QAAQ;AAAA,QACR,UAAU;AAAA,QACV,OAAO;AAAA,QACP,eAAe;AAAA,QACf,UAAU,CAAC,eAAe,YAAY;AAAA,QACtC,UAAU;AAAA,QACV,WAAW,WAAW,OAAO,wBAAwB;AAAA,QACrD,YAAY;AAAA,UACV,GAAG;AAAA,UACH,eAAe,GAAG,mBAAmB,aAAa;AAAA,UAClD,SAAS,GAAG,mBAAmB,OAAO;AAAA,UACtC,KAAK,GAAG,mBAAmB,GAAG;AAAA,UAC9B,YAAY,GAAG,mBAAmB,UAAU;AAAA,UAC5C,UAAU;AAAA,UACV,OAAO,GAAG,mBAAmB,KAAK;AAAA,UAClC,SAAS,GAAG,mBAAmB,OAAO;AAAA,UACtC,UAAU,GAAG,mBAAmB,QAAQ;AAAA,QAAA;AAAA,QAE1C,QAAQ,oBAAC,OAAA,EAAI,WAAU,uDAAuD,sBAAU,CAAE;AAAA,MAAA;AAAA,IAAA,GAE9F,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;"}
1
+ {"version":3,"file":"DateRangePicker.js","sources":["../../../src/components/DateTime/DateRangePicker.tsx"],"sourcesContent":["import { useEffect, useState } from 'react';\nimport * as React from 'react';\nimport classNames from 'classnames';\nimport { ptBR } from 'date-fns/locale';\nimport { DateAfter, DateBefore, DateRange, DayPicker, getDefaultClassNames } from 'react-day-picker';\nimport { useTranslation } from 'react-i18next';\n\nimport {\n ControlledPopoverContent,\n ControlledPopoverHandler,\n ControlledPopoverRoot,\n} from '@/components/UI/ControlledPopover';\nimport ControlledTooltip from '@/components/UI/ControlledTooltip';\nimport { formatDate } from '@/helpers/dateHelpers';\n\nimport ControlledInput from '../Form/ControlledInput';\nimport { MaterialSymbol } from '../UI/MaterialSymbol';\n\nimport { CALENDAR_DROPDOWN_COMPONENTS } from './CalendarDropdown';\nimport {\n CALENDAR_DROPDOWN_CLASS_NAMES,\n DATE_INPUT_MODE,\n formatDateToYYYYMMDD,\n formatTypedDate,\n joinDateRangeText,\n maskDateRangeInput,\n parseTypedDate,\n resolveDateBounds,\n splitDateRangeText,\n TTypedDateStatus,\n} from './dateInputHelpers';\n\nimport 'react-day-picker/style.css';\n\nconst DATE_RANGE_PICKER_TIMEZONE = 'UTC';\n\n/**\n * react-day-picker paints the selection through its own CSS variables, so the brand\n * color has to be injected there: a Tailwind background class on the day cell loses\n * to the library's compound selectors. The important modifier is required because the\n * library stylesheet ships in a lazily injected chunk, so it wins any specificity tie\n * against these utilities.\n */\nconst CALENDAR_THEME_VARIABLES = [\n '![--rdp-accent-background-color:theme(colors.purple.50)]',\n '![--rdp-accent-color:theme(colors.purple.500)]',\n '![--rdp-day-height:2.5rem]',\n '![--rdp-day-width:2.5rem]',\n '![--rdp-day_button-height:2.25rem]',\n '![--rdp-day_button-width:2.25rem]',\n '![--rdp-range_middle-color:theme(colors.purple.700)]',\n].join(' ');\n\nconst calendarClassNames = getDefaultClassNames();\n\nconst RANGE_CALENDAR_NAV_LAYOUT = 'around';\n\ninterface IDateRangePickerProps {\n /** Reaches the field itself, so a `FieldLabel` can point at it. */\n id?: string;\n label?: string;\n onUpdate: (value: { from: string | undefined; to: string | undefined }) => void;\n disabled?: boolean;\n minDate?: string;\n maxDate?: string;\n useIcon?: boolean;\n valueRender?: () => React.ReactNode;\n startValue?: DateRange;\n onFocus?: () => void;\n onBlur?: () => void;\n}\n\nconst DateRangePicker: React.FC<IDateRangePickerProps> = ({\n id,\n label,\n disabled,\n onUpdate,\n minDate,\n maxDate,\n useIcon,\n valueRender,\n startValue,\n onFocus,\n onBlur,\n}) => {\n const { t } = useTranslation('ui');\n const [range, setRange] = useState<DateRange | undefined>(startValue);\n const [popoverOpen, setPopoverOpen] = useState(false);\n\n useEffect(() => {\n setRange(startValue);\n }, [startValue]);\n\n const handleSelectedRange = (newRange: DateRange | undefined) => {\n if (!newRange) {\n setRange(undefined);\n onUpdate({ from: undefined, to: undefined });\n return;\n }\n\n if (!range?.from) {\n setRange({ from: newRange.from, to: undefined });\n if (newRange.from) {\n onUpdate({\n from: formatDateToYYYYMMDD(newRange.from),\n to: undefined,\n });\n }\n return;\n }\n\n if (range.from && !range.to && newRange.to) {\n const finalRange = {\n from: range.from,\n to: newRange.to,\n };\n setRange(finalRange);\n onUpdate({\n from: formatDateToYYYYMMDD(finalRange.from),\n to: formatDateToYYYYMMDD(finalRange.to),\n });\n setPopoverOpen(false);\n return;\n }\n\n setRange({ from: newRange.from, to: undefined });\n if (newRange.from) {\n onUpdate({\n from: formatDateToYYYYMMDD(newRange.from),\n to: undefined,\n });\n }\n };\n\n const [displayedMonth, setDisplayedMonth] = useState<Date>(startValue?.from ?? new Date());\n const [isTyping, setIsTyping] = useState(false);\n const [typedText, setTypedText] = useState('');\n const [typedStatus, setTypedStatus] = useState<TTypedDateStatus>('empty');\n\n const bounds = resolveDateBounds(minDate, maxDate);\n\n const rangeToTypedText = (currentRange: DateRange | undefined) =>\n joinDateRangeText(formatTypedDate(currentRange?.from), formatTypedDate(currentRange?.to));\n\n const handlePopoverChange = (nextOpen: boolean) => {\n if (nextOpen) setDisplayedMonth(range?.from ?? new Date());\n setPopoverOpen(nextOpen);\n };\n\n const openPopover = () => {\n if (!popoverOpen) handlePopoverChange(true);\n };\n\n const handleInputClick = (event: React.MouseEvent<HTMLInputElement>) => {\n event.stopPropagation();\n openPopover();\n };\n\n const handleInputFocus = () => {\n setIsTyping(true);\n setTypedText(rangeToTypedText(range));\n setTypedStatus(range?.from ? 'valid' : 'empty');\n };\n\n const commitTypedRange = (from: Date, to: Date | undefined) => {\n setRange({ from, to });\n onUpdate({ from: formatDateToYYYYMMDD(from), to: to ? formatDateToYYYYMMDD(to) : undefined });\n setDisplayedMonth(from);\n };\n\n const resolveTypedRange = (text: string): { status: TTypedDateStatus; from?: Date; to?: Date } => {\n const { startText, endText } = splitDateRangeText(text);\n const start = parseTypedDate(startText, bounds);\n if (start.status !== 'valid' || !start.date) return { status: start.status };\n if (!endText) return { status: 'valid', from: start.date };\n\n const end = parseTypedDate(endText, bounds);\n if (end.status !== 'valid' || !end.date) return { status: end.status, from: start.date };\n if (end.date.getTime() < start.date.getTime()) return { status: 'invalid', from: start.date };\n return { status: 'valid', from: start.date, to: end.date };\n };\n\n const handleInputChange = (event: React.ChangeEvent<HTMLInputElement>) => {\n const maskedText = maskDateRangeInput(event.target.value);\n const typedRange = resolveTypedRange(maskedText);\n setTypedText(maskedText);\n setTypedStatus(typedRange.status);\n openPopover();\n if (typedRange.status === 'valid' && typedRange.from) commitTypedRange(typedRange.from, typedRange.to);\n };\n\n const handleInputBlur = () => {\n setIsTyping(false);\n if (typedStatus === 'empty' && range?.from) {\n setRange(undefined);\n onUpdate({ from: undefined, to: undefined });\n }\n onBlur?.();\n };\n\n const handleInputKeyDown = (event: React.KeyboardEvent<HTMLInputElement>) => {\n if (event.key !== 'Enter') return;\n event.preventDefault();\n if (typedStatus === 'valid' || typedStatus === 'empty') setPopoverOpen(false);\n };\n\n const typedErrorMessage =\n isTyping && typedStatus === 'invalid'\n ? t('dates.invalidPeriod')\n : isTyping && typedStatus === 'outOfRange'\n ? t('dates.outOfRange')\n : undefined;\n\n const clear = (e?: React.MouseEvent) => {\n if (e) {\n e.preventDefault();\n e.stopPropagation();\n }\n const emptyRange = undefined;\n setRange(emptyRange);\n onUpdate({ from: undefined, to: undefined });\n setPopoverOpen(false);\n };\n\n const beforeMatcher: DateBefore = { before: bounds.minDate };\n const afterMatcher: DateAfter = { after: bounds.maxDate };\n\n const displayValue = () => {\n if (!range?.from) return '';\n if (!range.to) return `${formatDate(range.from)} - ${t('dates.selectEndDate')}`;\n return `${formatDate(range.from)} - ${formatDate(range.to)}`;\n };\n\n const getFooter = () => {\n if (!range?.from) {\n return (\n <div className=\"flex items-center justify-center py-2\">\n <div className=\"flex items-center gap-2 text-sm text-foreground-muted\">\n <MaterialSymbol icon=\"info\" size={16} color=\"rgb(var(--color-foreground-subtle))\" />\n <span>{t('dates.selectStartDate')}</span>\n </div>\n </div>\n );\n }\n if (!range.to) {\n return (\n <div className=\"flex items-center justify-center py-2\">\n <div className=\"flex items-center gap-2 text-sm text-brand-emphasis\">\n <MaterialSymbol icon=\"schedule\" size={16} color=\"rgb(var(--color-primary))\" />\n <span>{t('dateRangePicker.nowSelectEndDate')}</span>\n </div>\n </div>\n );\n }\n return (\n <div className=\"flex items-center justify-center py-2\">\n <div className=\"flex items-center gap-2 text-sm text-success-emphasis\">\n <MaterialSymbol icon=\"check_circle\" size={16} color=\"rgb(var(--color-success))\" />\n <span>{t('dates.periodSelectedSuccess')}</span>\n </div>\n </div>\n );\n };\n\n return (\n <ControlledPopoverRoot placement=\"bottom\" open={popoverOpen} handler={handlePopoverChange}>\n <ControlledPopoverHandler>\n <div className=\"zIndexMax flex w-full flex-row items-center gap-x-2\" onFocus={onFocus}>\n {useIcon && <MaterialSymbol icon=\"calendar_month\" size={20} />}\n\n {valueRender ? (\n valueRender()\n ) : (\n <div className=\"relative w-full\">\n <ControlledInput\n id={id}\n aria-label={label}\n inputMode={DATE_INPUT_MODE}\n autoComplete=\"off\"\n error={Boolean(typedErrorMessage) || Boolean(!isTyping && range?.from && !range.to)}\n errorMessage={typedErrorMessage}\n placeholder={label || t('dateRangePicker.selectPeriod')}\n className={classNames('w-full truncate text-left', range?.from && '!pr-9')}\n disabled={disabled}\n value={isTyping ? typedText : displayValue()}\n onClick={handleInputClick}\n onFocus={handleInputFocus}\n onChange={handleInputChange}\n onBlur={handleInputBlur}\n onKeyDown={handleInputKeyDown}\n />\n\n {range?.from && (\n <ControlledTooltip content={t('dates.clearPeriod')}>\n <div\n onClick={(e) => {\n e.preventDefault();\n e.stopPropagation();\n clear(e);\n }}\n onMouseDown={(e) => {\n e.preventDefault();\n e.stopPropagation();\n }}\n className=\"absolute inset-y-0 right-2 z-10 flex cursor-pointer items-center\"\n >\n <MaterialSymbol icon=\"close_small\" size={20} color=\"rgb(var(--color-foreground-subtle))\" />\n </div>\n </ControlledTooltip>\n )}\n </div>\n )}\n </div>\n </ControlledPopoverHandler>\n <ControlledPopoverContent className=\"zIndexMax overflow-hidden rounded-xl border-0 p-0 shadow-2xl\">\n <div className=\"bg-surface\">\n <DayPicker\n ISOWeek\n showOutsideDays\n captionLayout=\"dropdown\"\n navLayout={RANGE_CALENDAR_NAV_LAYOUT}\n components={CALENDAR_DROPDOWN_COMPONENTS}\n startMonth={bounds.minDate}\n endMonth={bounds.maxDate}\n labels={{\n labelMonthDropdown: () => t('dates.chooseMonth'),\n labelYearDropdown: () => t('dates.chooseYear'),\n }}\n dir=\"ltr\"\n firstWeekContainsDate={1}\n mode=\"range\"\n numberOfMonths={2}\n timeZone={DATE_RANGE_PICKER_TIMEZONE}\n weekStartsOn={1}\n locale={ptBR}\n selected={range}\n month={displayedMonth}\n onMonthChange={setDisplayedMonth}\n disabled={[beforeMatcher, afterMatcher]}\n onSelect={handleSelectedRange}\n className={classNames('p-4', CALENDAR_THEME_VARIABLES)}\n classNames={{\n ...CALENDAR_DROPDOWN_CLASS_NAMES,\n month_caption: `${calendarClassNames.month_caption} items-center text-brand-emphasis`,\n weekday: `${calendarClassNames.weekday} text-foreground-subtle`,\n day: `${calendarClassNames.day} text-sm text-foreground transition-colors hover:bg-brand-soft hover:text-brand-emphasis`,\n day_button: `${calendarClassNames.day_button} focus:outline-none focus-visible:ring-2 focus-visible:ring-brand-border`,\n selected: 'text-sm font-semibold',\n today: `${calendarClassNames.today} font-semibold`,\n outside: `${calendarClassNames.outside} text-foreground-faint`,\n disabled: `${calendarClassNames.disabled} text-foreground-faint`,\n }}\n footer={<div className=\"rounded-b-xl border-t border-border-subtle bg-muted\">{getFooter()}</div>}\n />\n </div>\n </ControlledPopoverContent>\n </ControlledPopoverRoot>\n );\n};\n\nexport default DateRangePicker;\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAkCA,MAAM,6BAA6B;AASnC,MAAM,2BAA2B;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,EAAE,KAAK,GAAG;AAEV,MAAM,qBAAqB,qBAAA;AAE3B,MAAM,4BAA4B;AAiBlC,MAAM,kBAAmD,CAAC;AAAA,EACxD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,EAAE,EAAA,IAAM,eAAe,IAAI;AACjC,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAgC,UAAU;AACpE,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,KAAK;AAEpD,YAAU,MAAM;AACd,aAAS,UAAU;AAAA,EACrB,GAAG,CAAC,UAAU,CAAC;AAEf,QAAM,sBAAsB,CAAC,aAAoC;AAC/D,QAAI,CAAC,UAAU;AACb,eAAS,MAAS;AAClB,eAAS,EAAE,MAAM,QAAW,IAAI,QAAW;AAC3C;AAAA,IACF;AAEA,QAAI,CAAC,OAAO,MAAM;AAChB,eAAS,EAAE,MAAM,SAAS,MAAM,IAAI,QAAW;AAC/C,UAAI,SAAS,MAAM;AACjB,iBAAS;AAAA,UACP,MAAM,qBAAqB,SAAS,IAAI;AAAA,UACxC,IAAI;AAAA,QAAA,CACL;AAAA,MACH;AACA;AAAA,IACF;AAEA,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,GAAG,mBAAmB,OAAO;AAAA,UACtC,UAAU,GAAG,mBAAmB,QAAQ;AAAA,QAAA;AAAA,QAE1C,QAAQ,oBAAC,OAAA,EAAI,WAAU,uDAAuD,sBAAU,CAAE;AAAA,MAAA;AAAA,IAAA,GAE9F,EAAA,CACF;AAAA,EAAA,GACF;AAEJ;"}
@@ -68,10 +68,7 @@ const parseTypedDate = (text, bounds) => {
68
68
  };
69
69
  const calendarDefaultClassNames = getDefaultClassNames();
70
70
  const CALENDAR_DROPDOWN_CLASS_NAMES = {
71
- dropdowns: `${calendarDefaultClassNames.dropdowns} gap-1`,
72
- dropdown_root: `${calendarDefaultClassNames.dropdown_root} interactive cursor-pointer rounded-md px-1.5 py-0.5 hover:bg-muted-hover`,
73
- dropdown: `${calendarDefaultClassNames.dropdown} cursor-pointer bg-surface text-foreground`,
74
- caption_label: `${calendarDefaultClassNames.caption_label} gap-0.5 font-semibold capitalize text-foreground`
71
+ dropdowns: `${calendarDefaultClassNames.dropdowns} gap-2`
75
72
  };
76
73
  const DATE_INPUT_MODE = "numeric";
77
74
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"dateInputHelpers.js","sources":["../../../src/components/DateTime/dateInputHelpers.ts"],"sourcesContent":["import type * as React from 'react';\nimport { ClassNames, getDefaultClassNames } from 'react-day-picker';\n\nimport { formatDate } from '@/helpers/dateHelpers';\n\nconst DEFAULT_MIN_DATE = new Date(2024, 1, 1);\nconst DEFAULT_MAX_DATE = new Date(2030, 1, 1);\n\nconst TYPED_DATE_PATTERN = /^(\\d{2})\\/(\\d{2})\\/(\\d{4})$/;\nconst DIGITS_PER_DATE = 8;\nconst RANGE_SEPARATOR = ' - ';\n\nexport type TTypedDateStatus = 'empty' | 'incomplete' | 'invalid' | 'outOfRange' | 'valid';\n\nexport interface ITypedDateResult {\n status: TTypedDateStatus;\n date?: Date;\n}\n\nexport interface IDateBounds {\n minDate: Date;\n maxDate: Date;\n minDay: string;\n maxDay: string;\n}\n\nexport const formatDateToYYYYMMDD = (date: Date): string => {\n const month = String(date.getUTCMonth() + 1).padStart(2, '0');\n const day = String(date.getUTCDate()).padStart(2, '0');\n const year = date.getUTCFullYear();\n return `${year}-${month}-${day}`;\n};\n\nconst formatLocalDateToYYYYMMDD = (date: Date): string => {\n const month = String(date.getMonth() + 1).padStart(2, '0');\n const day = String(date.getDate()).padStart(2, '0');\n return `${date.getFullYear()}-${month}-${day}`;\n};\n\nconst parseBoundDate = (dateString: string): Date => {\n const [year, month, day] = dateString\n .split('T')[0]\n .split('-')\n .map((part) => parseInt(part, 10));\n return new Date(year, month - 1, day);\n};\n\nconst isValidDate = (date: Date) => !Number.isNaN(date.getTime());\n\nexport const resolveDateBounds = (minDate?: string, maxDate?: string): IDateBounds => {\n const parsedMinDate = minDate ? parseBoundDate(String(minDate)) : DEFAULT_MIN_DATE;\n const parsedMaxDate = maxDate ? parseBoundDate(String(maxDate)) : DEFAULT_MAX_DATE;\n const resolvedMinDate = isValidDate(parsedMinDate) ? parsedMinDate : DEFAULT_MIN_DATE;\n const resolvedMaxDate = isValidDate(parsedMaxDate) ? parsedMaxDate : DEFAULT_MAX_DATE;\n\n return {\n minDate: resolvedMinDate,\n maxDate: resolvedMaxDate,\n minDay: formatLocalDateToYYYYMMDD(resolvedMinDate),\n maxDay: formatLocalDateToYYYYMMDD(resolvedMaxDate),\n };\n};\n\nconst maskDateDigits = (digits: string): string => {\n if (digits.length <= 2) return digits;\n if (digits.length <= 4) return `${digits.slice(0, 2)}/${digits.slice(2)}`;\n return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, DIGITS_PER_DATE)}`;\n};\n\nconst extractDigits = (rawValue: string, maxDigits: number) => rawValue.replace(/\\D/g, '').slice(0, maxDigits);\n\nexport const maskDateInput = (rawValue: string): string => maskDateDigits(extractDigits(rawValue, DIGITS_PER_DATE));\n\nexport const maskDateRangeInput = (rawValue: string): string => {\n const digits = extractDigits(rawValue, DIGITS_PER_DATE * 2);\n const startText = maskDateDigits(digits.slice(0, DIGITS_PER_DATE));\n if (digits.length <= DIGITS_PER_DATE) return startText;\n return `${startText}${RANGE_SEPARATOR}${maskDateDigits(digits.slice(DIGITS_PER_DATE))}`;\n};\n\nexport const splitDateRangeText = (text: string): { startText: string; endText: string } => {\n const [startText = '', endText = ''] = text.split(RANGE_SEPARATOR);\n return { startText: startText.trim(), endText: endText.trim() };\n};\n\nexport const joinDateRangeText = (startText: string, endText: string): string =>\n endText ? `${startText}${RANGE_SEPARATOR}${endText}` : startText;\n\nexport const formatTypedDate = (date: Date | undefined): string => (date ? formatDate(date) : '');\n\nexport const parseTypedDate = (text: string, bounds: IDateBounds): ITypedDateResult => {\n if (!text) return { status: 'empty' };\n\n const match = TYPED_DATE_PATTERN.exec(text);\n if (!match) return { status: 'incomplete' };\n\n const day = parseInt(match[1], 10);\n const month = parseInt(match[2], 10);\n const year = parseInt(match[3], 10);\n const date = new Date(Date.UTC(year, month - 1, day));\n\n const isRealCalendarDay =\n date.getUTCFullYear() === year && date.getUTCMonth() === month - 1 && date.getUTCDate() === day;\n if (!isRealCalendarDay) return { status: 'invalid' };\n\n const typedDay = formatDateToYYYYMMDD(date);\n if (typedDay < bounds.minDay || typedDay > bounds.maxDay) return { status: 'outOfRange' };\n\n return { status: 'valid', date };\n};\n\nconst calendarDefaultClassNames = getDefaultClassNames();\n\nexport const CALENDAR_DROPDOWN_CLASS_NAMES: Partial<ClassNames> = {\n dropdowns: `${calendarDefaultClassNames.dropdowns} gap-1`,\n dropdown_root: `${calendarDefaultClassNames.dropdown_root} interactive cursor-pointer rounded-md px-1.5 py-0.5 hover:bg-muted-hover`,\n dropdown: `${calendarDefaultClassNames.dropdown} cursor-pointer bg-surface text-foreground`,\n caption_label: `${calendarDefaultClassNames.caption_label} gap-0.5 font-semibold capitalize text-foreground`,\n};\n\nexport const DATE_INPUT_MODE: React.HTMLAttributes<HTMLInputElement>['inputMode'] = 'numeric';\n"],"names":[],"mappings":";;AAKA,MAAM,mBAAmB,IAA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AK,IAAI;AAC1C,MAAI,CAAC,MAAO,QAAO,EAAE,QAAQ,aAAA;AAE7B,QAAM,MAAM,SAAS,MAAM,CAAC,GAAG,EAAE;AACjC,QAAM,QAAQ,SAAS,MAAM,CAAC,GAAG,EAAE;AACnC,QAAM,OAAO,SAAS,MAAM,CAAC,GAAG,EAAE;AAClC,QAAM,OAAO,IAAI,KAAK,KAAK,IAAI,MAAM,QAAQ,GAAG,GAAG,CAAC;AAEpD,QAAM,oBACJ,KAAK,eAAA,MAAqB,QAAQ,KAAK,YAAA,MAAkB,QAAQ,KAAK,KAAK,WAAA,MAAiB;AAC9F,MAAI,CAAC,kBAAmB,QAAO,EAAE,QAAQ,UAAA;AAEzC,QAAM,WAAW,qBAAqB,IAAI;AAC1C,MAAI,WAAW,OAAO,UAAU,WAAW,OAAO,OAAQ,QAAO,EAAE,QAAQ,aAAA;AAE3E,SAAO,EAAE,QAAQ,SAAS,KAAA;AAC5B;AAEA,MAAM,4BAA4B,qBAAA;AAE3B,MAAM,gCAAqD;AAAA,EAChE,WAAW,GAAG,0BAA0B,SAAS;AAAA,EACjD,eAAe,GAAG,0BAA0B,aAAa;AAAA,EACzD,UAAU,GAAG,0BAA0B,QAAQ;AAAA,EAC/C,eAAe,GAAG,0BAA0B,aAAa;AAC3D;AAEO,MAAM,kBAAuE;"}
1
+ {"version":3,"file":"dateInputHelpers.js","sources":["../../../src/components/DateTime/dateInputHelpers.ts"],"sourcesContent":["import type * as React from 'react';\nimport { ClassNames, getDefaultClassNames } from 'react-day-picker';\n\nimport { formatDate } from '@/helpers/dateHelpers';\n\nconst DEFAULT_MIN_DATE = new Date(2024, 1, 1);\nconst DEFAULT_MAX_DATE = new Date(2030, 1, 1);\n\nconst TYPED_DATE_PATTERN = /^(\\d{2})\\/(\\d{2})\\/(\\d{4})$/;\nconst DIGITS_PER_DATE = 8;\nconst RANGE_SEPARATOR = ' - ';\n\nexport type TTypedDateStatus = 'empty' | 'incomplete' | 'invalid' | 'outOfRange' | 'valid';\n\nexport interface ITypedDateResult {\n status: TTypedDateStatus;\n date?: Date;\n}\n\nexport interface IDateBounds {\n minDate: Date;\n maxDate: Date;\n minDay: string;\n maxDay: string;\n}\n\nexport const formatDateToYYYYMMDD = (date: Date): string => {\n const month = String(date.getUTCMonth() + 1).padStart(2, '0');\n const day = String(date.getUTCDate()).padStart(2, '0');\n const year = date.getUTCFullYear();\n return `${year}-${month}-${day}`;\n};\n\nconst formatLocalDateToYYYYMMDD = (date: Date): string => {\n const month = String(date.getMonth() + 1).padStart(2, '0');\n const day = String(date.getDate()).padStart(2, '0');\n return `${date.getFullYear()}-${month}-${day}`;\n};\n\nconst parseBoundDate = (dateString: string): Date => {\n const [year, month, day] = dateString\n .split('T')[0]\n .split('-')\n .map((part) => parseInt(part, 10));\n return new Date(year, month - 1, day);\n};\n\nconst isValidDate = (date: Date) => !Number.isNaN(date.getTime());\n\nexport const resolveDateBounds = (minDate?: string, maxDate?: string): IDateBounds => {\n const parsedMinDate = minDate ? parseBoundDate(String(minDate)) : DEFAULT_MIN_DATE;\n const parsedMaxDate = maxDate ? parseBoundDate(String(maxDate)) : DEFAULT_MAX_DATE;\n const resolvedMinDate = isValidDate(parsedMinDate) ? parsedMinDate : DEFAULT_MIN_DATE;\n const resolvedMaxDate = isValidDate(parsedMaxDate) ? parsedMaxDate : DEFAULT_MAX_DATE;\n\n return {\n minDate: resolvedMinDate,\n maxDate: resolvedMaxDate,\n minDay: formatLocalDateToYYYYMMDD(resolvedMinDate),\n maxDay: formatLocalDateToYYYYMMDD(resolvedMaxDate),\n };\n};\n\nconst maskDateDigits = (digits: string): string => {\n if (digits.length <= 2) return digits;\n if (digits.length <= 4) return `${digits.slice(0, 2)}/${digits.slice(2)}`;\n return `${digits.slice(0, 2)}/${digits.slice(2, 4)}/${digits.slice(4, DIGITS_PER_DATE)}`;\n};\n\nconst extractDigits = (rawValue: string, maxDigits: number) => rawValue.replace(/\\D/g, '').slice(0, maxDigits);\n\nexport const maskDateInput = (rawValue: string): string => maskDateDigits(extractDigits(rawValue, DIGITS_PER_DATE));\n\nexport const maskDateRangeInput = (rawValue: string): string => {\n const digits = extractDigits(rawValue, DIGITS_PER_DATE * 2);\n const startText = maskDateDigits(digits.slice(0, DIGITS_PER_DATE));\n if (digits.length <= DIGITS_PER_DATE) return startText;\n return `${startText}${RANGE_SEPARATOR}${maskDateDigits(digits.slice(DIGITS_PER_DATE))}`;\n};\n\nexport const splitDateRangeText = (text: string): { startText: string; endText: string } => {\n const [startText = '', endText = ''] = text.split(RANGE_SEPARATOR);\n return { startText: startText.trim(), endText: endText.trim() };\n};\n\nexport const joinDateRangeText = (startText: string, endText: string): string =>\n endText ? `${startText}${RANGE_SEPARATOR}${endText}` : startText;\n\nexport const formatTypedDate = (date: Date | undefined): string => (date ? formatDate(date) : '');\n\nexport const parseTypedDate = (text: string, bounds: IDateBounds): ITypedDateResult => {\n if (!text) return { status: 'empty' };\n\n const match = TYPED_DATE_PATTERN.exec(text);\n if (!match) return { status: 'incomplete' };\n\n const day = parseInt(match[1], 10);\n const month = parseInt(match[2], 10);\n const year = parseInt(match[3], 10);\n const date = new Date(Date.UTC(year, month - 1, day));\n\n const isRealCalendarDay =\n date.getUTCFullYear() === year && date.getUTCMonth() === month - 1 && date.getUTCDate() === day;\n if (!isRealCalendarDay) return { status: 'invalid' };\n\n const typedDay = formatDateToYYYYMMDD(date);\n if (typedDay < bounds.minDay || typedDay > bounds.maxDay) return { status: 'outOfRange' };\n\n return { status: 'valid', date };\n};\n\nconst calendarDefaultClassNames = getDefaultClassNames();\n\nexport const CALENDAR_DROPDOWN_CLASS_NAMES: Partial<ClassNames> = {\n dropdowns: `${calendarDefaultClassNames.dropdowns} gap-2`,\n};\n\nexport const DATE_INPUT_MODE: React.HTMLAttributes<HTMLInputElement>['inputMode'] = 'numeric';\n"],"names":[],"mappings":";;AAKA,MAAM,mBAAmB,IAAI,KAAK,MAAM,GAAG,CAAC;AAC5C,MAAM,mBAAmB,IAAI,KAAK,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AAE7B,QAAM,MAAM,SAAS,MAAM,CAAC,GAAG,EAAE;AACjC,QAAM,QAAQ,SAAS,MAAM,CAAC,GAAG,EAAE;AACnC,QAAM,OAAO,SAAS,MAAM,CAAC,GAAG,EAAE;AAClC,QAAM,OAAO,IAAI,KAAK,KAAK,IAAI,MAAM,QAAQ,GAAG,GAAG,CAAC;AAEpD,QAAM,oBACJ,KAAK,eAAA,MAAqB,QAAQ,KAAK,YAAA,MAAkB,QAAQ,KAAK,KAAK,WAAA,MAAiB;AAC9F,MAAI,CAAC,kBAAmB,QAAO,EAAE,QAAQ,UAAA;AAEzC,QAAM,WAAW,qBAAqB,IAAI;AAC1C,MAAI,WAAW,OAAO,UAAU,WAAW,OAAO,OAAQ,QAAO,EAAE,QAAQ,aAAA;AAE3E,SAAO,EAAE,QAAQ,SAAS,KAAA;AAC5B;AAEA,MAAM,4BAA4B,qBAAA;AAE3B,MAAM,gCAAqD;AAAA,EAChE,WAAW,GAAG,0BAA0B,SAAS;AACnD;AAEO,MAAM,kBAAuE;"}
@@ -18,14 +18,14 @@ import "../../../helpers/mergeClasses.js";
18
18
  import "@floating-ui/dom";
19
19
  import "../../../motion/motionPresets.js";
20
20
  import "../../../motion/motionTokens.js";
21
- import "../../DateTime/dateInputHelpers.js";
22
- import "react-day-picker/style.css";
23
- import "../../DateTime/DateRangePicker.js";
24
21
  import "react-infinite-scroll-component";
25
22
  import "react-window";
26
23
  import LoadingSpinner from "../LoadingSpinner.js";
27
24
  import "../NoDataFound/index.js";
28
25
  /* empty css */
26
+ import "../../DateTime/dateInputHelpers.js";
27
+ import "react-day-picker/style.css";
28
+ import "../../DateTime/DateRangePicker.js";
29
29
  import "../../Search/filters/FiltersButton.js";
30
30
  import "../../../helpers/utilityHelpers.js";
31
31
  import "../../Form/ControlledDialog.js";
@@ -54,6 +54,18 @@ import { useColumnVisibility, useDetailColumnVisibility } from "./useColumnVisib
54
54
  import { useDataTableInstance } from "./useDataTableInstance.js";
55
55
  import { useDataTableUndoHistory } from "./useDataTableUndoHistory.js";
56
56
  const FOOTER_CONTROL_TOOLTIP_PLACEMENT = "bottom";
57
+ const CARDS_LOAD_MORE_MARGIN = "300px";
58
+ const isScrollingOverflow = (overflowY) => overflowY === "auto" || overflowY === "scroll" || overflowY === "overlay";
59
+ const findCardsScrollRoot = (cardsBox) => {
60
+ let current = cardsBox;
61
+ while (current) {
62
+ if (isScrollingOverflow(getComputedStyle(current).overflowY) && current.scrollHeight > current.clientHeight) {
63
+ return current;
64
+ }
65
+ current = current.parentElement;
66
+ }
67
+ return null;
68
+ };
57
69
  const DataTable = ({
58
70
  config: configProp,
59
71
  rows,
@@ -317,14 +329,14 @@ const DataTable = ({
317
329
  const cardsHasMore = cardsInfiniteScroll?.hasMore ?? false;
318
330
  useEffect(() => {
319
331
  if (!isCardsView || !cardsHasMore || !cardsLoadMore) return;
320
- const root = cardsScrollRef.current;
332
+ const cardsBox = cardsScrollRef.current;
321
333
  const sentinel = cardsSentinelRef.current;
322
- if (!root || !sentinel) return;
334
+ if (!cardsBox || !sentinel) return;
323
335
  const observer = new IntersectionObserver(
324
336
  (entries) => {
325
337
  if (entries.some((entry) => entry.isIntersecting)) cardsLoadMore();
326
338
  },
327
- { root, rootMargin: "300px" }
339
+ { root: findCardsScrollRoot(cardsBox), rootMargin: CARDS_LOAD_MORE_MARGIN }
328
340
  );
329
341
  observer.observe(sentinel);
330
342
  return () => observer.disconnect();
@@ -1 +1 @@
1
- {"version":3,"file":"DataTable.js","sources":["../../../../src/components/UI/DataTable/DataTable.tsx"],"sourcesContent":["import { Fragment, JSX, KeyboardEvent, ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport classNames from 'classnames';\nimport { useTranslation } from 'react-i18next';\n\nimport ControlledButton from '@/components/Form/ControlledButton';\nimport { ActiveFiltersBar, buildEmptyFilterValues, emptyValueForKind } from '@/components/Search/filters';\nimport LoadingSpinner from '@/components/UI/LoadingSpinner';\nimport { MaterialSymbol } from '@/components/UI/MaterialSymbol';\nimport { useBreakpoint } from '@/hooks/useBreakpoint';\n\nimport GridProvider from './grid/GridProvider';\nimport { type IGridCellCoord } from './grid/gridTypes';\nimport { useGridFillApply } from './grid/useGridFillApply';\nimport { useGridEditMode, useGridInstance, useGridMatrixSync } from './grid/useGridInstance';\nimport { useGridKeyboard } from './grid/useGridKeyboard';\nimport DataTableAutoCard from './DataTableAutoCard';\nimport DataTableBody from './DataTableBody';\nimport DataTableBulkEditButton from './DataTableBulkEditButton';\nimport DataTableBulkEditDialog from './DataTableBulkEditDialog';\nimport { isBadgeColumnType } from './dataTableClasses';\nimport DataTableColumnToggle from './DataTableColumnToggle';\nimport { type IDataTableDetailColumnsState } from './DataTableDetailTable';\nimport DataTableEditModeButton from './DataTableEditModeButton';\nimport DataTableHead from './DataTableHead';\nimport DataTablePaginationBar, { DATA_TABLE_MIN_PAGE_SIZE } from './DataTablePagination';\nimport {\n DataTableCardsSkeletonState,\n DataTableEmptyState,\n DataTableErrorState,\n DataTableSkeletonState,\n} from './DataTableStates';\nimport DataTableToolbar from './DataTableToolbar';\nimport {\n DATA_TABLE_REMOVE_COLUMN_ID,\n type IDataTableColumnConfig,\n type IDataTableConfig,\n type IDataTableRow,\n type IDataTableSortState,\n type IDataTableSpreadsheetConfig,\n isDataTableDetailTableExpansion,\n type TDataTableFilterValues,\n type TDataTableViewMode,\n} from './types';\nimport DataTableCellEditingProvider from './useCellEditingState';\nimport { useColumnOrder, useDetailColumnOrder } from './useColumnOrder';\nimport { useColumnSizing } from './useColumnSizing';\nimport { useColumnVisibility, useDetailColumnVisibility } from './useColumnVisibility';\nimport {\n type IDataTableClientPaginationState,\n type IDataTablePagination,\n useDataTableInstance,\n} from './useDataTableInstance';\nimport { useDataTableUndoHistory } from './useDataTableUndoHistory';\n\n// The add-row control sits right above the footer controls, so an upward hint covers it and swallows\n// the next click; `flip` still lifts the hint when the table ends at the bottom of the viewport.\nconst FOOTER_CONTROL_TOOLTIP_PLACEMENT = 'bottom';\n\ninterface IDataTableProps<T extends IDataTableRow, C extends IDataTableRow = IDataTableRow> {\n config: IDataTableConfig<T, C>;\n rows: Array<T>;\n loading?: boolean;\n error?: boolean;\n /** Cause behind `error`, so the empty state can name a denial instead of a system failure. */\n errorCause?: unknown;\n onRetry?: () => void;\n emptyMessage?: string;\n searchLabel?: string;\n onSearch?: (value: string) => void;\n initialSearch?: string;\n onSearchTermChange?: (value: string) => void;\n searchDisabled?: boolean;\n searchDebounceTime?: number;\n searchMinLength?: number;\n /** Renders the search input in the toolbar's start (left) group instead of the end. */\n searchAtStart?: boolean;\n sort?: IDataTableSortState | null;\n onSortChange?: (sort: IDataTableSortState | null) => void;\n pagination?: IDataTablePagination;\n /** Client mode: seeds page/pageSize (1-based page), e.g. from the URL. */\n initialClientPagination?: IDataTableClientPaginationState;\n /** Client mode: reports page/pageSize changes and keeps the page across in-place row updates. */\n onClientPaginationChange?: (pagination: IDataTableClientPaginationState) => void;\n toolbarSlot?: JSX.Element;\n /**\n * Extra controls rendered in the footer's left group, right after the table's\n * own buttons (columns, edit mode, bulk edit). For an action that belongs to\n * the list itself rather than to the page header, so it sits beside the\n * controls it relates to instead of competing with the page actions. The\n * footer row renders for this slot alone when the table has no other control.\n */\n footerActionsSlot?: ReactNode;\n /**\n * Applied filter values. Passing them (together with `config.filters`) makes\n * the table render the always-visible active-filter chips above the toolbar,\n * so the user never has to hover the button to see what is filtering.\n */\n filterValues?: TDataTableFilterValues;\n onFilterValuesChange?: (values: TDataTableFilterValues) => void;\n /** Rendered at the start (left) of the toolbar, before tabs and view toggle. */\n toolbarStartSlot?: JSX.Element;\n /**\n * Full-width band rendered as the first row of the list body, spanning every\n * column (below the header, above the data rows). Opt-in: omit for a normal\n * table. When set, the empty state is skipped so the band stays visible even\n * with zero data rows (e.g. an inline \"create the first record\" editor).\n */\n bodyTopRow?: ReactNode;\n /** Client mode: reports the filtered (post-search) row count on every change. */\n onFilteredCountChange?: (count: number) => void;\n /**\n * Controlled view mode. When provided, the host owns the state (e.g. to persist\n * it) and must update it via `onViewModeChange`; omit for internal state.\n */\n viewMode?: TDataTableViewMode;\n /**\n * Fired on every view-toggle click, including re-selecting the active mode\n * (hosts use it e.g. to reopen the grouping dialog).\n */\n onViewModeChange?: (mode: TDataTableViewMode) => void;\n /**\n * Where the \"Columns\" toggle renders: `header` (default, inside the table\n * header), `toolbar` (next to the view toggle) or `footer` (bottom-left,\n * on the same row as the pagination).\n */\n columnTogglePlacement?: 'header' | 'toolbar' | 'footer';\n /**\n * Enables infinite scroll in the Cards view: the table observes a bottom\n * sentinel and calls `loadMore` while `hasMore`. Pass `source.cardsInfinite`\n * from `useDataTableSource`. The Lista view keeps its pagination bar.\n */\n cardsInfiniteScroll?: {\n hasMore: boolean;\n loadingMore: boolean;\n loadMore: () => void;\n };\n /**\n * Hides the built-in segmented view toggle. Use when the host renders its own\n * Cards/Lista switcher (e.g. a page-level `ControlledTabs`) and drives `viewMode`\n * itself. Other consumers keep the default toggle.\n */\n hideViewToggle?: boolean;\n /**\n * Layout mode. `page` (default): the table owns a bounded, vertically-scrolling\n * region (`flex-1 min-h-0`) for full-page lists. `fit`: the table sizes to its\n * content and scrolls only horizontally — for embedding inside a dialog / card /\n * editor grid where the host container owns vertical scroll. In `fit` mode the\n * empty state is compact (no full illustration) so surrounding controls such as\n * the add-row button stay visible.\n */\n layout?: 'page' | 'fit';\n /** Reduces cell vertical padding for more visible rows per viewport. */\n dense?: boolean;\n /** Roomier cell padding and type scale, for tables that need to read bigger. */\n spacious?: boolean;\n /**\n * Per-cell persistence state (`statuses` from `useDataTableCommitQueue`), painted\n * on the cells so the user sees what is saving and what failed.\n */\n commitStatuses?: ReadonlyMap<string, string>;\n}\n\nconst DataTable = <T extends IDataTableRow, C extends IDataTableRow = IDataTableRow>({\n config: configProp,\n rows,\n loading = false,\n error = false,\n errorCause,\n onRetry,\n emptyMessage,\n searchLabel,\n onSearch,\n initialSearch = '',\n onSearchTermChange,\n searchDisabled = false,\n searchDebounceTime = 400,\n searchMinLength = 1,\n searchAtStart = false,\n sort,\n onSortChange,\n pagination,\n initialClientPagination,\n onClientPaginationChange,\n toolbarSlot,\n footerActionsSlot,\n filterValues,\n onFilterValuesChange,\n toolbarStartSlot,\n bodyTopRow,\n onFilteredCountChange,\n viewMode: controlledViewMode,\n onViewModeChange,\n columnTogglePlacement = 'header',\n cardsInfiniteScroll,\n hideViewToggle = false,\n layout = 'page',\n dense: denseProp = false,\n spacious = false,\n commitStatuses,\n}: IDataTableProps<T, C>) => {\n const { t } = useTranslation('ui');\n\n const isFit = layout === 'fit';\n const dense = !spacious && (isFit || denseProp);\n const editingRows = configProp.editing?.rows;\n const showAddRow = !!editingRows?.canAdd && !!editingRows.onAddRow;\n\n const hostFillCells = configProp.spreadsheet ? configProp.spreadsheet.fill?.onFillCells : undefined;\n const isUndoEnabled = !!configProp.editing?.onCellChange && configProp.editing.undo !== false;\n const { recordedOnCellChange, recordedOnFillCells, handleUndoShortcut } = useDataTableUndoHistory<T>({\n enabled: isUndoEnabled,\n rows,\n columns: configProp.columns,\n onCellChange: configProp.editing?.onCellChange,\n onFillCells: hostFillCells,\n });\n\n const configWithUndo = useMemo<IDataTableConfig<T, C>>(() => {\n if (!isUndoEnabled || !configProp.editing) return configProp;\n\n const spreadsheetConfig = configProp.spreadsheet;\n return {\n ...configProp,\n editing: { ...configProp.editing, onCellChange: recordedOnCellChange },\n spreadsheet:\n spreadsheetConfig && spreadsheetConfig.fill?.onFillCells\n ? { ...spreadsheetConfig, fill: { ...spreadsheetConfig.fill, onFillCells: recordedOnFillCells } }\n : spreadsheetConfig,\n };\n }, [configProp, isUndoEnabled, recordedOnCellChange, recordedOnFillCells]);\n\n // When `editing.rows.onRemoveRow` is set, append a synthetic trailing actions\n // column carrying a per-row delete control. It is a real `actions` column, so\n // it flows through the existing sizing / sticky-right / flex-exclusion / order\n // paths unchanged (see useColumnOrder: actions columns are pinned to the end).\n const config = useMemo<IDataTableConfig<T, C>>(() => {\n if (!editingRows?.onRemoveRow) return configWithUndo;\n\n const removeColumn: IDataTableColumnConfig<T> = {\n id: DATA_TABLE_REMOVE_COLUMN_ID,\n header: '',\n type: 'actions',\n hideable: false,\n resizable: false,\n actions: [\n {\n key: 'remove',\n label: t('dataTable.removeRow'),\n icon: 'delete',\n danger: true,\n hidden: (row) => (editingRows.canRemove ? !editingRows.canRemove(row) : false),\n onClick: (row) => editingRows.onRemoveRow?.(row),\n },\n ],\n };\n\n return { ...configWithUndo, columns: [...configWithUndo.columns, removeColumn] };\n }, [configWithUndo, editingRows, t]);\n\n const { columnVisibility, onColumnVisibilityChange } = useColumnVisibility(config);\n const { columnOrder, onColumnOrderChange, resetColumnOrder } = useColumnOrder(config);\n const { columnSizing, onColumnSizingChange, resetColumnSizing } = useColumnSizing(config);\n\n // Every table restores the persisted column order back to the config default\n // on mount (equivalent to firing \"Restaurar ordem padrão\" from the columns\n // menu), so a stale/incompatible persisted order never sticks. Does not touch\n // column widths or visibility, and does not affect the Cards view.\n useEffect(() => {\n resetColumnOrder();\n }, []);\n\n const detailExpansionColumns =\n config.expansion && isDataTableDetailTableExpansion(config.expansion) && Array.isArray(config.expansion.columns)\n ? config.expansion.columns\n : null;\n const { detailColumnVisibility, toggleDetailColumn } = useDetailColumnVisibility(\n config.entityKey,\n detailExpansionColumns,\n );\n const { detailColumnOrder, onDetailColumnOrderChange, resetDetailColumnOrder } = useDetailColumnOrder(\n config.entityKey,\n detailExpansionColumns,\n );\n\n const detailColumnsState: IDataTableDetailColumnsState | undefined = detailExpansionColumns\n ? {\n visibility: detailColumnVisibility,\n toggleVisibility: toggleDetailColumn,\n order: detailColumnOrder,\n onOrderChange: onDetailColumnOrderChange,\n resetOrder: resetDetailColumnOrder,\n }\n : undefined;\n\n const { isMobile } = useBreakpoint();\n\n const hasCardView = !!config.renderCard;\n const hasGroupedView = !!config.renderGroupedBody;\n const hasKanbanView = !!config.renderKanbanBody;\n // Fixed behaviour: card-capable tables always open on Cards (first), Lista second.\n // The toggle switches within the session and resets to Cards on remount, unless\n // the host controls the mode via the `viewMode` prop (e.g. persisted preference).\n const [internalViewMode, setInternalViewMode] = useState<TDataTableViewMode>('cards');\n const viewMode = controlledViewMode ?? internalViewMode;\n\n const [isBulkEditOpen, setIsBulkEditOpen] = useState(false);\n\n const handleViewModeChange = (mode: TDataTableViewMode) => {\n if (controlledViewMode === undefined) setInternalViewMode(mode);\n onViewModeChange?.(mode);\n };\n\n const {\n table,\n isClientMode,\n columnContentWidths,\n registerRow,\n beginRowsExit,\n visibleRows,\n activeTab,\n tabs,\n handleTabChange,\n handleSearchInput,\n handleHeaderSortClick,\n resolveSortDirection,\n clientPaginationProps,\n showUpdatingBar,\n contentOpacityStyle,\n dataTableOpacityTransitionClass,\n showSkeleton,\n hasRows,\n clientSearchDebounceMs,\n } = useDataTableInstance({\n config,\n rows,\n loading,\n sort,\n onSortChange,\n onSearch,\n initialSearch,\n onSearchTermChange,\n pagination,\n initialClientPagination,\n onClientPaginationChange,\n columnVisibility,\n onColumnVisibilityChange,\n columnOrder,\n onColumnOrderChange,\n columnSizing,\n onColumnSizingChange,\n onFilteredCountChange,\n });\n\n const columnConfigById = useMemo(\n () => new Map(config.columns.map((columnConfig) => [columnConfig.id, columnConfig])),\n [config.columns],\n );\n\n // Under `table-fixed` one column absorbs leftover horizontal space. The last\n // visible non-actions, non-badge, non-first column is the flex column.\n const visibleLeafColumns = table.getVisibleLeafColumns();\n const flexColumnId = useMemo(() => {\n if (config.flexColumnId && visibleLeafColumns.some((leafColumn) => leafColumn.id === config.flexColumnId)) {\n return config.flexColumnId;\n }\n\n const candidates = visibleLeafColumns.filter((leafColumn, index) => {\n if (index === 0) return false;\n const type = columnConfigById.get(leafColumn.id)?.type;\n return type !== 'actions' && !isBadgeColumnType(type);\n });\n return candidates[candidates.length - 1]?.id ?? null;\n }, [visibleLeafColumns, columnConfigById, config.flexColumnId]);\n\n // `table-fixed` sizes columns from the table width, so the table must be at\n // least the sum of ALL column widths (including the absorber's seed) for their\n // widths to be honored; below that the browser shrinks them proportionally.\n // `min-w-full` still lets the table stretch to fill the container, and the\n // auto-width absorber soaks the surplus (never shrinking below its own seed,\n // because its seed is part of this total).\n const totalTableWidth = useMemo(\n () => visibleLeafColumns.reduce((sum, leafColumn) => sum + leafColumn.getSize(), 0),\n [visibleLeafColumns, columnSizing],\n );\n\n // ----- Spreadsheet layer -----\n // Toda tabela com coluna editável ganha a camada de planilha sem configuração, ativa\n // desde a montagem. Numa tabela com `onRowClick` a célula editável é dona do próprio\n // clique (abre o editor) e o resto da linha continua abrindo o registro.\n const spreadsheet = useMemo<IDataTableSpreadsheetConfig<T> | undefined>(() => {\n if (config.spreadsheet === false) return undefined;\n return config.spreadsheet ?? { selection: 'range', fill: {} };\n }, [config.spreadsheet]);\n\n const hasEditableColumns = useMemo(\n () => !!config.editing?.onCellChange && config.columns.some((columnConfig) => !!columnConfig.editable),\n [config.editing, config.columns],\n );\n\n const editModeBehavior = spreadsheet?.mode ?? 'always';\n const gridEnabled = !!spreadsheet && (hasEditableColumns || !!config.spreadsheet);\n\n const gridStore = useGridInstance({\n spreadsheet,\n enabled: gridEnabled,\n startsInEditMode: editModeBehavior === 'always',\n });\n\n const isEditMode = useGridEditMode(gridStore);\n const showEditModeToggle = gridEnabled && editModeBehavior === 'toggle';\n\n // Below the tablet edge a real table is unreadable: even the narrowest column\n // set overflows and the user reads it through a horizontal scrollbar. Cards are\n // the readable shape there, so the narrow viewport takes over the choice.\n // Excluded: `fit` layouts without a bespoke card (their cell geometry IS the\n // feature) and a table whose reason to exist is editing. Merely being able to edit\n // is not enough: a table that opens a record on row click is a reading surface\n // first, unless the user turned its edit toggle on. A `fit` table that ships\n // `renderCard` opted into a narrow shape, so it takes over as well.\n const isEditingSurface = isEditMode && (editModeBehavior === 'toggle' || !config.onRowClick);\n const forceCardsOnMobile = isMobile && (!isFit || hasCardView) && !isEditingSurface;\n\n const isGroupedView = hasGroupedView && viewMode === 'grouped';\n const isKanbanView = hasKanbanView && viewMode === 'kanban';\n // Grouped and kanban both hand the whole body to the host, so everything the\n // table draws around a real row list is off in either of them.\n const isDelegatedView = isGroupedView || isKanbanView;\n const isCardsView = hasCardView && (viewMode === 'cards' || (forceCardsOnMobile && !isDelegatedView));\n const useAutoCards = forceCardsOnMobile && !hasCardView && !isDelegatedView;\n\n useEffect(() => {\n if (!gridStore || !commitStatuses) return;\n gridStore.getState().setCellStatuses(commitStatuses);\n }, [gridStore, commitStatuses]);\n\n const navigableColumnIds = useMemo(\n () =>\n visibleLeafColumns\n .filter((leafColumn) => columnConfigById.get(leafColumn.id)?.type !== 'actions')\n .map((leafColumn) => leafColumn.id),\n [visibleLeafColumns, columnConfigById],\n );\n const gridRowIds = useMemo(() => visibleRows.map((row) => row.id), [visibleRows]);\n\n useGridMatrixSync(gridStore, gridRowIds, navigableColumnIds);\n\n // Read through a ref so the callback stays stable while the rows change on\n // every edit: an unstable handler would re-bind the grid keyboard each render.\n const visibleRowsRef = useRef(visibleRows);\n visibleRowsRef.current = visibleRows;\n\n const canEditCell = useCallback(\n ({ rowId, columnId }: IGridCellCoord) => {\n if (!config.editing?.onCellChange) return false;\n\n const editable = columnConfigById.get(columnId)?.editable;\n if (!editable) return false;\n\n const row = visibleRowsRef.current.find((candidate) => candidate.id === rowId);\n if (!row) return false;\n\n return !(editable.disabled?.(row.original) ?? false);\n },\n [config.editing, columnConfigById],\n );\n\n const acceptsTypedValue = useCallback(\n ({ columnId }: IGridCellCoord) => {\n const editable = columnConfigById.get(columnId)?.editable;\n if (!editable || editable.renderEditor) return false;\n\n return editable.type === 'text' || editable.type === 'number';\n },\n [columnConfigById],\n );\n\n const handleGridKeyDown = useGridKeyboard({\n store: gridStore,\n canEditCell: hasEditableColumns ? canEditCell : undefined,\n acceptsTypedValue,\n onSave: spreadsheet?.onSave,\n });\n\n const handleFillCommit = useGridFillApply<T>({\n visibleRows,\n columnConfigById,\n spreadsheet,\n onCellChange: config.editing?.onCellChange,\n });\n\n // After an undo in the spreadsheet grid the restored cell becomes the active one, so\n // the user sees which cell changed, even when it sits on another row of the page.\n const handleTableKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n const restoredCell = handleUndoShortcut(event);\n if (!restoredCell || !gridStore || !gridStore.getState().isEditMode) return;\n\n const restoredGridRow = visibleRowsRef.current.find((candidate) => candidate.original.id === restoredCell.row.id);\n if (!restoredGridRow) return;\n gridStore.getState().setActiveCell({ rowId: restoredGridRow.id, columnId: restoredCell.columnId });\n },\n [handleUndoShortcut, gridStore],\n );\n\n const handleEditModeToggle = useCallback(() => {\n const store = gridStore;\n if (!store) return;\n store.getState().setEditMode(!store.getState().isEditMode);\n }, [gridStore]);\n\n const cardsScrollRef = useRef<HTMLDivElement | null>(null);\n const cardsSentinelRef = useRef<HTMLDivElement | null>(null);\n const cardsLoadMore = cardsInfiniteScroll?.loadMore;\n const cardsHasMore = cardsInfiniteScroll?.hasMore ?? false;\n\n // Cards infinite scroll: load the next page when the bottom sentinel enters the\n // cards scroll container. `loadMore` is stable and self-guards while a page is\n // in flight; re-running on row count keeps the observer bound after each append.\n useEffect(() => {\n if (!isCardsView || !cardsHasMore || !cardsLoadMore) return;\n\n const root = cardsScrollRef.current;\n const sentinel = cardsSentinelRef.current;\n if (!root || !sentinel) return;\n\n const observer = new IntersectionObserver(\n (entries) => {\n if (entries.some((entry) => entry.isIntersecting)) cardsLoadMore();\n },\n { root, rootMargin: '300px' },\n );\n observer.observe(sentinel);\n\n return () => observer.disconnect();\n }, [isCardsView, cardsHasMore, cardsLoadMore, visibleRows.length]);\n\n const listScrollRef = useRef<HTMLDivElement | null>(null);\n const [detailSlotWidth, setDetailSlotWidth] = useState<number | undefined>(undefined);\n const [parentHasHorizontalOverflow, setParentHasHorizontalOverflow] = useState(false);\n\n // Track the list scrollport: its clientWidth sizes the detail panel to the\n // visible area (detailTable expansion), and its horizontal overflow toggles the\n // frozen actions-column shadow (shown only while columns scroll under it, so\n // there is no always-on divider line otherwise). Observing the inner table too\n // keeps both in sync when columns are toggled or the layout reflows. The\n // branch-state deps re-bind when the scroller remounts (view/skeleton/error/\n // empty transitions swap the rendered subtree).\n useEffect(() => {\n const scroller = listScrollRef.current;\n if (!scroller) return undefined;\n\n const measure = () => {\n setDetailSlotWidth(scroller.clientWidth || undefined);\n setParentHasHorizontalOverflow(scroller.scrollWidth > scroller.clientWidth + 1);\n };\n measure();\n\n const observer = new ResizeObserver(measure);\n observer.observe(scroller);\n const parentTable = scroller.querySelector('table');\n if (parentTable) observer.observe(parentTable);\n\n return () => observer.disconnect();\n }, [isCardsView, isDelegatedView, showSkeleton, error, hasRows]);\n\n const renderBody = () => {\n // Grouped view delegates the whole body to the host (it owns fetching,\n // accordions, loading and empty states for each group).\n if (isGroupedView && config.renderGroupedBody) return config.renderGroupedBody();\n if (isKanbanView && config.renderKanbanBody) return config.renderKanbanBody();\n\n if (showSkeleton)\n return isCardsView ? (\n <DataTableCardsSkeletonState cardClassName={config.cardSkeletonClassName} />\n ) : (\n <DataTableSkeletonState rows={config.skeletonRows} />\n );\n\n if (error) return <DataTableErrorState onRetry={onRetry} errorCause={errorCause} />;\n\n // A `bodyTopRow` (e.g. an inline create editor) must stay visible even with\n // zero data rows, so it takes precedence over the empty state.\n if (!hasRows && !bodyTopRow) {\n if (isFit) {\n // Embedded/editor context: skip the full illustration so surrounding\n // controls (e.g. the add-row button) stay visible in a compact dialog.\n return emptyMessage ? (\n <div className=\"py-6 text-center text-sm text-foreground-faint\">{emptyMessage}</div>\n ) : null;\n }\n return <DataTableEmptyState emptyMessage={emptyMessage} />;\n }\n\n if (isCardsView && config.renderCard) {\n // Cards render from the SAME visible rows the table uses (already searched,\n // filtered, sorted and paginated), so both views share one source. No grid:\n // flex-wrap keeps the layout responsive per the project's no-CSS-grid rule.\n return (\n <div ref={cardsScrollRef} className=\"relative min-h-0 flex-1 overflow-y-auto @container\">\n {showUpdatingBar && (\n <div className=\"absolute inset-x-0 top-0 z-10 h-0.5 animate-pulse bg-brand-hover\" aria-hidden />\n )}\n {/* Cards têm largura fixa, então uma faixa estreita demais para duas colunas\n deixa a sobra toda de um lado. Abaixo disso eles se centram; a partir de\n duas colunas o alinhamento à esquerda volta a ser o que lê melhor. */}\n <div\n className={classNames(\n 'flex flex-wrap justify-center gap-4 @md:justify-start',\n dataTableOpacityTransitionClass,\n config.cardGridClassName,\n )}\n style={contentOpacityStyle}\n >\n {visibleRows\n .filter((row) => row.depth === 0)\n .map((row) => (\n <Fragment key={row.id}>{config.renderCard?.(row.original)}</Fragment>\n ))}\n </div>\n\n {cardsInfiniteScroll?.loadingMore && (\n <div className=\"flex justify-center py-4\">\n <LoadingSpinner size={6} />\n </div>\n )}\n\n {cardsHasMore && <div ref={cardsSentinelRef} className=\"h-px w-full\" aria-hidden />}\n </div>\n );\n }\n\n // Narrow viewport with no bespoke card renderer: stack each row into a card\n // derived from the same columns, so the list stays readable without the host\n // authoring a second renderer.\n if (useAutoCards) {\n return (\n <div className=\"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto\">\n {visibleRows\n .filter((row) => row.depth === 0)\n .map((row) => (\n <DataTableAutoCard key={row.id} row={row} columnConfigById={columnConfigById} />\n ))}\n </div>\n );\n }\n\n // The table scrolls inside this bounded region (flex-1 + min-h-0). The sticky\n // header pins to the top of the data area; the region also scrolls horizontally\n // so columns keep a minimum readable width instead of being crushed. The first\n // column and the actions column are frozen (sticky left/right) so navigation\n // anchors stay visible while the middle columns scroll past.\n return (\n <div\n ref={listScrollRef}\n onKeyDown={gridStore ? handleGridKeyDown : undefined}\n className={classNames(\n 'relative [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-border-emphasis hover:[&::-webkit-scrollbar-thumb]:bg-foreground-faint [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar]:h-2.5 [&::-webkit-scrollbar]:w-2.5',\n // The rows scroll inside this bounded region (flex-1 + min-h-0), so the\n // host provides the height (a full page, or a bounded flex parent like a\n // fixed-size dialog) and the add-row/footer below stay pinned outside it.\n 'min-h-0 flex-1 overflow-auto',\n )}\n >\n {showUpdatingBar && (\n <div className=\"absolute inset-x-0 top-0 z-10 h-0.5 animate-pulse bg-brand-hover\" aria-hidden />\n )}\n <table\n role={gridStore ? 'grid' : undefined}\n aria-multiselectable={gridStore && spreadsheet?.selection === 'range' ? true : undefined}\n className={classNames(\n // `table-fixed`: column widths come exclusively from the colgroup so\n // user resizes are honored exactly (under `table-auto` the browser\n // ignores explicit col widths and sizes by content). The slack\n // absorber (auto-width col) still soaks any leftover space.\n 'min-w-full table-fixed border-separate border-spacing-0 rounded-md border-y border-border-subtle',\n dataTableOpacityTransitionClass,\n )}\n style={{ ...contentOpacityStyle, width: totalTableWidth || undefined }}\n >\n <DataTableHead\n table={table}\n columns={config.columns}\n columnConfigById={columnConfigById}\n columnContentWidths={columnContentWidths}\n columnOrder={columnOrder}\n onColumnOrderChange={onColumnOrderChange}\n resetColumnOrder={resetColumnOrder}\n resetColumnSizing={resetColumnSizing}\n onHeaderSortClick={handleHeaderSortClick}\n resolveSortDirection={resolveSortDirection}\n hideColumnToggle={columnTogglePlacement !== 'header'}\n flexColumnId={flexColumnId}\n showActionsShadow={parentHasHorizontalOverflow}\n dense={dense}\n spacious={spacious}\n />\n\n <DataTableBody\n config={config}\n visibleRows={visibleRows}\n columnConfigById={columnConfigById}\n columnContentWidths={columnContentWidths}\n registerRow={registerRow}\n onCollapseStart={beginRowsExit}\n detailColumnsState={detailColumnsState}\n detailSlotWidth={detailSlotWidth}\n showActionsShadow={parentHasHorizontalOverflow}\n dense={dense}\n spacious={spacious}\n fillEnabled={!!spreadsheet?.fill}\n editMode={isEditMode}\n canEditCell={canEditCell}\n bodyTopRow={bodyTopRow}\n bodyTopRowColSpan={table.getVisibleLeafColumns().length}\n />\n </table>\n </div>\n );\n };\n\n // Cards normally page themselves through infinite scroll, so the pager is\n // hidden. When the narrow viewport takes the choice over, the host is still in\n // list mode and its `cardsInfiniteScroll` is not wired: without the pager the\n // user would be stranded on the first page.\n const isMobileCardsTakeover = isCardsView && viewMode !== 'cards' && !cardsInfiniteScroll;\n\n const showPagination =\n (!isCardsView || isMobileCardsTakeover) &&\n !isDelegatedView &&\n !!clientPaginationProps &&\n !showSkeleton &&\n !error &&\n hasRows &&\n clientPaginationProps.numberOfPages > 0 &&\n !(clientPaginationProps.numberOfPages === 1 && clientPaginationProps.pageSize <= DATA_TABLE_MIN_PAGE_SIZE);\n\n // The toolbar only skeletons on the very first load: a refetch (tab switch,\n // filter, search) keeps the real controls mounted, so the search term and the\n // focus survive and the row never changes height.\n const [hasLoadedOnce, setHasLoadedOnce] = useState(!loading);\n\n useEffect(() => {\n if (!loading) setHasLoadedOnce(true);\n }, [loading]);\n\n const showSearch = (!!onSearch || isClientMode) && config.searchable !== false;\n const showToolbar =\n (tabs?.length ?? 0) > 0 ||\n hasCardView ||\n showSearch ||\n !!toolbarSlot ||\n !!toolbarStartSlot ||\n columnTogglePlacement === 'toolbar';\n\n const columnToggleSlot =\n columnTogglePlacement === 'toolbar' ? (\n <DataTableColumnToggle\n table={table}\n columns={config.columns}\n columnOrder={columnOrder}\n onColumnOrderChange={onColumnOrderChange}\n resetColumnOrder={resetColumnOrder}\n resetColumnSizing={resetColumnSizing}\n variant=\"toolbar\"\n />\n ) : undefined;\n\n // O rodapé é o lugar dos controles da própria tabela (colunas e modo de edição),\n // ao lado da paginação. Ambos só existem sobre uma lista real.\n const showTableControls = !isCardsView && !isDelegatedView && !showSkeleton && !error && hasRows;\n const showFooterColumnToggle = columnTogglePlacement === 'footer' && showTableControls;\n const showFooterEditToggle = showEditModeToggle && showTableControls;\n\n // A edição em massa não depende do modo de exibição: em cards ela é a única\n // forma de editar, já que não existe célula para clicar.\n const showBulkEdit =\n hasEditableColumns && !!spreadsheet?.fill?.onFillCells && !isDelegatedView && !showSkeleton && !error && hasRows;\n\n const showFooterControls = showFooterColumnToggle || showFooterEditToggle || showBulkEdit || !!footerActionsSlot;\n const bulkEditRows = useMemo(\n () => visibleRows.filter((row) => row.depth === 0).map((row) => row.original),\n [visibleRows],\n );\n\n const activeFiltersBar =\n config.filters && filterValues && onFilterValuesChange ? (\n <ActiveFiltersBar\n fields={config.filters.fields ?? []}\n values={filterValues}\n onRemove={(key) =>\n onFilterValuesChange({\n ...filterValues,\n [key]: emptyValueForKind((config.filters?.fields ?? []).find((field) => field.key === key)?.kind ?? 'text'),\n })\n }\n onClearAll={() => onFilterValuesChange(buildEmptyFilterValues(config.filters?.fields ?? []))}\n />\n ) : null;\n\n const content = (\n <div\n className=\"flex min-h-0 w-full flex-1 flex-col gap-4\"\n onKeyDown={isUndoEnabled ? handleTableKeyDown : undefined}\n >\n {activeFiltersBar}\n {showToolbar && (\n <DataTableToolbar\n tabs={tabs}\n activeTab={activeTab}\n onTabChange={handleTabChange}\n showViewToggle={hasCardView && !hideViewToggle && !forceCardsOnMobile}\n showGroupedView={hasGroupedView}\n showKanbanView={hasKanbanView}\n viewMode={viewMode}\n onViewModeChange={handleViewModeChange}\n showSearch={showSearch}\n searchLabel={searchLabel}\n initialSearch={initialSearch}\n searchDisabled={searchDisabled}\n searchDebounceTime={isClientMode ? clientSearchDebounceMs : searchDebounceTime}\n searchMinLength={searchMinLength}\n searchAtStart={searchAtStart}\n onSearchInput={handleSearchInput}\n toolbarSlot={toolbarSlot}\n toolbarStartSlot={toolbarStartSlot}\n columnToggleSlot={columnToggleSlot}\n showSkeleton={loading && !hasLoadedOnce}\n />\n )}\n\n <div key={viewMode} className=\"flex min-h-0 flex-1 animate-fade-in flex-col\">\n {renderBody()}\n </div>\n\n {showAddRow && (\n // Sibling of the scrolling rows region, so it stays pinned below the grid\n // (outside its scroll) — the rows scroll, this control does not move.\n <div className=\"flex\">\n <ControlledButton\n variant=\"outlined\"\n className=\"flex items-center gap-1.5\"\n onClick={() => editingRows?.onAddRow?.()}\n >\n <MaterialSymbol icon=\"add\" size={16} />\n {t('dataTable.addRow')}\n </ControlledButton>\n </div>\n )}\n\n {(showFooterControls || showPagination) && (\n <div className=\"flex items-center justify-between gap-4\">\n {showFooterControls && (\n <div className=\"flex flex-wrap items-center gap-2 pb-3\">\n {showFooterColumnToggle && (\n <DataTableColumnToggle\n table={table}\n columns={config.columns}\n columnOrder={columnOrder}\n onColumnOrderChange={onColumnOrderChange}\n resetColumnOrder={resetColumnOrder}\n resetColumnSizing={resetColumnSizing}\n variant=\"toolbar\"\n tooltipPlacement={FOOTER_CONTROL_TOOLTIP_PLACEMENT}\n />\n )}\n {showFooterEditToggle && (\n <DataTableEditModeButton\n active={isEditMode}\n onToggle={handleEditModeToggle}\n tooltipPlacement={FOOTER_CONTROL_TOOLTIP_PLACEMENT}\n />\n )}\n {showBulkEdit && (\n <DataTableBulkEditButton\n onClick={() => setIsBulkEditOpen(true)}\n tooltipPlacement={FOOTER_CONTROL_TOOLTIP_PLACEMENT}\n />\n )}\n {footerActionsSlot}\n </div>\n )}\n\n {showPagination && (\n <div className=\"flex-1\">\n <DataTablePaginationBar\n pageSize={clientPaginationProps.pageSize}\n numberOfPages={clientPaginationProps.numberOfPages}\n currentPage={clientPaginationProps.currentPage}\n setCurrentPage={clientPaginationProps.setCurrentPage}\n onPageSizeChange={clientPaginationProps.onPageSizeChange}\n totalItems={clientPaginationProps.totalItems}\n />\n </div>\n )}\n </div>\n )}\n\n {showBulkEdit && (\n <DataTableBulkEditDialog\n open={isBulkEditOpen}\n onClose={() => setIsBulkEditOpen(false)}\n columns={config.columns}\n rows={bulkEditRows}\n getRowLabel={config.getRowLabel}\n onApply={(changes) => spreadsheet?.fill?.onFillCells?.(changes)}\n />\n )}\n </div>\n );\n\n // Os providers ficam por fora do conteúdo já montado: abrir ou fechar uma célula re-renderiza\n // apenas as células editáveis, não a tabela inteira.\n const editableContent = config.editing?.clickToEdit ? (\n <DataTableCellEditingProvider>{content}</DataTableCellEditingProvider>\n ) : (\n content\n );\n\n if (!gridStore) return editableContent;\n\n return (\n <GridProvider\n store={gridStore}\n gridAreaRef={listScrollRef}\n canEditCell={canEditCell}\n onFillCommit={handleFillCommit}\n >\n {editableContent}\n </GridProvider>\n );\n};\n\nexport default DataTable;\n"],"names":["DataTablePaginationBar"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDA,MAAM,mCAAmC;AA0GzC,MAAM,YAAY,CAAmE;AAAA,EACnF,QAAQ;AAAA,EACR;AAAA,EACA,UAAU;AAAA,EACV,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB;AAAA,EAChB;AAAA,EACA,iBAAiB;AAAA,EACjB,qBAAqB;AAAA,EACrB,kBAAkB;AAAA,EAClB,gBAAgB;AAAA,EAChB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA,wBAAwB;AAAA,EACxB;AAAA,EACA,iBAAiB;AAAA,EACjB,SAAS;AAAA,EACT,OAAO,YAAY;AAAA,EACnB,WAAW;AAAA,EACX;AACF,MAA6B;AAC3B,QAAM,EAAE,EAAA,IAAM,eAAe,IAAI;AAEjC,QAAM,QAAQ,WAAW;AACzB,QAAM,QAAQ,CAAC,aAAa,SAAS;AACrC,QAAM,cAAc,WAAW,SAAS;AACxC,QAAM,aAAa,CAAC,CAAC,aAAa,UAAU,CAAC,CAAC,YAAY;AAE1D,QAAM,gBAAgB,WAAW,cAAc,WAAW,YAAY,MAAM,cAAc;AAC1F,QAAM,gBAAgB,CAAC,CAAC,WAAW,SAAS,gBAAgB,WAAW,QAAQ,SAAS;AACxF,QAAM,EAAE,sBAAsB,qBAAqB,mBAAA,IAAuB,wBAA2B;AAAA,IACnG,SAAS;AAAA,IACT;AAAA,IACA,SAAS,WAAW;AAAA,IACpB,cAAc,WAAW,SAAS;AAAA,IAClC,aAAa;AAAA,EAAA,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AAM,kBAAkB,OAAO,SAAS,cACtC,oBAAC,8BAAA,EAA8B,mBAAQ,IAEvC;AAGF,MAAI,CAAC,UAAW,QAAO;AAEvB,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,OAAO;AAAA,MACP,aAAa;AAAA,MACb;AAAA,MACA,cAAc;AAAA,MAEb,UAAA;AAAA,IAAA;AAAA,EAAA;AAGP;"}
1
+ {"version":3,"file":"DataTable.js","sources":["../../../../src/components/UI/DataTable/DataTable.tsx"],"sourcesContent":["import { Fragment, JSX, KeyboardEvent, ReactNode, useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport classNames from 'classnames';\nimport { useTranslation } from 'react-i18next';\n\nimport ControlledButton from '@/components/Form/ControlledButton';\nimport { ActiveFiltersBar, buildEmptyFilterValues, emptyValueForKind } from '@/components/Search/filters';\nimport LoadingSpinner from '@/components/UI/LoadingSpinner';\nimport { MaterialSymbol } from '@/components/UI/MaterialSymbol';\nimport { useBreakpoint } from '@/hooks/useBreakpoint';\n\nimport GridProvider from './grid/GridProvider';\nimport { type IGridCellCoord } from './grid/gridTypes';\nimport { useGridFillApply } from './grid/useGridFillApply';\nimport { useGridEditMode, useGridInstance, useGridMatrixSync } from './grid/useGridInstance';\nimport { useGridKeyboard } from './grid/useGridKeyboard';\nimport DataTableAutoCard from './DataTableAutoCard';\nimport DataTableBody from './DataTableBody';\nimport DataTableBulkEditButton from './DataTableBulkEditButton';\nimport DataTableBulkEditDialog from './DataTableBulkEditDialog';\nimport { isBadgeColumnType } from './dataTableClasses';\nimport DataTableColumnToggle from './DataTableColumnToggle';\nimport { type IDataTableDetailColumnsState } from './DataTableDetailTable';\nimport DataTableEditModeButton from './DataTableEditModeButton';\nimport DataTableHead from './DataTableHead';\nimport DataTablePaginationBar, { DATA_TABLE_MIN_PAGE_SIZE } from './DataTablePagination';\nimport {\n DataTableCardsSkeletonState,\n DataTableEmptyState,\n DataTableErrorState,\n DataTableSkeletonState,\n} from './DataTableStates';\nimport DataTableToolbar from './DataTableToolbar';\nimport {\n DATA_TABLE_REMOVE_COLUMN_ID,\n type IDataTableColumnConfig,\n type IDataTableConfig,\n type IDataTableRow,\n type IDataTableSortState,\n type IDataTableSpreadsheetConfig,\n isDataTableDetailTableExpansion,\n type TDataTableFilterValues,\n type TDataTableViewMode,\n} from './types';\nimport DataTableCellEditingProvider from './useCellEditingState';\nimport { useColumnOrder, useDetailColumnOrder } from './useColumnOrder';\nimport { useColumnSizing } from './useColumnSizing';\nimport { useColumnVisibility, useDetailColumnVisibility } from './useColumnVisibility';\nimport {\n type IDataTableClientPaginationState,\n type IDataTablePagination,\n useDataTableInstance,\n} from './useDataTableInstance';\nimport { useDataTableUndoHistory } from './useDataTableUndoHistory';\n\n// The add-row control sits right above the footer controls, so an upward hint covers it and swallows\n// the next click; `flip` still lifts the hint when the table ends at the bottom of the viewport.\nconst FOOTER_CONTROL_TOOLTIP_PLACEMENT = 'bottom';\n\nconst CARDS_LOAD_MORE_MARGIN = '300px';\n\nconst isScrollingOverflow = (overflowY: string): boolean =>\n overflowY === 'auto' || overflowY === 'scroll' || overflowY === 'overlay';\n\n/**\n * The element that really scrolls the cards. The cards box only clips when its parent bounds its\n * height; on a page that scrolls as a whole the box grows with every page, never scrolls, and an\n * observer rooted on it sees the sentinel all the time. `null` stands for the viewport.\n */\nconst findCardsScrollRoot = (cardsBox: HTMLElement): HTMLElement | null => {\n let current: HTMLElement | null = cardsBox;\n while (current) {\n if (isScrollingOverflow(getComputedStyle(current).overflowY) && current.scrollHeight > current.clientHeight) {\n return current;\n }\n current = current.parentElement;\n }\n return null;\n};\n\ninterface IDataTableProps<T extends IDataTableRow, C extends IDataTableRow = IDataTableRow> {\n config: IDataTableConfig<T, C>;\n rows: Array<T>;\n loading?: boolean;\n error?: boolean;\n /** Cause behind `error`, so the empty state can name a denial instead of a system failure. */\n errorCause?: unknown;\n onRetry?: () => void;\n emptyMessage?: string;\n searchLabel?: string;\n onSearch?: (value: string) => void;\n initialSearch?: string;\n onSearchTermChange?: (value: string) => void;\n searchDisabled?: boolean;\n searchDebounceTime?: number;\n searchMinLength?: number;\n /** Renders the search input in the toolbar's start (left) group instead of the end. */\n searchAtStart?: boolean;\n sort?: IDataTableSortState | null;\n onSortChange?: (sort: IDataTableSortState | null) => void;\n pagination?: IDataTablePagination;\n /** Client mode: seeds page/pageSize (1-based page), e.g. from the URL. */\n initialClientPagination?: IDataTableClientPaginationState;\n /** Client mode: reports page/pageSize changes and keeps the page across in-place row updates. */\n onClientPaginationChange?: (pagination: IDataTableClientPaginationState) => void;\n toolbarSlot?: JSX.Element;\n /**\n * Extra controls rendered in the footer's left group, right after the table's\n * own buttons (columns, edit mode, bulk edit). For an action that belongs to\n * the list itself rather than to the page header, so it sits beside the\n * controls it relates to instead of competing with the page actions. The\n * footer row renders for this slot alone when the table has no other control.\n */\n footerActionsSlot?: ReactNode;\n /**\n * Applied filter values. Passing them (together with `config.filters`) makes\n * the table render the always-visible active-filter chips above the toolbar,\n * so the user never has to hover the button to see what is filtering.\n */\n filterValues?: TDataTableFilterValues;\n onFilterValuesChange?: (values: TDataTableFilterValues) => void;\n /** Rendered at the start (left) of the toolbar, before tabs and view toggle. */\n toolbarStartSlot?: JSX.Element;\n /**\n * Full-width band rendered as the first row of the list body, spanning every\n * column (below the header, above the data rows). Opt-in: omit for a normal\n * table. When set, the empty state is skipped so the band stays visible even\n * with zero data rows (e.g. an inline \"create the first record\" editor).\n */\n bodyTopRow?: ReactNode;\n /** Client mode: reports the filtered (post-search) row count on every change. */\n onFilteredCountChange?: (count: number) => void;\n /**\n * Controlled view mode. When provided, the host owns the state (e.g. to persist\n * it) and must update it via `onViewModeChange`; omit for internal state.\n */\n viewMode?: TDataTableViewMode;\n /**\n * Fired on every view-toggle click, including re-selecting the active mode\n * (hosts use it e.g. to reopen the grouping dialog).\n */\n onViewModeChange?: (mode: TDataTableViewMode) => void;\n /**\n * Where the \"Columns\" toggle renders: `header` (default, inside the table\n * header), `toolbar` (next to the view toggle) or `footer` (bottom-left,\n * on the same row as the pagination).\n */\n columnTogglePlacement?: 'header' | 'toolbar' | 'footer';\n /**\n * Enables infinite scroll in the Cards view: the table observes a bottom\n * sentinel and calls `loadMore` while `hasMore`. Pass `source.cardsInfinite`\n * from `useDataTableSource`. The Lista view keeps its pagination bar.\n */\n cardsInfiniteScroll?: {\n hasMore: boolean;\n loadingMore: boolean;\n loadMore: () => void;\n };\n /**\n * Hides the built-in segmented view toggle. Use when the host renders its own\n * Cards/Lista switcher (e.g. a page-level `ControlledTabs`) and drives `viewMode`\n * itself. Other consumers keep the default toggle.\n */\n hideViewToggle?: boolean;\n /**\n * Layout mode. `page` (default): the table owns a bounded, vertically-scrolling\n * region (`flex-1 min-h-0`) for full-page lists. `fit`: the table sizes to its\n * content and scrolls only horizontally — for embedding inside a dialog / card /\n * editor grid where the host container owns vertical scroll. In `fit` mode the\n * empty state is compact (no full illustration) so surrounding controls such as\n * the add-row button stay visible.\n */\n layout?: 'page' | 'fit';\n /** Reduces cell vertical padding for more visible rows per viewport. */\n dense?: boolean;\n /** Roomier cell padding and type scale, for tables that need to read bigger. */\n spacious?: boolean;\n /**\n * Per-cell persistence state (`statuses` from `useDataTableCommitQueue`), painted\n * on the cells so the user sees what is saving and what failed.\n */\n commitStatuses?: ReadonlyMap<string, string>;\n}\n\nconst DataTable = <T extends IDataTableRow, C extends IDataTableRow = IDataTableRow>({\n config: configProp,\n rows,\n loading = false,\n error = false,\n errorCause,\n onRetry,\n emptyMessage,\n searchLabel,\n onSearch,\n initialSearch = '',\n onSearchTermChange,\n searchDisabled = false,\n searchDebounceTime = 400,\n searchMinLength = 1,\n searchAtStart = false,\n sort,\n onSortChange,\n pagination,\n initialClientPagination,\n onClientPaginationChange,\n toolbarSlot,\n footerActionsSlot,\n filterValues,\n onFilterValuesChange,\n toolbarStartSlot,\n bodyTopRow,\n onFilteredCountChange,\n viewMode: controlledViewMode,\n onViewModeChange,\n columnTogglePlacement = 'header',\n cardsInfiniteScroll,\n hideViewToggle = false,\n layout = 'page',\n dense: denseProp = false,\n spacious = false,\n commitStatuses,\n}: IDataTableProps<T, C>) => {\n const { t } = useTranslation('ui');\n\n const isFit = layout === 'fit';\n const dense = !spacious && (isFit || denseProp);\n const editingRows = configProp.editing?.rows;\n const showAddRow = !!editingRows?.canAdd && !!editingRows.onAddRow;\n\n const hostFillCells = configProp.spreadsheet ? configProp.spreadsheet.fill?.onFillCells : undefined;\n const isUndoEnabled = !!configProp.editing?.onCellChange && configProp.editing.undo !== false;\n const { recordedOnCellChange, recordedOnFillCells, handleUndoShortcut } = useDataTableUndoHistory<T>({\n enabled: isUndoEnabled,\n rows,\n columns: configProp.columns,\n onCellChange: configProp.editing?.onCellChange,\n onFillCells: hostFillCells,\n });\n\n const configWithUndo = useMemo<IDataTableConfig<T, C>>(() => {\n if (!isUndoEnabled || !configProp.editing) return configProp;\n\n const spreadsheetConfig = configProp.spreadsheet;\n return {\n ...configProp,\n editing: { ...configProp.editing, onCellChange: recordedOnCellChange },\n spreadsheet:\n spreadsheetConfig && spreadsheetConfig.fill?.onFillCells\n ? { ...spreadsheetConfig, fill: { ...spreadsheetConfig.fill, onFillCells: recordedOnFillCells } }\n : spreadsheetConfig,\n };\n }, [configProp, isUndoEnabled, recordedOnCellChange, recordedOnFillCells]);\n\n // When `editing.rows.onRemoveRow` is set, append a synthetic trailing actions\n // column carrying a per-row delete control. It is a real `actions` column, so\n // it flows through the existing sizing / sticky-right / flex-exclusion / order\n // paths unchanged (see useColumnOrder: actions columns are pinned to the end).\n const config = useMemo<IDataTableConfig<T, C>>(() => {\n if (!editingRows?.onRemoveRow) return configWithUndo;\n\n const removeColumn: IDataTableColumnConfig<T> = {\n id: DATA_TABLE_REMOVE_COLUMN_ID,\n header: '',\n type: 'actions',\n hideable: false,\n resizable: false,\n actions: [\n {\n key: 'remove',\n label: t('dataTable.removeRow'),\n icon: 'delete',\n danger: true,\n hidden: (row) => (editingRows.canRemove ? !editingRows.canRemove(row) : false),\n onClick: (row) => editingRows.onRemoveRow?.(row),\n },\n ],\n };\n\n return { ...configWithUndo, columns: [...configWithUndo.columns, removeColumn] };\n }, [configWithUndo, editingRows, t]);\n\n const { columnVisibility, onColumnVisibilityChange } = useColumnVisibility(config);\n const { columnOrder, onColumnOrderChange, resetColumnOrder } = useColumnOrder(config);\n const { columnSizing, onColumnSizingChange, resetColumnSizing } = useColumnSizing(config);\n\n // Every table restores the persisted column order back to the config default\n // on mount (equivalent to firing \"Restaurar ordem padrão\" from the columns\n // menu), so a stale/incompatible persisted order never sticks. Does not touch\n // column widths or visibility, and does not affect the Cards view.\n useEffect(() => {\n resetColumnOrder();\n }, []);\n\n const detailExpansionColumns =\n config.expansion && isDataTableDetailTableExpansion(config.expansion) && Array.isArray(config.expansion.columns)\n ? config.expansion.columns\n : null;\n const { detailColumnVisibility, toggleDetailColumn } = useDetailColumnVisibility(\n config.entityKey,\n detailExpansionColumns,\n );\n const { detailColumnOrder, onDetailColumnOrderChange, resetDetailColumnOrder } = useDetailColumnOrder(\n config.entityKey,\n detailExpansionColumns,\n );\n\n const detailColumnsState: IDataTableDetailColumnsState | undefined = detailExpansionColumns\n ? {\n visibility: detailColumnVisibility,\n toggleVisibility: toggleDetailColumn,\n order: detailColumnOrder,\n onOrderChange: onDetailColumnOrderChange,\n resetOrder: resetDetailColumnOrder,\n }\n : undefined;\n\n const { isMobile } = useBreakpoint();\n\n const hasCardView = !!config.renderCard;\n const hasGroupedView = !!config.renderGroupedBody;\n const hasKanbanView = !!config.renderKanbanBody;\n // Fixed behaviour: card-capable tables always open on Cards (first), Lista second.\n // The toggle switches within the session and resets to Cards on remount, unless\n // the host controls the mode via the `viewMode` prop (e.g. persisted preference).\n const [internalViewMode, setInternalViewMode] = useState<TDataTableViewMode>('cards');\n const viewMode = controlledViewMode ?? internalViewMode;\n\n const [isBulkEditOpen, setIsBulkEditOpen] = useState(false);\n\n const handleViewModeChange = (mode: TDataTableViewMode) => {\n if (controlledViewMode === undefined) setInternalViewMode(mode);\n onViewModeChange?.(mode);\n };\n\n const {\n table,\n isClientMode,\n columnContentWidths,\n registerRow,\n beginRowsExit,\n visibleRows,\n activeTab,\n tabs,\n handleTabChange,\n handleSearchInput,\n handleHeaderSortClick,\n resolveSortDirection,\n clientPaginationProps,\n showUpdatingBar,\n contentOpacityStyle,\n dataTableOpacityTransitionClass,\n showSkeleton,\n hasRows,\n clientSearchDebounceMs,\n } = useDataTableInstance({\n config,\n rows,\n loading,\n sort,\n onSortChange,\n onSearch,\n initialSearch,\n onSearchTermChange,\n pagination,\n initialClientPagination,\n onClientPaginationChange,\n columnVisibility,\n onColumnVisibilityChange,\n columnOrder,\n onColumnOrderChange,\n columnSizing,\n onColumnSizingChange,\n onFilteredCountChange,\n });\n\n const columnConfigById = useMemo(\n () => new Map(config.columns.map((columnConfig) => [columnConfig.id, columnConfig])),\n [config.columns],\n );\n\n // Under `table-fixed` one column absorbs leftover horizontal space. The last\n // visible non-actions, non-badge, non-first column is the flex column.\n const visibleLeafColumns = table.getVisibleLeafColumns();\n const flexColumnId = useMemo(() => {\n if (config.flexColumnId && visibleLeafColumns.some((leafColumn) => leafColumn.id === config.flexColumnId)) {\n return config.flexColumnId;\n }\n\n const candidates = visibleLeafColumns.filter((leafColumn, index) => {\n if (index === 0) return false;\n const type = columnConfigById.get(leafColumn.id)?.type;\n return type !== 'actions' && !isBadgeColumnType(type);\n });\n return candidates[candidates.length - 1]?.id ?? null;\n }, [visibleLeafColumns, columnConfigById, config.flexColumnId]);\n\n // `table-fixed` sizes columns from the table width, so the table must be at\n // least the sum of ALL column widths (including the absorber's seed) for their\n // widths to be honored; below that the browser shrinks them proportionally.\n // `min-w-full` still lets the table stretch to fill the container, and the\n // auto-width absorber soaks the surplus (never shrinking below its own seed,\n // because its seed is part of this total).\n const totalTableWidth = useMemo(\n () => visibleLeafColumns.reduce((sum, leafColumn) => sum + leafColumn.getSize(), 0),\n [visibleLeafColumns, columnSizing],\n );\n\n // ----- Spreadsheet layer -----\n // Toda tabela com coluna editável ganha a camada de planilha sem configuração, ativa\n // desde a montagem. Numa tabela com `onRowClick` a célula editável é dona do próprio\n // clique (abre o editor) e o resto da linha continua abrindo o registro.\n const spreadsheet = useMemo<IDataTableSpreadsheetConfig<T> | undefined>(() => {\n if (config.spreadsheet === false) return undefined;\n return config.spreadsheet ?? { selection: 'range', fill: {} };\n }, [config.spreadsheet]);\n\n const hasEditableColumns = useMemo(\n () => !!config.editing?.onCellChange && config.columns.some((columnConfig) => !!columnConfig.editable),\n [config.editing, config.columns],\n );\n\n const editModeBehavior = spreadsheet?.mode ?? 'always';\n const gridEnabled = !!spreadsheet && (hasEditableColumns || !!config.spreadsheet);\n\n const gridStore = useGridInstance({\n spreadsheet,\n enabled: gridEnabled,\n startsInEditMode: editModeBehavior === 'always',\n });\n\n const isEditMode = useGridEditMode(gridStore);\n const showEditModeToggle = gridEnabled && editModeBehavior === 'toggle';\n\n // Below the tablet edge a real table is unreadable: even the narrowest column\n // set overflows and the user reads it through a horizontal scrollbar. Cards are\n // the readable shape there, so the narrow viewport takes over the choice.\n // Excluded: `fit` layouts without a bespoke card (their cell geometry IS the\n // feature) and a table whose reason to exist is editing. Merely being able to edit\n // is not enough: a table that opens a record on row click is a reading surface\n // first, unless the user turned its edit toggle on. A `fit` table that ships\n // `renderCard` opted into a narrow shape, so it takes over as well.\n const isEditingSurface = isEditMode && (editModeBehavior === 'toggle' || !config.onRowClick);\n const forceCardsOnMobile = isMobile && (!isFit || hasCardView) && !isEditingSurface;\n\n const isGroupedView = hasGroupedView && viewMode === 'grouped';\n const isKanbanView = hasKanbanView && viewMode === 'kanban';\n // Grouped and kanban both hand the whole body to the host, so everything the\n // table draws around a real row list is off in either of them.\n const isDelegatedView = isGroupedView || isKanbanView;\n const isCardsView = hasCardView && (viewMode === 'cards' || (forceCardsOnMobile && !isDelegatedView));\n const useAutoCards = forceCardsOnMobile && !hasCardView && !isDelegatedView;\n\n useEffect(() => {\n if (!gridStore || !commitStatuses) return;\n gridStore.getState().setCellStatuses(commitStatuses);\n }, [gridStore, commitStatuses]);\n\n const navigableColumnIds = useMemo(\n () =>\n visibleLeafColumns\n .filter((leafColumn) => columnConfigById.get(leafColumn.id)?.type !== 'actions')\n .map((leafColumn) => leafColumn.id),\n [visibleLeafColumns, columnConfigById],\n );\n const gridRowIds = useMemo(() => visibleRows.map((row) => row.id), [visibleRows]);\n\n useGridMatrixSync(gridStore, gridRowIds, navigableColumnIds);\n\n // Read through a ref so the callback stays stable while the rows change on\n // every edit: an unstable handler would re-bind the grid keyboard each render.\n const visibleRowsRef = useRef(visibleRows);\n visibleRowsRef.current = visibleRows;\n\n const canEditCell = useCallback(\n ({ rowId, columnId }: IGridCellCoord) => {\n if (!config.editing?.onCellChange) return false;\n\n const editable = columnConfigById.get(columnId)?.editable;\n if (!editable) return false;\n\n const row = visibleRowsRef.current.find((candidate) => candidate.id === rowId);\n if (!row) return false;\n\n return !(editable.disabled?.(row.original) ?? false);\n },\n [config.editing, columnConfigById],\n );\n\n const acceptsTypedValue = useCallback(\n ({ columnId }: IGridCellCoord) => {\n const editable = columnConfigById.get(columnId)?.editable;\n if (!editable || editable.renderEditor) return false;\n\n return editable.type === 'text' || editable.type === 'number';\n },\n [columnConfigById],\n );\n\n const handleGridKeyDown = useGridKeyboard({\n store: gridStore,\n canEditCell: hasEditableColumns ? canEditCell : undefined,\n acceptsTypedValue,\n onSave: spreadsheet?.onSave,\n });\n\n const handleFillCommit = useGridFillApply<T>({\n visibleRows,\n columnConfigById,\n spreadsheet,\n onCellChange: config.editing?.onCellChange,\n });\n\n // After an undo in the spreadsheet grid the restored cell becomes the active one, so\n // the user sees which cell changed, even when it sits on another row of the page.\n const handleTableKeyDown = useCallback(\n (event: KeyboardEvent<HTMLDivElement>) => {\n const restoredCell = handleUndoShortcut(event);\n if (!restoredCell || !gridStore || !gridStore.getState().isEditMode) return;\n\n const restoredGridRow = visibleRowsRef.current.find((candidate) => candidate.original.id === restoredCell.row.id);\n if (!restoredGridRow) return;\n gridStore.getState().setActiveCell({ rowId: restoredGridRow.id, columnId: restoredCell.columnId });\n },\n [handleUndoShortcut, gridStore],\n );\n\n const handleEditModeToggle = useCallback(() => {\n const store = gridStore;\n if (!store) return;\n store.getState().setEditMode(!store.getState().isEditMode);\n }, [gridStore]);\n\n const cardsScrollRef = useRef<HTMLDivElement | null>(null);\n const cardsSentinelRef = useRef<HTMLDivElement | null>(null);\n const cardsLoadMore = cardsInfiniteScroll?.loadMore;\n const cardsHasMore = cardsInfiniteScroll?.hasMore ?? false;\n\n // Cards infinite scroll: load the next page when the bottom sentinel nears the edge of whatever\n // scrolls the cards. `loadMore` is stable and self-guards while a page is in flight; re-running\n // on row count rebinds the observer after each append, when the scroll root may have changed.\n useEffect(() => {\n if (!isCardsView || !cardsHasMore || !cardsLoadMore) return;\n\n const cardsBox = cardsScrollRef.current;\n const sentinel = cardsSentinelRef.current;\n if (!cardsBox || !sentinel) return;\n\n const observer = new IntersectionObserver(\n (entries) => {\n if (entries.some((entry) => entry.isIntersecting)) cardsLoadMore();\n },\n { root: findCardsScrollRoot(cardsBox), rootMargin: CARDS_LOAD_MORE_MARGIN },\n );\n observer.observe(sentinel);\n\n return () => observer.disconnect();\n }, [isCardsView, cardsHasMore, cardsLoadMore, visibleRows.length]);\n\n const listScrollRef = useRef<HTMLDivElement | null>(null);\n const [detailSlotWidth, setDetailSlotWidth] = useState<number | undefined>(undefined);\n const [parentHasHorizontalOverflow, setParentHasHorizontalOverflow] = useState(false);\n\n // Track the list scrollport: its clientWidth sizes the detail panel to the\n // visible area (detailTable expansion), and its horizontal overflow toggles the\n // frozen actions-column shadow (shown only while columns scroll under it, so\n // there is no always-on divider line otherwise). Observing the inner table too\n // keeps both in sync when columns are toggled or the layout reflows. The\n // branch-state deps re-bind when the scroller remounts (view/skeleton/error/\n // empty transitions swap the rendered subtree).\n useEffect(() => {\n const scroller = listScrollRef.current;\n if (!scroller) return undefined;\n\n const measure = () => {\n setDetailSlotWidth(scroller.clientWidth || undefined);\n setParentHasHorizontalOverflow(scroller.scrollWidth > scroller.clientWidth + 1);\n };\n measure();\n\n const observer = new ResizeObserver(measure);\n observer.observe(scroller);\n const parentTable = scroller.querySelector('table');\n if (parentTable) observer.observe(parentTable);\n\n return () => observer.disconnect();\n }, [isCardsView, isDelegatedView, showSkeleton, error, hasRows]);\n\n const renderBody = () => {\n // Grouped view delegates the whole body to the host (it owns fetching,\n // accordions, loading and empty states for each group).\n if (isGroupedView && config.renderGroupedBody) return config.renderGroupedBody();\n if (isKanbanView && config.renderKanbanBody) return config.renderKanbanBody();\n\n if (showSkeleton)\n return isCardsView ? (\n <DataTableCardsSkeletonState cardClassName={config.cardSkeletonClassName} />\n ) : (\n <DataTableSkeletonState rows={config.skeletonRows} />\n );\n\n if (error) return <DataTableErrorState onRetry={onRetry} errorCause={errorCause} />;\n\n // A `bodyTopRow` (e.g. an inline create editor) must stay visible even with\n // zero data rows, so it takes precedence over the empty state.\n if (!hasRows && !bodyTopRow) {\n if (isFit) {\n // Embedded/editor context: skip the full illustration so surrounding\n // controls (e.g. the add-row button) stay visible in a compact dialog.\n return emptyMessage ? (\n <div className=\"py-6 text-center text-sm text-foreground-faint\">{emptyMessage}</div>\n ) : null;\n }\n return <DataTableEmptyState emptyMessage={emptyMessage} />;\n }\n\n if (isCardsView && config.renderCard) {\n // Cards render from the SAME visible rows the table uses (already searched,\n // filtered, sorted and paginated), so both views share one source. No grid:\n // flex-wrap keeps the layout responsive per the project's no-CSS-grid rule.\n return (\n <div ref={cardsScrollRef} className=\"relative min-h-0 flex-1 overflow-y-auto @container\">\n {showUpdatingBar && (\n <div className=\"absolute inset-x-0 top-0 z-10 h-0.5 animate-pulse bg-brand-hover\" aria-hidden />\n )}\n {/* Cards têm largura fixa, então uma faixa estreita demais para duas colunas\n deixa a sobra toda de um lado. Abaixo disso eles se centram; a partir de\n duas colunas o alinhamento à esquerda volta a ser o que lê melhor. */}\n <div\n className={classNames(\n 'flex flex-wrap justify-center gap-4 @md:justify-start',\n dataTableOpacityTransitionClass,\n config.cardGridClassName,\n )}\n style={contentOpacityStyle}\n >\n {visibleRows\n .filter((row) => row.depth === 0)\n .map((row) => (\n <Fragment key={row.id}>{config.renderCard?.(row.original)}</Fragment>\n ))}\n </div>\n\n {cardsInfiniteScroll?.loadingMore && (\n <div className=\"flex justify-center py-4\">\n <LoadingSpinner size={6} />\n </div>\n )}\n\n {cardsHasMore && <div ref={cardsSentinelRef} className=\"h-px w-full\" aria-hidden />}\n </div>\n );\n }\n\n // Narrow viewport with no bespoke card renderer: stack each row into a card\n // derived from the same columns, so the list stays readable without the host\n // authoring a second renderer.\n if (useAutoCards) {\n return (\n <div className=\"flex min-h-0 flex-1 flex-col gap-2 overflow-y-auto\">\n {visibleRows\n .filter((row) => row.depth === 0)\n .map((row) => (\n <DataTableAutoCard key={row.id} row={row} columnConfigById={columnConfigById} />\n ))}\n </div>\n );\n }\n\n // The table scrolls inside this bounded region (flex-1 + min-h-0). The sticky\n // header pins to the top of the data area; the region also scrolls horizontally\n // so columns keep a minimum readable width instead of being crushed. The first\n // column and the actions column are frozen (sticky left/right) so navigation\n // anchors stay visible while the middle columns scroll past.\n return (\n <div\n ref={listScrollRef}\n onKeyDown={gridStore ? handleGridKeyDown : undefined}\n className={classNames(\n 'relative [&::-webkit-scrollbar-thumb]:rounded-full [&::-webkit-scrollbar-thumb]:bg-border-emphasis hover:[&::-webkit-scrollbar-thumb]:bg-foreground-faint [&::-webkit-scrollbar-track]:bg-transparent [&::-webkit-scrollbar]:h-2.5 [&::-webkit-scrollbar]:w-2.5',\n // The rows scroll inside this bounded region (flex-1 + min-h-0), so the\n // host provides the height (a full page, or a bounded flex parent like a\n // fixed-size dialog) and the add-row/footer below stay pinned outside it.\n 'min-h-0 flex-1 overflow-auto',\n )}\n >\n {showUpdatingBar && (\n <div className=\"absolute inset-x-0 top-0 z-10 h-0.5 animate-pulse bg-brand-hover\" aria-hidden />\n )}\n <table\n role={gridStore ? 'grid' : undefined}\n aria-multiselectable={gridStore && spreadsheet?.selection === 'range' ? true : undefined}\n className={classNames(\n // `table-fixed`: column widths come exclusively from the colgroup so\n // user resizes are honored exactly (under `table-auto` the browser\n // ignores explicit col widths and sizes by content). The slack\n // absorber (auto-width col) still soaks any leftover space.\n 'min-w-full table-fixed border-separate border-spacing-0 rounded-md border-y border-border-subtle',\n dataTableOpacityTransitionClass,\n )}\n style={{ ...contentOpacityStyle, width: totalTableWidth || undefined }}\n >\n <DataTableHead\n table={table}\n columns={config.columns}\n columnConfigById={columnConfigById}\n columnContentWidths={columnContentWidths}\n columnOrder={columnOrder}\n onColumnOrderChange={onColumnOrderChange}\n resetColumnOrder={resetColumnOrder}\n resetColumnSizing={resetColumnSizing}\n onHeaderSortClick={handleHeaderSortClick}\n resolveSortDirection={resolveSortDirection}\n hideColumnToggle={columnTogglePlacement !== 'header'}\n flexColumnId={flexColumnId}\n showActionsShadow={parentHasHorizontalOverflow}\n dense={dense}\n spacious={spacious}\n />\n\n <DataTableBody\n config={config}\n visibleRows={visibleRows}\n columnConfigById={columnConfigById}\n columnContentWidths={columnContentWidths}\n registerRow={registerRow}\n onCollapseStart={beginRowsExit}\n detailColumnsState={detailColumnsState}\n detailSlotWidth={detailSlotWidth}\n showActionsShadow={parentHasHorizontalOverflow}\n dense={dense}\n spacious={spacious}\n fillEnabled={!!spreadsheet?.fill}\n editMode={isEditMode}\n canEditCell={canEditCell}\n bodyTopRow={bodyTopRow}\n bodyTopRowColSpan={table.getVisibleLeafColumns().length}\n />\n </table>\n </div>\n );\n };\n\n // Cards normally page themselves through infinite scroll, so the pager is\n // hidden. When the narrow viewport takes the choice over, the host is still in\n // list mode and its `cardsInfiniteScroll` is not wired: without the pager the\n // user would be stranded on the first page.\n const isMobileCardsTakeover = isCardsView && viewMode !== 'cards' && !cardsInfiniteScroll;\n\n const showPagination =\n (!isCardsView || isMobileCardsTakeover) &&\n !isDelegatedView &&\n !!clientPaginationProps &&\n !showSkeleton &&\n !error &&\n hasRows &&\n clientPaginationProps.numberOfPages > 0 &&\n !(clientPaginationProps.numberOfPages === 1 && clientPaginationProps.pageSize <= DATA_TABLE_MIN_PAGE_SIZE);\n\n // The toolbar only skeletons on the very first load: a refetch (tab switch,\n // filter, search) keeps the real controls mounted, so the search term and the\n // focus survive and the row never changes height.\n const [hasLoadedOnce, setHasLoadedOnce] = useState(!loading);\n\n useEffect(() => {\n if (!loading) setHasLoadedOnce(true);\n }, [loading]);\n\n const showSearch = (!!onSearch || isClientMode) && config.searchable !== false;\n const showToolbar =\n (tabs?.length ?? 0) > 0 ||\n hasCardView ||\n showSearch ||\n !!toolbarSlot ||\n !!toolbarStartSlot ||\n columnTogglePlacement === 'toolbar';\n\n const columnToggleSlot =\n columnTogglePlacement === 'toolbar' ? (\n <DataTableColumnToggle\n table={table}\n columns={config.columns}\n columnOrder={columnOrder}\n onColumnOrderChange={onColumnOrderChange}\n resetColumnOrder={resetColumnOrder}\n resetColumnSizing={resetColumnSizing}\n variant=\"toolbar\"\n />\n ) : undefined;\n\n // O rodapé é o lugar dos controles da própria tabela (colunas e modo de edição),\n // ao lado da paginação. Ambos só existem sobre uma lista real.\n const showTableControls = !isCardsView && !isDelegatedView && !showSkeleton && !error && hasRows;\n const showFooterColumnToggle = columnTogglePlacement === 'footer' && showTableControls;\n const showFooterEditToggle = showEditModeToggle && showTableControls;\n\n // A edição em massa não depende do modo de exibição: em cards ela é a única\n // forma de editar, já que não existe célula para clicar.\n const showBulkEdit =\n hasEditableColumns && !!spreadsheet?.fill?.onFillCells && !isDelegatedView && !showSkeleton && !error && hasRows;\n\n const showFooterControls = showFooterColumnToggle || showFooterEditToggle || showBulkEdit || !!footerActionsSlot;\n const bulkEditRows = useMemo(\n () => visibleRows.filter((row) => row.depth === 0).map((row) => row.original),\n [visibleRows],\n );\n\n const activeFiltersBar =\n config.filters && filterValues && onFilterValuesChange ? (\n <ActiveFiltersBar\n fields={config.filters.fields ?? []}\n values={filterValues}\n onRemove={(key) =>\n onFilterValuesChange({\n ...filterValues,\n [key]: emptyValueForKind((config.filters?.fields ?? []).find((field) => field.key === key)?.kind ?? 'text'),\n })\n }\n onClearAll={() => onFilterValuesChange(buildEmptyFilterValues(config.filters?.fields ?? []))}\n />\n ) : null;\n\n const content = (\n <div\n className=\"flex min-h-0 w-full flex-1 flex-col gap-4\"\n onKeyDown={isUndoEnabled ? handleTableKeyDown : undefined}\n >\n {activeFiltersBar}\n {showToolbar && (\n <DataTableToolbar\n tabs={tabs}\n activeTab={activeTab}\n onTabChange={handleTabChange}\n showViewToggle={hasCardView && !hideViewToggle && !forceCardsOnMobile}\n showGroupedView={hasGroupedView}\n showKanbanView={hasKanbanView}\n viewMode={viewMode}\n onViewModeChange={handleViewModeChange}\n showSearch={showSearch}\n searchLabel={searchLabel}\n initialSearch={initialSearch}\n searchDisabled={searchDisabled}\n searchDebounceTime={isClientMode ? clientSearchDebounceMs : searchDebounceTime}\n searchMinLength={searchMinLength}\n searchAtStart={searchAtStart}\n onSearchInput={handleSearchInput}\n toolbarSlot={toolbarSlot}\n toolbarStartSlot={toolbarStartSlot}\n columnToggleSlot={columnToggleSlot}\n showSkeleton={loading && !hasLoadedOnce}\n />\n )}\n\n <div key={viewMode} className=\"flex min-h-0 flex-1 animate-fade-in flex-col\">\n {renderBody()}\n </div>\n\n {showAddRow && (\n // Sibling of the scrolling rows region, so it stays pinned below the grid\n // (outside its scroll) — the rows scroll, this control does not move.\n <div className=\"flex\">\n <ControlledButton\n variant=\"outlined\"\n className=\"flex items-center gap-1.5\"\n onClick={() => editingRows?.onAddRow?.()}\n >\n <MaterialSymbol icon=\"add\" size={16} />\n {t('dataTable.addRow')}\n </ControlledButton>\n </div>\n )}\n\n {(showFooterControls || showPagination) && (\n <div className=\"flex items-center justify-between gap-4\">\n {showFooterControls && (\n <div className=\"flex flex-wrap items-center gap-2 pb-3\">\n {showFooterColumnToggle && (\n <DataTableColumnToggle\n table={table}\n columns={config.columns}\n columnOrder={columnOrder}\n onColumnOrderChange={onColumnOrderChange}\n resetColumnOrder={resetColumnOrder}\n resetColumnSizing={resetColumnSizing}\n variant=\"toolbar\"\n tooltipPlacement={FOOTER_CONTROL_TOOLTIP_PLACEMENT}\n />\n )}\n {showFooterEditToggle && (\n <DataTableEditModeButton\n active={isEditMode}\n onToggle={handleEditModeToggle}\n tooltipPlacement={FOOTER_CONTROL_TOOLTIP_PLACEMENT}\n />\n )}\n {showBulkEdit && (\n <DataTableBulkEditButton\n onClick={() => setIsBulkEditOpen(true)}\n tooltipPlacement={FOOTER_CONTROL_TOOLTIP_PLACEMENT}\n />\n )}\n {footerActionsSlot}\n </div>\n )}\n\n {showPagination && (\n <div className=\"flex-1\">\n <DataTablePaginationBar\n pageSize={clientPaginationProps.pageSize}\n numberOfPages={clientPaginationProps.numberOfPages}\n currentPage={clientPaginationProps.currentPage}\n setCurrentPage={clientPaginationProps.setCurrentPage}\n onPageSizeChange={clientPaginationProps.onPageSizeChange}\n totalItems={clientPaginationProps.totalItems}\n />\n </div>\n )}\n </div>\n )}\n\n {showBulkEdit && (\n <DataTableBulkEditDialog\n open={isBulkEditOpen}\n onClose={() => setIsBulkEditOpen(false)}\n columns={config.columns}\n rows={bulkEditRows}\n getRowLabel={config.getRowLabel}\n onApply={(changes) => spreadsheet?.fill?.onFillCells?.(changes)}\n />\n )}\n </div>\n );\n\n // Os providers ficam por fora do conteúdo já montado: abrir ou fechar uma célula re-renderiza\n // apenas as células editáveis, não a tabela inteira.\n const editableContent = config.editing?.clickToEdit ? (\n <DataTableCellEditingProvider>{content}</DataTableCellEditingProvider>\n ) : (\n content\n );\n\n if (!gridStore) return editableContent;\n\n return (\n <GridProvider\n store={gridStore}\n gridAreaRef={listScrollRef}\n canEditCell={canEditCell}\n onFillCommit={handleFillCommit}\n >\n {editableContent}\n </GridProvider>\n );\n};\n\nexport default DataTable;\n"],"names":["DataTablePaginationBar"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwD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AAA,YAChB,MAAM;AAAA,YACN,aAAa,OAAO;AAAA,YACpB,SAAS,CAAC,YAAY,aAAa,MAAM,cAAc,OAAO;AAAA,UAAA;AAAA,QAAA;AAAA,MAChE;AAAA,IAAA;AAAA,EAAA;AAON,QAAM,kBAAkB,OAAO,SAAS,cACtC,oBAAC,8BAAA,EAA8B,mBAAQ,IAEvC;AAGF,MAAI,CAAC,UAAW,QAAO;AAEvB,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,OAAO;AAAA,MACP,aAAa;AAAA,MACb;AAAA,MACA,cAAc;AAAA,MAEb,UAAA;AAAA,IAAA;AAAA,EAAA;AAGP;"}
@@ -18,14 +18,14 @@ import "date-fns";
18
18
  import "date-fns/locale";
19
19
  import "react-day-picker";
20
20
  import "../ControlledPopover.js";
21
- import "../../DateTime/dateInputHelpers.js";
22
- import "react-day-picker/style.css";
23
- import "../../DateTime/DateRangePicker.js";
24
21
  import "react-infinite-scroll-component";
25
22
  import "react-window";
26
23
  import UnifiedSearchBar from "../../Search/UnifiedSearchBar.js";
27
24
  import NoDataFound from "../NoDataFound/index.js";
28
25
  /* empty css */
26
+ import "../../DateTime/dateInputHelpers.js";
27
+ import "react-day-picker/style.css";
28
+ import "../../DateTime/DateRangePicker.js";
29
29
  import "../../Search/filters/FiltersButton.js";
30
30
  import "../../../helpers/utilityHelpers.js";
31
31
  import "../../Form/ControlledDialog.js";
@@ -16,13 +16,13 @@ import "date-fns";
16
16
  import "date-fns/locale";
17
17
  import "react-day-picker";
18
18
  import "../ControlledPopover.js";
19
- import "../../DateTime/dateInputHelpers.js";
20
- import "react-day-picker/style.css";
21
- import "../../DateTime/DateRangePicker.js";
22
19
  import "react-infinite-scroll-component";
23
20
  import "react-window";
24
21
  import "../NoDataFound/index.js";
25
22
  /* empty css */
23
+ import "../../DateTime/dateInputHelpers.js";
24
+ import "react-day-picker/style.css";
25
+ import "../../DateTime/DateRangePicker.js";
26
26
  import "../../Search/filters/FiltersButton.js";
27
27
  import "../../../helpers/utilityHelpers.js";
28
28
  import FiltersPanel from "../../Search/filters/FiltersPanel.js";
@@ -17,14 +17,14 @@ import "date-fns";
17
17
  import "date-fns/locale";
18
18
  import "react-day-picker";
19
19
  import "../ControlledPopover.js";
20
- import "../../DateTime/dateInputHelpers.js";
21
- import "react-day-picker/style.css";
22
- import "../../DateTime/DateRangePicker.js";
23
20
  import "react-infinite-scroll-component";
24
21
  import "react-window";
25
22
  import UnifiedSearchBar from "../../Search/UnifiedSearchBar.js";
26
23
  import "../NoDataFound/index.js";
27
24
  /* empty css */
25
+ import "../../DateTime/dateInputHelpers.js";
26
+ import "react-day-picker/style.css";
27
+ import "../../DateTime/DateRangePicker.js";
28
28
  import SkeletonLoading from "../SkeletonLoading.js";
29
29
  import "../../Search/filters/FiltersButton.js";
30
30
  import "../../../helpers/utilityHelpers.js";
@@ -17,13 +17,13 @@ import "date-fns";
17
17
  import "date-fns/locale";
18
18
  import "react-day-picker";
19
19
  import "../ControlledPopover.js";
20
- import "../../DateTime/dateInputHelpers.js";
21
- import "react-day-picker/style.css";
22
- import "../../DateTime/DateRangePicker.js";
23
20
  import "react-infinite-scroll-component";
24
21
  import "react-window";
25
22
  import "../NoDataFound/index.js";
26
23
  /* empty css */
24
+ import "../../DateTime/dateInputHelpers.js";
25
+ import "react-day-picker/style.css";
26
+ import "../../DateTime/DateRangePicker.js";
27
27
  import "../../Search/filters/FiltersButton.js";
28
28
  import "../../../helpers/utilityHelpers.js";
29
29
  import "../../Form/ControlledDialog.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umodeapporg/ui",
3
- "version": "0.34.0",
3
+ "version": "0.34.2",
4
4
  "license": "UNLICENSED",
5
5
  "type": "module",
6
6
  "sideEffects": [