From c7170a0262d26524776d9a7337d9d6fa97c7f1e6 Mon Sep 17 00:00:00 2001 From: SKairinos Date: Thu, 15 Aug 2024 08:32:27 +0000 Subject: [PATCH] simplify exports --- src/api/endpoints/index.ts | 55 ++++------------------- src/api/index.ts | 51 ++------------------- src/components/form/index.tsx | 78 ++++++++++++--------------------- src/components/index.ts | 65 ++++++++++----------------- src/components/page/index.ts | 29 +++++------- src/components/router/index.tsx | 28 +++++------- src/features/index.ts | 15 ++----- src/hooks/index.ts | 44 ++----------------- src/index.ts | 10 +---- src/theme/index.ts | 12 ++--- 10 files changed, 98 insertions(+), 289 deletions(-) diff --git a/src/api/endpoints/index.ts b/src/api/endpoints/index.ts index 3f8ebfe2..516a6f55 100644 --- a/src/api/endpoints/index.ts +++ b/src/api/endpoints/index.ts @@ -1,47 +1,8 @@ -import getReadAuthFactorEndpoints, { - type ListAuthFactorsArg, - type ListAuthFactorsResult, - AUTH_FACTOR_TAG, -} from "./authFactor" -import getReadClassEndpoints, { - type ListClassesArg, - type ListClassesResult, - type RetrieveClassArg, - type RetrieveClassResult, - CLASS_TAG, -} from "./klass" -import getReadSchoolEndpoints, { - type RetrieveSchoolArg, - type RetrieveSchoolResult, - SCHOOL_TAG, -} from "./school" -import getReadUserEndpoints, { - type ListUsersArg, - type ListUsersResult, - type RetrieveUserArg, - type RetrieveUserResult, - USER_TAG, -} from "./user" - -export { - AUTH_FACTOR_TAG, - CLASS_TAG, - getReadAuthFactorEndpoints, - getReadClassEndpoints, - getReadSchoolEndpoints, - getReadUserEndpoints, - SCHOOL_TAG, - USER_TAG, - type ListAuthFactorsArg, - type ListAuthFactorsResult, - type ListClassesArg, - type ListClassesResult, - type ListUsersArg, - type ListUsersResult, - type RetrieveClassArg, - type RetrieveClassResult, - type RetrieveSchoolArg, - type RetrieveSchoolResult, - type RetrieveUserArg, - type RetrieveUserResult, -} +export * from "./authFactor" +export { default as getReadAuthFactorEndpoints } from "./authFactor" +export * from "./klass" +export { default as getReadClassEndpoints } from "./klass" +export * from "./school" +export { default as getReadSchoolEndpoints } from "./school" +export * from "./user" +export { default as getReadUserEndpoints } from "./user" diff --git a/src/api/index.ts b/src/api/index.ts index f5f68de5..4afab9a5 100644 --- a/src/api/index.ts +++ b/src/api/index.ts @@ -1,47 +1,4 @@ -import createApi from "./createApi" -import type { - AdminSchoolTeacher, - AdminSchoolTeacherUser, - AuthFactor, - Class, - IndependentUser, - NonAdminSchoolTeacher, - NonAdminSchoolTeacherUser, - NonSchoolTeacher, - NonSchoolTeacherUser, - OtpBypassToken, - School, - SchoolTeacher, - SchoolTeacherUser, - Student, - StudentUser, - Teacher, - TeacherUser, - User, -} from "./models" -import tagTypes from "./tagTypes" -import urls from "./urls" - -export { - createApi, - tagTypes, - urls, - type AdminSchoolTeacher, - type AdminSchoolTeacherUser, - type AuthFactor, - type Class, - type IndependentUser, - type NonAdminSchoolTeacher, - type NonAdminSchoolTeacherUser, - type NonSchoolTeacher, - type NonSchoolTeacherUser, - type OtpBypassToken, - type School, - type SchoolTeacher, - type SchoolTeacherUser, - type Student, - type StudentUser, - type Teacher, - type TeacherUser, - type User, -} +export { default as createApi } from "./createApi" +export * from "./models" +export { default as tagTypes } from "./tagTypes" +export { default as urls } from "./urls" diff --git a/src/components/form/index.tsx b/src/components/form/index.tsx index a8bc35b5..ca5fe472 100644 --- a/src/components/form/index.tsx +++ b/src/components/form/index.tsx @@ -1,50 +1,28 @@ -import ApiAutocompleteField, { - type ApiAutocompleteFieldProps, -} from "./ApiAutocompleteField" -import AutocompleteField, { - type AutocompleteFieldProps, -} from "./AutocompleteField" -import CheckboxField, { type CheckboxFieldProps } from "./CheckboxField" -import CountryField, { type CountryFieldProps } from "./CountryField" -import DatePickerField, { type DatePickerFieldProps } from "./DatePickerField" -import EmailField, { type EmailFieldProps } from "./EmailField" -import FirstNameField, { type FirstNameFieldProps } from "./FirstNameField" -import Form, { type FormErrors, type FormProps } from "./Form" -import OtpField, { type OtpFieldProps } from "./OtpField" -import PasswordField, { type PasswordFieldProps } from "./PasswordField" -import RepeatField, { type RepeatFieldProps } from "./RepeatField" -import SubmitButton, { type SubmitButtonProps } from "./SubmitButton" -import TextField, { type TextFieldProps } from "./TextField" -import UkCountyField, { type UkCountyFieldProps } from "./UkCountyField" - -export { - ApiAutocompleteField, - AutocompleteField, - CheckboxField, - CountryField, - DatePickerField, - EmailField, - FirstNameField, - Form, - OtpField, - PasswordField, - RepeatField, - SubmitButton, - TextField, - UkCountyField, - type ApiAutocompleteFieldProps, - type AutocompleteFieldProps, - type CheckboxFieldProps, - type CountryFieldProps, - type DatePickerFieldProps, - type EmailFieldProps, - type FirstNameFieldProps, - type FormErrors, - type FormProps, - type OtpFieldProps, - type PasswordFieldProps, - type RepeatFieldProps, - type SubmitButtonProps, - type TextFieldProps, - type UkCountyFieldProps, -} +export * from "./ApiAutocompleteField" +export { default as ApiAutocompleteField } from "./ApiAutocompleteField" +export * from "./AutocompleteField" +export { default as AutocompleteField } from "./AutocompleteField" +export * from "./CheckboxField" +export { default as CheckboxField } from "./CheckboxField" +export * from "./CountryField" +export { default as CountryField } from "./CountryField" +export * from "./DatePickerField" +export { default as DatePickerField } from "./DatePickerField" +export * from "./EmailField" +export { default as EmailField } from "./EmailField" +export * from "./FirstNameField" +export { default as FirstNameField } from "./FirstNameField" +export * from "./Form" +export { default as Form } from "./Form" +export * from "./OtpField" +export { default as OtpField } from "./OtpField" +export * from "./PasswordField" +export { default as PasswordField } from "./PasswordField" +export * from "./RepeatField" +export { default as RepeatField } from "./RepeatField" +export * from "./SubmitButton" +export { default as SubmitButton } from "./SubmitButton" +export * from "./TextField" +export { default as TextField } from "./TextField" +export * from "./UkCountyField" +export { default as UkCountyField } from "./UkCountyField" diff --git a/src/components/index.ts b/src/components/index.ts index 504569de..737b7694 100644 --- a/src/components/index.ts +++ b/src/components/index.ts @@ -1,41 +1,24 @@ -import App, { type AppProps } from "./App" -import ClickableTooltip, { - type ClickableTooltipProps, -} from "./ClickableTooltip" -import CopyIconButton, { type CopyIconButtonProps } from "./CopyIconButton" -import Countdown, { type CountdownProps } from "./Countdown" -import ElevatedAppBar, { type ElevatedAppBarProps } from "./ElevatedAppBar" -import Image, { type ImageProps } from "./Image" -import ItemizedList, { type ItemizedListProps } from "./ItemizedList" -import OrderedGrid, { type OrderedGridProps } from "./OrderedGrid" -import ScrollRoutes, { type ScrollRoutesProps } from "./ScrollRoutes" -import SyncError, { type SyncErrorProps } from "./SyncError" -import TablePagination, { type TablePaginationProps } from "./TablePagination" -import YouTubeVideo, { type YouTubeVideoProps } from "./YouTubeVideo" - -export { - App, - ClickableTooltip, - CopyIconButton, - Countdown, - ElevatedAppBar, - Image, - ItemizedList, - OrderedGrid, - ScrollRoutes, - SyncError, - TablePagination, - YouTubeVideo, - type AppProps, - type ClickableTooltipProps, - type CopyIconButtonProps, - type CountdownProps, - type ElevatedAppBarProps, - type ImageProps, - type ItemizedListProps, - type OrderedGridProps, - type ScrollRoutesProps, - type SyncErrorProps, - type TablePaginationProps, - type YouTubeVideoProps, -} +export * from "./App" +export { default as App } from "./App" +export * from "./ClickableTooltip" +export { default as ClickableTooltip } from "./ClickableTooltip" +export * from "./CopyIconButton" +export { default as CopyIconButton } from "./CopyIconButton" +export * from "./Countdown" +export { default as Countdown } from "./Countdown" +export * from "./ElevatedAppBar" +export { default as ElevatedAppBar } from "./ElevatedAppBar" +export * from "./Image" +export { default as Image } from "./Image" +export * from "./ItemizedList" +export { default as ItemizedList } from "./ItemizedList" +export * from "./OrderedGrid" +export { default as OrderedGrid } from "./OrderedGrid" +export * from "./ScrollRoutes" +export { default as ScrollRoutes } from "./ScrollRoutes" +export * from "./SyncError" +export { default as SyncError } from "./SyncError" +export * from "./TablePagination" +export { default as TablePagination } from "./TablePagination" +export * from "./YouTubeVideo" +export { default as YouTubeVideo } from "./YouTubeVideo" diff --git a/src/components/page/index.ts b/src/components/page/index.ts index 224365f7..96481272 100644 --- a/src/components/page/index.ts +++ b/src/components/page/index.ts @@ -1,19 +1,10 @@ -import Banner, { type BannerProps } from "./Banner" -import Notification, { type NotificationProps } from "./Notification" -import Page, { type PageProps, type PageState } from "./Page" -import Section, { type SectionProps } from "./Section" -import TabBar, { type TabBarProps } from "./TabBar" - -export { - Banner, - Notification, - Page, - Section, - TabBar, - type BannerProps, - type NotificationProps, - type PageProps, - type PageState, - type SectionProps, - type TabBarProps, -} +export * from "./Banner" +export { default as Banner } from "./Banner" +export * from "./Notification" +export { default as Notification } from "./Notification" +export * from "./Page" +export { default as Page } from "./Page" +export * from "./Section" +export { default as Section } from "./Section" +export * from "./TabBar" +export { default as TabBar } from "./TabBar" diff --git a/src/components/router/index.tsx b/src/components/router/index.tsx index b118360f..4315bf97 100644 --- a/src/components/router/index.tsx +++ b/src/components/router/index.tsx @@ -1,18 +1,10 @@ -import Link, { type LinkProps } from "./Link" -import LinkButton, { type LinkButtonProps } from "./LinkButton" -import LinkIconButton, { type LinkIconButtonProps } from "./LinkIconButton" -import LinkListItem, { type LinkListItemProps } from "./LinkListItem" -import LinkTab, { type LinkTabProps } from "./LinkTab" - -export { - Link, - LinkButton, - LinkIconButton, - LinkListItem, - LinkTab, - type LinkButtonProps, - type LinkIconButtonProps, - type LinkListItemProps, - type LinkProps, - type LinkTabProps, -} +export * from "./Link" +export { default as Link } from "./Link" +export * from "./LinkButton" +export { default as LinkButton } from "./LinkButton" +export * from "./LinkIconButton" +export { default as LinkIconButton } from "./LinkIconButton" +export * from "./LinkListItem" +export { default as LinkListItem } from "./LinkListItem" +export * from "./LinkTab" +export { default as LinkTab } from "./LinkTab" diff --git a/src/features/index.ts b/src/features/index.ts index ca962a5d..092ecdef 100644 --- a/src/features/index.ts +++ b/src/features/index.ts @@ -1,11 +1,4 @@ -import InactiveDialog, { type InactiveDialogProps } from "./InactiveDialog" -import ScreenTimeDialog, { - type ScreenTimeDialogProps, -} from "./ScreenTimeDialog" - -export { - InactiveDialog, - type InactiveDialogProps, - ScreenTimeDialog, - type ScreenTimeDialogProps, -} +export * from "./InactiveDialog" +export { default as InactiveDialog } from "./InactiveDialog" +export * from "./ScreenTimeDialog" +export { default as ScreenTimeDialog } from "./ScreenTimeDialog" diff --git a/src/hooks/index.ts b/src/hooks/index.ts index 1d2fcd48..db57daf4 100644 --- a/src/hooks/index.ts +++ b/src/hooks/index.ts @@ -1,40 +1,4 @@ -import { - usePagination, - useQueryManager, - type Pagination, - type SetPagination, - type UsePaginationOptions, - type UseQueryManagerOptions, -} from "./api" -import { - useSession, - useSessionMetadata, - type SessionMetadata, - type UseSessionChildren, - type UseSessionChildrenFunction, - type UseSessionOptions, -} from "./auth" -import { useCountdown, useEventListener, useExternalScript } from "./general" -import { useLocation, useNavigate, useParams, useSearchParams } from "./router" - -export { - useCountdown, - useEventListener, - useExternalScript, - useLocation, - useNavigate, - usePagination, - useParams, - useQueryManager, - useSearchParams, - useSession, - useSessionMetadata, - type Pagination, - type SessionMetadata, - type SetPagination, - type UsePaginationOptions, - type UseQueryManagerOptions, - type UseSessionChildren, - type UseSessionChildrenFunction, - type UseSessionOptions, -} +export * from "./api" +export * from "./auth" +export * from "./general" +export * from "./router" diff --git a/src/index.ts b/src/index.ts index 647ef39d..587c24ed 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,8 +1,2 @@ -import theme, { themeOptions, type PropsColorOverrides } from "./theme" - -export { - // imports from './theme' - theme, - themeOptions, - type PropsColorOverrides, -} +export * from "./them" +export { default as theme } from "./theme" diff --git a/src/theme/index.ts b/src/theme/index.ts index e3d537b9..72008448 100644 --- a/src/theme/index.ts +++ b/src/theme/index.ts @@ -4,18 +4,14 @@ import { responsiveFontSizes, } from "@mui/material" -import palette, { type PropsColorOverrides } from "./palette" import components from "./components" -import ThemedBox, { type ThemedBoxProps } from "./ThemedBox" +import palette from "./palette" import spacing from "./spacing" import typography from "./typography" -export { - // Needed to modify '@mui/material' module declarations. - type PropsColorOverrides, - ThemedBox, - type ThemedBoxProps, -} +export * from "./palette" +export * from "./ThemedBox" +export { default as ThemedBox } from "./ThemedBox" export const themeOptions: ThemeOptions = { palette,