@sonamu-kit/react-components 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -46,7 +46,8 @@ export { Progress } from './ui/progress';
|
|
|
46
46
|
export { RadioGroup, RadioGroupItem } from './ui/radio-group';
|
|
47
47
|
export { ResizableHandle, ResizablePanel, ResizablePanelGroup, } from './ui/resizable';
|
|
48
48
|
export { ScrollArea, ScrollBar } from './ui/scroll-area';
|
|
49
|
-
export {
|
|
49
|
+
export type { SelectItemDef, SelectProps } from './ui/select';
|
|
50
|
+
export { Select } from './ui/select';
|
|
50
51
|
export { Separator } from './ui/separator';
|
|
51
52
|
export { Sheet, SheetClose, SheetContent, SheetDescription, SheetFooter, SheetHeader, SheetOverlay, SheetPortal, SheetTitle, SheetTrigger, } from './ui/sheet';
|
|
52
53
|
export { Sidebar, SidebarContent, SidebarFooter, SidebarGroup, SidebarGroupAction, SidebarGroupContent, SidebarGroupLabel, SidebarHeader, SidebarInput, SidebarInset, SidebarMenu, SidebarMenuAction, SidebarMenuBadge, SidebarMenuButton, SidebarMenuItem, SidebarMenuSkeleton, SidebarMenuSub, SidebarMenuSubButton, SidebarMenuSubItem, SidebarProvider, SidebarRail, SidebarSeparator, SidebarTrigger, useSidebar, } from './ui/sidebar';
|
|
@@ -1,20 +1,32 @@
|
|
|
1
1
|
import { Override } from '../../lib/types';
|
|
2
2
|
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
type
|
|
4
|
+
type ExtractValue<Item> = Item extends {
|
|
5
|
+
value: infer V;
|
|
6
|
+
} ? V : Item;
|
|
7
|
+
type SelectItemDef<V> = V | {
|
|
8
|
+
value: V;
|
|
9
|
+
label?: React.ReactNode;
|
|
10
|
+
disabled?: boolean;
|
|
11
|
+
};
|
|
12
|
+
type SelectPropsBase<Item> = Override<Omit<React.ComponentProps<typeof SelectPrimitive.Root>, "value" | "defaultValue" | "onValueChange" | "children">, {
|
|
5
13
|
name?: string;
|
|
6
|
-
|
|
14
|
+
value?: ExtractValue<Item>;
|
|
15
|
+
defaultValue?: ExtractValue<Item>;
|
|
16
|
+
onValueChange?: (value: ExtractValue<Item> | undefined) => void;
|
|
7
17
|
onBlur?: React.FocusEventHandler<HTMLSelectElement>;
|
|
18
|
+
items: Item[];
|
|
19
|
+
placeholder?: string;
|
|
8
20
|
clearable?: boolean;
|
|
21
|
+
className?: string;
|
|
22
|
+
contentClassName?: string;
|
|
23
|
+
renderItem?: (value: ExtractValue<Item>) => React.ReactNode;
|
|
9
24
|
}>;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
declare const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
declare const SelectItem: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectItemProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
19
|
-
declare const SelectSeparator: React.ForwardRefExoticComponent<Omit<SelectPrimitive.SelectSeparatorProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
20
|
-
export { Select, SelectGroup, SelectValue, SelectTrigger, SelectContent, SelectLabel, SelectItem, SelectSeparator, SelectScrollUpButton, SelectScrollDownButton, };
|
|
25
|
+
type SelectProps<Item> = ExtractValue<Item> extends string | number ? SelectPropsBase<Item> & {
|
|
26
|
+
valueKey?: (value: ExtractValue<Item>) => string;
|
|
27
|
+
} : SelectPropsBase<Item> & {
|
|
28
|
+
valueKey: (value: ExtractValue<Item>) => string;
|
|
29
|
+
};
|
|
30
|
+
declare const Select: <Item>(props: SelectProps<Item> & React.RefAttributes<HTMLSelectElement>) => React.ReactElement;
|
|
31
|
+
export { Select };
|
|
32
|
+
export type { SelectProps, SelectItemDef, ExtractValue };
|
package/dist/contexts/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { type SonamuContextValue, SonamuProvider,
|
|
1
|
+
export { type SonamuContextValue, SonamuProvider, useSonamuBaseContext, } from './sonamu-context';
|
|
2
2
|
export type { Dictionary, SDReturnType, SonamuAuth, SonamuFile } from './types';
|
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { Dictionary, SDReturnType, SonamuAuth, SonamuFile } from './types';
|
|
3
|
-
export interface SonamuContextValue<D extends Dictionary = Dictionary> {
|
|
3
|
+
export interface SonamuContextValue<D extends Dictionary = Dictionary, TUser = any, TLoginParams = any> {
|
|
4
4
|
uploader?: (files: File[]) => Promise<SonamuFile[]>;
|
|
5
|
-
auth?: SonamuAuth
|
|
5
|
+
auth?: SonamuAuth<TUser, TLoginParams>;
|
|
6
6
|
SD?: <K extends keyof D>(key: K) => SDReturnType<D, K>;
|
|
7
7
|
}
|
|
8
|
-
export interface SonamuProviderProps<D extends Dictionary = Dictionary> extends SonamuContextValue<D> {
|
|
8
|
+
export interface SonamuProviderProps<D extends Dictionary = Dictionary, TUser = any, TLoginParams = any> extends SonamuContextValue<D, TUser, TLoginParams> {
|
|
9
9
|
children: ReactNode;
|
|
10
10
|
}
|
|
11
|
-
export declare function SonamuProvider<D extends Dictionary = Dictionary>({ children, ...value }: SonamuProviderProps<D>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
|
|
11
|
+
export declare function SonamuProvider<D extends Dictionary = Dictionary, TUser = any, TLoginParams = any>({ children, ...value }: SonamuProviderProps<D, TUser, TLoginParams>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
/**
|
|
13
|
+
* 타입이 지정된 useSonamuContext를 만들기 위한 베이스 훅
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // contexts/sonamu-provider.tsx
|
|
17
|
+
* export function useSonamuContext() {
|
|
18
|
+
* return useSonamuBaseContext<MergedDictionary, UserSubsetSS, UserLoginParams>();
|
|
19
|
+
* }
|
|
20
|
+
*/
|
|
21
|
+
export declare function useSonamuBaseContext<D extends Dictionary = Dictionary, TUser = any, TLoginParams = any>(): Required<SonamuContextValue<D, TUser, TLoginParams>>;
|