Skip to content

Commit 0d1dcd7

Browse files
authored
refactor(sanity): Move date inputs UI Components to ui-components (#7410)
* refactor(sanity): move base components from form/inputs/DateInputs to ui-components * refactor(sanity): update the imports
1 parent 6fdfcac commit 0d1dcd7

File tree

18 files changed

+14
-13
lines changed

18 files changed

+14
-13
lines changed

packages/sanity/src/core/form/inputs/DateInputs/CommonDateTimeInput.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ import {
1212
useState,
1313
} from 'react'
1414

15+
import {type CalendarLabels} from '../../../../ui-components/inputs/DateInputs/calendar/types'
16+
import {DateTimeInput} from '../../../../ui-components/inputs/DateInputs/DateTimeInput'
1517
import {useTranslation} from '../../../i18n/hooks/useTranslation'
16-
import {type CalendarLabels} from './base/calendar/types'
17-
import {DateTimeInput} from './base/DateTimeInput'
1818
import {type ParseResult} from './types'
1919

2020
export interface CommonDateTimeInputProps {

packages/sanity/src/core/form/inputs/DateInputs/DateInput.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import {DEFAULT_DATE_FORMAT, format, parse} from '@sanity/util/legacyDateFormat'
22
import {useCallback, useMemo} from 'react'
33

4+
import {type CalendarLabels} from '../../../../ui-components/inputs/DateInputs/calendar/types'
45
import {useTranslation} from '../../../i18n'
56
import {set, unset} from '../../patch'
67
import {type StringInputProps} from '../../types'
7-
import {type CalendarLabels} from './base/calendar/types'
88
import {CommonDateTimeInput} from './CommonDateTimeInput'
99
import {getCalendarLabels} from './utils'
1010

packages/sanity/src/core/form/inputs/DateInputs/DateTimeInput.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ import {
77
import {getMinutes, parseISO, setMinutes} from 'date-fns'
88
import {useCallback, useMemo} from 'react'
99

10+
import {type CalendarLabels} from '../../../../ui-components/inputs/DateInputs/calendar/types'
1011
import {useTranslation} from '../../../i18n'
1112
import {set, unset} from '../../patch'
1213
import {type StringInputProps} from '../../types'
13-
import {type CalendarLabels} from './base/calendar/types'
1414
import {CommonDateTimeInput} from './CommonDateTimeInput'
1515
import {type ParseResult} from './types'
1616
import {getCalendarLabels, isValidDate} from './utils'

packages/sanity/src/core/form/inputs/DateInputs/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {type CalendarLabels} from './base/calendar/types'
1+
import {type CalendarLabels} from '../../../../ui-components/inputs/DateInputs/calendar/types'
22

33
export function isValidDate(date: Date): boolean {
44
return date instanceof Date && !isNaN(date.valueOf())

packages/sanity/src/core/scheduledPublishing/components/dateInputs/base/DateTimeInput.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import {
2020
import FocusLock from 'react-focus-lock'
2121

2222
import {Popover} from '../../../../../ui-components'
23-
import {LazyTextInput} from '../../../../form/inputs/DateInputs/base/LazyTextInput'
23+
import {LazyTextInput} from '../../../../../ui-components/inputs/DateInputs/LazyTextInput'
2424
import {DatePicker} from './DatePicker'
2525

2626
type Props = {

packages/sanity/src/core/scheduledPublishing/components/dateInputs/base/calendar/YearInput.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {type ChangeEvent, type ComponentProps, type FocusEvent, useCallback} from 'react'
22

3-
import {LazyTextInput} from '../../../../../form/inputs/DateInputs/base/LazyTextInput'
3+
import {LazyTextInput} from '../../../../../../ui-components/inputs/DateInputs/LazyTextInput'
44

55
type Props = Omit<ComponentProps<typeof LazyTextInput>, 'onChange' | 'value'> & {
66
value?: number

packages/sanity/src/core/tasks/components/form/fields/DateEditFormField.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import {type KeyboardEvent, useCallback, useMemo, useRef, useState} from 'react'
66
import ReactFocusLock from 'react-focus-lock'
77

88
import {Button, Popover} from '../../../../../ui-components'
9+
import {type CalendarLabels} from '../../../../../ui-components/inputs/DateInputs/calendar/types'
10+
import {DatePicker} from '../../../../../ui-components/inputs/DateInputs/DatePicker'
911
import {type FormPatch, type PatchEvent, set, unset} from '../../../../form'
10-
import {type CalendarLabels} from '../../../../form/inputs/DateInputs/base/calendar/types'
11-
import {DatePicker} from '../../../../form/inputs/DateInputs/base/DatePicker'
1212
import {getCalendarLabels} from '../../../../form/inputs/DateInputs/utils'
1313
import {useDateTimeFormat} from '../../../../hooks'
1414
import {useTranslation} from '../../../../i18n'

packages/sanity/src/core/form/inputs/DateInputs/base/DateTimeInput.tsx renamed to packages/sanity/src/ui-components/inputs/DateInputs/DateTimeInput.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import {
1212
} from 'react'
1313
import FocusLock from 'react-focus-lock'
1414

15-
import {Button, Popover} from '../../../../../ui-components'
15+
import {Button} from '../../button'
16+
import {Popover} from '../../popover'
1617
import {type CalendarLabels} from './calendar/types'
1718
import {DatePicker} from './DatePicker'
1819
import {LazyTextInput} from './LazyTextInput'

packages/sanity/src/core/form/inputs/DateInputs/base/calendar/Calendar.tsx renamed to packages/sanity/src/ui-components/inputs/DateInputs/calendar/Calendar.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import {
1414
useRef,
1515
} from 'react'
1616

17-
import {Button} from '../../../../../../ui-components'
17+
import {Button} from '../../../button'
1818
import {CalendarMonth} from './CalendarMonth'
1919
import {ARROW_KEYS, DEFAULT_TIME_PRESETS, HOURS_24} from './constants'
2020
import {features} from './features'

packages/sanity/src/core/form/inputs/DateInputs/base/calendar/CalendarMonth.tsx renamed to packages/sanity/src/ui-components/inputs/DateInputs/calendar/CalendarMonth.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {Box, Grid, Text} from '@sanity/ui'
22
import {isSameDay, isSameMonth} from 'date-fns'
33

4-
import {useCurrentLocale} from '../../../../../i18n/hooks/useLocale'
4+
import {useCurrentLocale} from '../../../../core/i18n/hooks/useLocale'
55
import {CalendarDay} from './CalendarDay'
66
import {useWeeksOfMonth} from './utils'
77

packages/sanity/src/core/form/inputs/DateInputs/base/calendar/utils.ts renamed to packages/sanity/src/ui-components/inputs/DateInputs/calendar/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {addDays, eachWeekOfInterval, getWeek, lastDayOfMonth, startOfMonth} from 'date-fns'
22

3-
import {useCurrentLocale} from '../../../../../i18n/hooks/useLocale'
3+
import {useCurrentLocale} from '../../../../core/i18n/hooks/useLocale'
44
import {TAIL_WEEKDAYS} from './constants'
55

66
/**

0 commit comments

Comments
 (0)