Skip to content

Commit 1bb3219

Browse files
Merge pull request #304 from softnetics/supakorn/fix/components
feat: extract hooks and component dependencies of `@genseki/ui`.
2 parents 0760815 + c968c01 commit 1bb3219

20 files changed

Lines changed: 167 additions & 8 deletions

File tree

.changeset/dirty-parrots-marry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@genseki/ui': patch
3+
---
4+
5+
feat: UI component improvement focus on tanstack-table and pagination.

legacies/react/src/react/hooks/use-pagination.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,25 @@ import type { Dispatch, SetStateAction } from 'react'
33

44
import { parseAsInteger, useQueryStates } from 'nuqs'
55

6+
/**
7+
* @deprecated Use `usePagination` from `@genseki/ui` instead
8+
*/
69
export interface PaginationValue {
710
page: number
811
pageSize: number
912
}
1013

14+
/**
15+
* @deprecated Use `usePagination` from `@genseki/ui` instead
16+
*/
17+
1118
export interface UsePaginationReturn {
1219
pagination: PaginationValue
1320
setPagination: Dispatch<SetStateAction<PaginationValue>>
1421
}
1522

1623
/**
24+
* @deprecated Use `usePagination` from `@genseki/ui` instead
1725
* @description Handle standard pagination data
1826
*/
1927
export function usePagination(): UsePaginationReturn {

legacies/react/src/react/hooks/use-sort.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,22 @@ const sortSchema = z.object({
88
desc: z.boolean(),
99
})
1010

11+
/**
12+
* @deprecated Use `SortValue` from `@genseki/ui` instead
13+
*/
1114
export type SortValue = z.infer<typeof sortSchema>[]
1215

16+
/**
17+
* @deprecated Use `UseSort` from `@genseki/ui` instead
18+
*/
1319
export interface UseSort {
1420
Sort: SortValue
1521
SetSort: Dispatch<SetStateAction<SortValue>>
1622
}
1723

24+
/**
25+
* @deprecated Use `useSort` from `@genseki/ui` instead
26+
*/
1827
export function useSort() {
1928
const [sort, setSort] = useQueryState(
2029
'sort',

legacies/react/src/react/providers/navigation.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
import { createContext, useContext } from 'react'
44

5+
/**
6+
* @deprecated
7+
*/
58
export interface NavigationContextValue {
69
navigate: (path: string, type?: 'push' | 'replace') => void
710
getPathname: () => string
@@ -10,6 +13,9 @@ export interface NavigationContextValue {
1013

1114
export const NavigationContext = createContext<NavigationContextValue>(null!)
1215

16+
/**
17+
* @deprecated
18+
*/
1319
export const useNavigation = () => {
1420
const context = useContext(NavigationContext)
1521
if (!context) {

packages/ui/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@
6767
"react-dom": "^19.1.0",
6868
"react-dropzone": "^14.3.8",
6969
"sonner": "^2.0.3",
70-
"tailwind-merge": "^3.0.2"
70+
"tailwind-merge": "^3.0.2",
71+
"zod": "^4.1.13"
7172
},
7273
"devDependencies": {
7374
"@types/node": "22.13.10",

packages/ui/src/components/primitives/color-picker.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { Input } from './input'
2020
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from './select'
2121
import { Typography } from './typography'
2222

23-
import { createRequiredContext } from '../../hooks/create-required-context'
23+
import { createRequiredContext } from '../../hooks/internals/create-required-context'
2424
import { cn } from '../../utils/cn'
2525

2626
interface ColorPickerContextValue {

packages/ui/src/components/primitives/combobox.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import {
1616
import { Popover, PopoverContent, PopoverTrigger } from './popover'
1717

1818
import { Badge } from '../../../src'
19-
import { createRequiredContext } from '../../hooks/create-required-context'
19+
import { createRequiredContext } from '../../hooks/internals/create-required-context'
2020
import { cn } from '../../utils/cn'
2121

2222
/**

packages/ui/src/components/primitives/date-picker.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { Button } from './button'
99
import { Popover, PopoverContent, PopoverTrigger } from './popover'
1010
import { Typography } from './typography'
1111

12-
import { createRequiredContext } from '../../hooks/create-required-context'
12+
import { createRequiredContext } from '../../hooks/internals/create-required-context'
1313
import { cn } from '../../utils/cn'
1414

1515
const [_DatePickerProvider, useDatePickerProvider] = createRequiredContext<{

packages/ui/src/components/primitives/drop-zone.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { PaperclipIcon } from '@phosphor-icons/react'
1010
import { Button } from './button'
1111
import { Typography } from './typography'
1212

13-
import { createRequiredContext } from '../../hooks/create-required-context'
13+
import { createRequiredContext } from '../../hooks/internals/create-required-context'
1414
import { cn } from '../../utils/cn'
1515
declare namespace Intl {
1616
type ListType = 'conjunction' | 'disjunction'

packages/ui/src/components/primitives/input-group.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { cva, type VariantProps } from 'class-variance-authority'
88
import { Button } from './button'
99
import type { Input } from './input'
1010

11-
import { createRequiredContext } from '../../hooks/create-required-context'
11+
import { createRequiredContext } from '../../hooks/internals/create-required-context'
1212
import { cn } from '../../utils/cn'
1313

1414
const [InputGroupProvider, useInputGroup] = createRequiredContext<{

0 commit comments

Comments
 (0)