Skip to content

Commit

Permalink
refactor: moved loading and notice providers to each package
Browse files Browse the repository at this point in the history
  • Loading branch information
hirotomoyamada committed Oct 19, 2023
1 parent 33df2f8 commit c1db45c
Show file tree
Hide file tree
Showing 11 changed files with 10,910 additions and 10,707 deletions.
7 changes: 7 additions & 0 deletions .changeset/empty-monkeys-smell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@yamada-ui/loading': minor
'@yamada-ui/notice': minor
'@yamada-ui/providers': minor
---

Moved loading and notice providers to each package.
6 changes: 5 additions & 1 deletion packages/components/loading/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,11 @@
"@yamada-ui/utils": "workspace:*",
"@yamada-ui/use-value": "workspace:*",
"@yamada-ui/use-token": "workspace:*",
"@yamada-ui/icon": "workspace:*"
"@yamada-ui/motion": "workspace:*",
"@yamada-ui/portal": "workspace:*",
"@yamada-ui/use-timeout": "workspace:*",
"@yamada-ui/icon": "workspace:*",
"react-remove-scroll": "^2.5.4"
},
"devDependencies": {
"react": "^18.0.0",
Expand Down
1 change: 1 addition & 0 deletions packages/components/loading/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export { Loading } from './loading'
export type { LoadingProps } from './loading'
export * from './loading-provider'
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import {
LoadingConfigOptions,
HTMLUIProps,
} from '@yamada-ui/core'
import { Loading } from '@yamada-ui/loading'
import {
AnimatePresence,
Motion,
Expand Down Expand Up @@ -37,6 +36,7 @@ import {
RefObject,
} from 'react'
import { RemoveScroll } from 'react-remove-scroll'
import { Loading } from './loading'

type LoadingContextProps = {
/**
Expand Down Expand Up @@ -101,7 +101,7 @@ type LoadingState = {

export type LoadingProviderProps = PropsWithChildren<ThemeConfig['loading']>

export const LoadingContext = createContext({} as LoadingContext)
const LoadingContext = createContext({} as LoadingContext)

type Refs = {
isLoading: RefObject<LoadingContextProps['isLoading']>
Expand Down
3 changes: 3 additions & 0 deletions packages/components/notice/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
"@yamada-ui/core": "workspace:*",
"@yamada-ui/close-button": "workspace:*",
"@yamada-ui/alert": "workspace:*",
"@yamada-ui/portal": "workspace:*",
"@yamada-ui/motion": "workspace:*",
"@yamada-ui/use-timeout": "workspace:*",
"@yamada-ui/utils": "workspace:*"
},
"devDependencies": {
Expand Down
1 change: 1 addition & 0 deletions packages/components/notice/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export { useNotice, noticeStore } from './notice'
export type { NoticeProps, NoticeOptions, UseNoticeOptions } from './notice'
export * from './notice-provider'
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import {
MotionVariants,
MotionStyle,
} from '@yamada-ui/motion'
import { noticeStore, NoticeOptions } from '@yamada-ui/notice'
import { Portal } from '@yamada-ui/portal'
import { useTimeout } from '@yamada-ui/use-timeout'
import { runIfFunc, useUpdateEffect } from '@yamada-ui/utils'
import { FC, memo, useEffect, useState, useSyncExternalStore } from 'react'
import { noticeStore, NoticeOptions } from './notice'

export type NoticeProviderProps = Omit<
Required<ThemeConfig>['notice'],
Expand Down
7 changes: 1 addition & 6 deletions packages/providers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,9 @@
"dependencies": {
"@yamada-ui/core": "workspace:*",
"@yamada-ui/utils": "workspace:*",
"@yamada-ui/use-timeout": "workspace:*",
"@yamada-ui/theme": "workspace:*",
"@yamada-ui/loading": "workspace:*",
"@yamada-ui/notice": "workspace:*",
"@yamada-ui/motion": "workspace:*",
"@yamada-ui/portal": "workspace:*",
"react-remove-scroll": "^2.5.4",
"@emotion/react": "^11.11.0"
"@yamada-ui/notice": "workspace:*"
},
"devDependencies": {
"react": "^18.0.0",
Expand Down
1 change: 0 additions & 1 deletion packages/providers/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export { UIProvider } from './ui-provider'
export type { UIProviderProps } from './ui-provider'
export { useLoading } from './loading-provider'
export { useEnvironment } from './environment-provider'
4 changes: 2 additions & 2 deletions packages/providers/src/ui-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import {
GlobalStyle,
ThemeSchemeManager,
} from '@yamada-ui/core'
import { LoadingProvider } from '@yamada-ui/loading'
import { NoticeProvider } from '@yamada-ui/notice'
import { defaultTheme, defaultConfig } from '@yamada-ui/theme'
import { Dict } from '@yamada-ui/utils'
import { FC, ReactNode } from 'react'
import { EnvironmentProvider, Environment } from './environment-provider'
import { LoadingProvider } from './loading-provider'
import { NoticeProvider } from './notice-provider'

export type UIProviderProps = {
/**
Expand Down
Loading

0 comments on commit c1db45c

Please sign in to comment.