From dc00550d17d8d3a41269d4f4d903c2b6722d657c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?La=C3=ADs=20Fray=20Ribeiro?= Date: Wed, 6 Nov 2024 11:50:28 -0300 Subject: [PATCH] fix(data-picker): change to id from groupProps not override id from field context changes the way the id is handled internally so that the id that comes from the useDatePicker hook does not overwrite the one that comes from the field context or externally. Instead, the hook will receive these other ids for correct operation fix #2039 for dataPicker --- .../shoreline/src/components/date-picker/date-picker.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/shoreline/src/components/date-picker/date-picker.tsx b/packages/shoreline/src/components/date-picker/date-picker.tsx index 7f23c45a4..8114da12a 100644 --- a/packages/shoreline/src/components/date-picker/date-picker.tsx +++ b/packages/shoreline/src/components/date-picker/date-picker.tsx @@ -32,8 +32,6 @@ export function DatePicker(props: DatePickerProps) { const state = useDatePickerState(domProps) const ref = useRef(null) const anchorRef = useRef(null) - const { groupProps, labelProps, fieldProps, buttonProps, calendarProps } = - useDatePicker(domProps, state, ref) const store = useFieldContext() const { id: contextId, error: contextError } = useStore(store, (s) => s) @@ -41,6 +39,9 @@ export function DatePicker(props: DatePickerProps) { const id = defaultId || contextId const error = defaultError || contextError + const { groupProps, labelProps, fieldProps, buttonProps, calendarProps } = + useDatePicker({ ...domProps, id }, state, ref) + return (