Skip to content

Commit bd64c62

Browse files
authored
Reduce barrel file usage (#1978)
* move hooks out of ui/index.ts * get a bunch of less used components out of the UI barrel file * get rid of the app/forms barrel * add app/ui readme
1 parent 4388a92 commit bd64c62

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+188
-210
lines changed

app/components/EquivalentCliCommand.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
*/
88
import { useState } from 'react'
99

10-
import { Button, Modal, Success12Icon, useTimeout } from '@oxide/ui'
10+
import { Button, Modal, Success12Icon } from '@oxide/ui'
11+
12+
import useTimeout from '~/ui/lib/use-timeout'
1113

1214
export default function EquivalentCliCommand({ command }: { command: string }) {
1315
const [isOpen, setIsOpen] = useState(false)

app/components/ExternalIps.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88

99
import { useApiQuery } from '@oxide/api'
1010
import { EmptyCell, SkeletonCell } from '@oxide/table'
11-
import { CopyToClipboard } from '@oxide/ui'
1211
import { intersperse } from '@oxide/util'
1312

13+
import { CopyToClipboard } from '~/ui/lib/CopyToClipboard'
14+
1415
type InstanceSelector = { project: string; instance: string }
1516

1617
export function ExternalIps({ project, instance }: InstanceSelector) {

app/components/MswBanner.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,9 @@
77
*/
88
import { useState, type ReactNode } from 'react'
99

10-
import {
11-
Button,
12-
Info16Icon,
13-
Modal,
14-
ModalLink,
15-
ModalLinks,
16-
NextArrow12Icon,
17-
} from '@oxide/ui'
10+
import { Button, Info16Icon, Modal, NextArrow12Icon } from '@oxide/ui'
11+
12+
import { ModalLink, ModalLinks } from '~/ui/lib/ModalLinks'
1813

1914
function ExternalLink({ href, children }: { href: string; children: ReactNode }) {
2015
return (

app/components/Pagination.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import tunnel from 'tunnel-rat'
1010
import {
1111
Pagination as UIPagination,
1212
type PaginationProps as UIPaginationProps,
13-
} from '@oxide/ui'
13+
} from '~/ui/lib/Pagination'
1414

1515
const Tunnel = tunnel('pagination')
1616

app/components/RefetchIntervalPicker.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@ import {
1414
Refresh16Icon,
1515
SpinnerLoader,
1616
Time16Icon,
17-
useInterval,
1817
type ListboxItem,
1918
} from '@oxide/ui'
2019

20+
import useInterval from '~/ui/lib/use-interval'
21+
2122
const intervalPresets = {
2223
Off: undefined,
2324
'10s': 10 * 1000,

app/components/ToastStack.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
*/
88
import { animated, useTransition } from '@react-spring/web'
99

10-
import { Toast } from '@oxide/ui'
11-
10+
import { Toast } from '~/ui/lib/Toast'
1211
import { useToastStore } from 'app/stores/toast'
1312

1413
export function ToastStack() {

app/components/form/fields/ErrorMessage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*/
88
import type { FieldError } from 'react-hook-form'
99

10-
import { TextInputError } from '@oxide/ui'
10+
import { TextInputError } from '~/ui/lib/TextInput'
1111

1212
type ErrorMessageProps = {
1313
error: FieldError | undefined

app/components/form/fields/FileField.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
*/
88
import { Controller, type Control, type FieldPath, type FieldValues } from 'react-hook-form'
99

10-
import { FieldLabel, FileInput, TextInputHint } from '@oxide/ui'
10+
import { FieldLabel } from '@oxide/ui'
11+
12+
import { FileInput } from '~/ui/lib/FileInput'
13+
import { TextInputHint } from '~/ui/lib/TextInput'
1114

1215
import { ErrorMessage } from './ErrorMessage'
1316

app/components/form/fields/NumberField.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@ import cn from 'classnames'
99
import { useId } from 'react'
1010
import { Controller, type FieldPathByValue, type FieldValues } from 'react-hook-form'
1111

12-
import { FieldLabel, TextInputHint, NumberInput as UINumberField } from '@oxide/ui'
12+
import { FieldLabel } from '@oxide/ui'
1313
import { capitalize } from '@oxide/util'
1414

15+
import { NumberInput } from '~/ui/lib/NumberInput'
16+
import { TextInputHint } from '~/ui/lib/TextInput'
17+
1518
import { ErrorMessage } from './ErrorMessage'
1619
import type { TextFieldProps } from './TextField'
1720

@@ -83,7 +86,7 @@ export const NumberFieldInner = <
8386
render={({ field, fieldState: { error } }) => {
8487
return (
8588
<>
86-
<UINumberField
89+
<NumberInput
8790
id={id}
8891
error={!!error}
8992
aria-labelledby={cn(`${id}-label`, {

app/components/form/fields/RadioField.tsx

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,11 @@ import {
1515
type PathValue,
1616
} from 'react-hook-form'
1717

18-
import {
19-
FieldLabel,
20-
Radio,
21-
RadioGroup,
22-
TextInputHint,
23-
type RadioGroupProps,
24-
} from '@oxide/ui'
18+
import { FieldLabel, Radio, RadioGroup, type RadioGroupProps } from '@oxide/ui'
2519
import { capitalize } from '@oxide/util'
2620

21+
import { TextInputHint } from '~/ui/lib/TextInput'
22+
2723
export type RadioFieldProps<
2824
TFieldValues extends FieldValues,
2925
TName extends FieldPath<TFieldValues>,

0 commit comments

Comments
 (0)