Skip to content

Commit

Permalink
mv sub-components
Browse files Browse the repository at this point in the history
  • Loading branch information
TheSonOfThomp committed Aug 30, 2023
1 parent 7048dcc commit b49a929
Show file tree
Hide file tree
Showing 22 changed files with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { render } from '@testing-library/react';
import {
DatePickerContextProps,
DatePickerProvider,
} from '../DatePickerContext';
} from '../../DatePickerContext';

import { DateInputBox, type DateInputBoxProps } from '.';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { StoryMetaType } from '@leafygreen-ui/lib';
import {
DatePickerContextProps,
DatePickerProvider,
} from '../DatePickerContext';
} from '../../DatePickerContext';

import { DateInputBox } from './DateInputBox';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@ import { isSameDay } from 'date-fns';

import { useIdAllocator } from '@leafygreen-ui/hooks';

import { DateInputSegment, DateSegment } from '../DateInputSegment';
import { isDateSegment } from '../DateInputSegment';
import { useDatePickerContext } from '../../DatePickerContext';
import { newDateFromSegments } from '../../utils/newDateFromSegments';
import { toClientTimeZone } from '../../utils/toTimeZone';
import {
DateInputSegment,
DateSegment,
isDateSegment,
} from '../DateInputSegment';
import { DateInputWrapper } from '../DateInputWrapper';
import { useDatePickerContext } from '../DatePickerContext';
import { newDateFromSegments } from '../utils/newDateFromSegments';
import { toClientTimeZone } from '../utils/toTimeZone';

import {
segmentPartsWrapperStyles,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { getDate, getMonth, getYear, isSameDay } from 'date-fns';

import { usePrevious } from '@leafygreen-ui/hooks';

import { toTimeZone } from '../../utils/toTimeZone';
import type { DateSegment, DateSegmentValue } from '../DateInputSegment';
import { toTimeZone } from '../utils/toTimeZone';

import { DateSegmentsState } from './DateInputBox.types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useEffect, useMemo, useState } from 'react';

import { consoleOnce } from '@leafygreen-ui/lib';

import { isValidLocale } from '../utils/isValidLocale';
import { isValidLocale } from '../../utils/isValidLocale';

const now = new Date();
const ISO = 'iso8601';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Size } from '@leafygreen-ui/tokens';
import {
DatePickerContextProps,
DatePickerProvider,
} from '../DatePickerContext';
} from '../../DatePickerContext';

import { DateInputSegment } from './DateInputSegment';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useDarkMode } from '@leafygreen-ui/leafygreen-provider';
import { Size } from '@leafygreen-ui/tokens';
import { useUpdatedBaseFontSize } from '@leafygreen-ui/typography';

import { useDatePickerContext } from '../DatePickerContext/DatePickerContext';
import { useDatePickerContext } from '../../DatePickerContext';

import { defaultMax, defaultMin, defaultPlaceholder } from './constants';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { padStart } from 'lodash';

import { isZeroLike } from '../../utils/isZeroLike';

import { charsPerSegment } from './constants';
import { DateSegment } from './DateInputSegment.types';

const isZeroLike = (val: any) =>
!val || isNaN(val) || ['', '0', '00', 0].includes(val);

export const getValueFormatter =
(segment: DateSegment) => (val: string | number | undefined) => {
// If the value is any form of zero, we set it to an empty string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { StoryMetaType } from '@leafygreen-ui/lib';
import {
DatePickerContextProps,
DatePickerProvider,
} from '../DatePickerContext';
} from '../../DatePickerContext';

import { DateInputWrapper } from './DateInputWrapper';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
useUpdatedBaseFontSize,
} from '@leafygreen-ui/typography';

import { useDatePickerContext } from '../DatePickerContext';
import { useDatePickerContext } from '../../DatePickerContext';

import {
baseWrapperStyles,
Expand Down

0 comments on commit b49a929

Please sign in to comment.