@weing-dev/ui-kit-primitive 0.5.1 → 0.5.2

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.
@@ -14,6 +14,8 @@ declare const Root: (props: ButtonProviderProps & {
14
14
  radius?: number;
15
15
  rounded?: boolean;
16
16
  circle?: boolean;
17
+ /** Button.Text/Button.Icon 색을 함께 덮어쓴다. 지정 시 colorType/variant 기본색 대신 적용 */
18
+ textColor?: string;
17
19
  } & React.JSX.IntrinsicElements["button"]) => import("react/jsx-runtime").JSX.Element;
18
20
  interface IButton {
19
21
  Text: typeof Text;
@@ -0,0 +1,5 @@
1
+ import { default as React } from 'react';
2
+ import { FloatingAnchorContextValue } from './FloatingAnchor.type';
3
+ export type { Placement, FloatingAnchorContextValue } from './FloatingAnchor.type';
4
+ export declare const FloatingAnchorContext: React.Context<FloatingAnchorContextValue | null>;
5
+ export declare const useFloatingAnchorContext: () => FloatingAnchorContextValue;
@@ -0,0 +1,14 @@
1
+ import { default as React } from 'react';
2
+ import { RootProps, TriggerProps, ContentProps } from './FloatingAnchor.type';
3
+ export type { Placement, RootProps, TriggerProps, TriggerRenderProps, ContentProps, } from './FloatingAnchor.type';
4
+ declare const Root: (props: RootProps) => import("react/jsx-runtime").JSX.Element;
5
+ declare const Trigger: (props: TriggerProps) => React.ReactNode;
6
+ /** content 내용 */
7
+ declare const Content: (props: ContentProps) => React.ReactPortal | null;
8
+ interface IFloatingAnchor {
9
+ Root: typeof Root;
10
+ Trigger: typeof Trigger;
11
+ Content: typeof Content;
12
+ }
13
+ declare const FloatingAnchor: IFloatingAnchor;
14
+ export default FloatingAnchor;
@@ -0,0 +1,41 @@
1
+ import { default as React } from 'react';
2
+ export type Placement = "top" | "top-start" | "top-end" | "bottom" | "bottom-start" | "bottom-end" | "left" | "left-start" | "left-end" | "right" | "right-start" | "right-end";
3
+ export type FloatingAnchorContextValue = {
4
+ open: boolean;
5
+ setOpen: (open: boolean) => void;
6
+ setAnchorEl: (el: HTMLElement | null) => void;
7
+ setFloatingEl: (el: HTMLElement | null) => void;
8
+ position: {
9
+ top: number;
10
+ left: number;
11
+ } | null;
12
+ contentId: string;
13
+ };
14
+ export type RootProps = {
15
+ children: React.ReactNode;
16
+ placement?: Placement;
17
+ offset?: number;
18
+ flip?: boolean;
19
+ shift?: boolean;
20
+ open?: boolean;
21
+ defaultOpen?: boolean;
22
+ onOpenChange?: (open: boolean) => void;
23
+ closeOnOutsideClick?: boolean;
24
+ closeOnEscape?: boolean;
25
+ };
26
+ export type TriggerRenderProps = {
27
+ ref: (el: HTMLElement | null) => void;
28
+ className?: string;
29
+ "aria-expanded": boolean;
30
+ "aria-controls": string;
31
+ "aria-haspopup": "dialog";
32
+ onClick: (e: React.MouseEvent) => void;
33
+ };
34
+ export type TriggerProps = {
35
+ children: (props: TriggerRenderProps) => React.ReactNode;
36
+ };
37
+ export type ContentProps = {
38
+ children: React.ReactNode;
39
+ className?: string;
40
+ portalRoot?: HTMLElement | null;
41
+ } & React.HTMLAttributes<HTMLDivElement>;
@@ -0,0 +1,43 @@
1
+ import { Placement } from './FloatingAnchor.type';
2
+ /**
3
+ * anchorRect: Trigger 요소의 DOMRect
4
+ * floatingRect: Content 요소의 크기 (width, height)
5
+ * offset: anchor와 floating 사이의 간격
6
+ * placement: 요구된 배치 (top, bottom, left, right, top-start, top-end, etc.)
7
+ * 반환값: floating 요소의 top, left 위치
8
+ * 계산 로직: placement에 따라 anchorRect를 기준으로 floatingRect의 위치 계산.
9
+ * 예를 들어, placement가 "top"이면 floating 요소는 anchor 요소의 위에 위치해야 하므로,
10
+ * top은 anchorRect.top - floatingRect.height - offset이 되고,
11
+ * left는 anchorRect.left + (anchorRect.width - floatingRect.width) / 2가 됩니다.
12
+ */
13
+ export declare const computePosition: (anchorRect: DOMRect, floatingRect: {
14
+ width: number;
15
+ height: number;
16
+ }, placement: Placement, offset: number) => {
17
+ top: number;
18
+ left: number;
19
+ };
20
+ /** 플립 */
21
+ export declare const flipPlacement: (p: Placement) => Placement;
22
+ /**
23
+ * 주축(main axis)의 넘침량을 반환.
24
+ * 반환값 0이면 주축으로는 넘치지 않음, 양수면 넘친 픽셀 수.
25
+ */
26
+ export declare const getMainAxisOverflow: (pos: {
27
+ top: number;
28
+ left: number;
29
+ }, size: {
30
+ width: number;
31
+ height: number;
32
+ }, placement: Placement, padding: number) => number;
33
+ /** 뷰포트안에 fit하도록 위치 조정 */
34
+ export declare const shiftIntoViewport: (pos: {
35
+ top: number;
36
+ left: number;
37
+ }, size: {
38
+ width: number;
39
+ height: number;
40
+ }, padding: number) => {
41
+ top: number;
42
+ left: number;
43
+ };
@@ -23,6 +23,8 @@ export type TriggerProps = React.PropsWithChildren<{
23
23
  size?: "small" | "medium" | "large";
24
24
  leftIcon?: React.ComponentProps<typeof Icon> | null;
25
25
  rightIcon?: React.ComponentProps<typeof Icon> | null;
26
+ /** 도메인 강조 보더색. 지정 시 inactive/selected/focused 보더를 이 색으로 통일(error/disabled는 우선 유지) */
27
+ accentColor?: string;
26
28
  }>;
27
29
  export type MenuRenderProps = {
28
30
  open: boolean;
@@ -0,0 +1,4 @@
1
+ import { KanbanBoardProps } from './KanbanBoard.type';
2
+ export type { KanbanColumn, KanbanBoardProps } from './KanbanBoard.type';
3
+ declare function KanbanBoard<T>(props: KanbanBoardProps<T>): import("react/jsx-runtime").JSX.Element;
4
+ export default KanbanBoard;
@@ -0,0 +1,36 @@
1
+ import { default as React } from 'react';
2
+ export type KanbanColumn = {
3
+ id: string;
4
+ label?: React.ReactNode;
5
+ accentColor?: string;
6
+ };
7
+ export type KanbanBoardProps<T> = {
8
+ columns: KanbanColumn[];
9
+ /** 카드로 표시될 아이템 목록 */
10
+ items: T[];
11
+ /** 아이템 고유 id 추출 */
12
+ getItemId: (item: T) => string;
13
+ /** 아이템이 속한 컬럼 id 추출 */
14
+ getColumnId: (item: T) => string;
15
+ /** 카드 렌더링 — 사용자가 결정 */
16
+ renderCard: (item: T, isSelected: boolean) => React.ReactNode;
17
+ /** 컬럼 헤더 커스텀. 미지정 시 기본 헤더 */
18
+ renderColumnHeader?: (column: KanbanColumn, items: T[]) => React.ReactNode;
19
+ /** 빈 컬럼 표시 텍스트 */
20
+ emptyText?: React.ReactNode;
21
+ /** 선택된 카드 id */
22
+ selectedId?: string | null;
23
+ /** 카드 클릭 시 콜백 */
24
+ onSelect?: (item: T) => void;
25
+ /**
26
+ * 카드의 컬럼(소속) 필드를 갱신한 "새 아이템"을 반환한다. DnD를 쓰려면 필요.
27
+ * 예: (deal, stage) => ({ ...deal, stage })
28
+ */
29
+ setItemColumn?: (item: T, columnId: string) => T;
30
+ /**
31
+ * DnD로 카드가 이동해 목록이 바뀌면, 재정렬된 새 배열을 받는다.
32
+ * 사용처는 보통 setState만 연결. 예: onItemsChange={setDeals}
33
+ */
34
+ onItemsChange?: (items: T[]) => void;
35
+ className?: string;
36
+ };
@@ -16,7 +16,10 @@ type PageListProps = {
16
16
  }) => React.ReactNode;
17
17
  };
18
18
  declare const PageList: (props: PageListProps) => import("react/jsx-runtime").JSX.Element | null;
19
- type RootProps = {} & Omit<PaginationContextType, "currentPage">;
19
+ type RootProps = {
20
+ /** nav에 전달. `--pagination-gap`/`--pagination-item-size`/`--pagination-radius` 등 변수 override 통로 */
21
+ style?: React.CSSProperties;
22
+ } & Omit<PaginationContextType, "currentPage">;
20
23
  declare const Root: (props: React.PropsWithChildren<RootProps>) => import("react/jsx-runtime").JSX.Element;
21
24
  interface IPagination {
22
25
  Root: typeof Root;
@@ -0,0 +1,6 @@
1
+ export type TimelineColorToken = "blue" | "pink" | "green" | "orange";
2
+ export type TimelineColorValue = {
3
+ background: string;
4
+ border: string;
5
+ };
6
+ export declare const timelineEventColors: Record<TimelineColorToken, TimelineColorValue>;
@@ -0,0 +1,4 @@
1
+ import { TimelineProps } from './Timeline.type';
2
+ export type { TimelineEvent, TimelineProps } from './Timeline.type';
3
+ declare const Timeline: (props: TimelineProps) => import("react/jsx-runtime").JSX.Element;
4
+ export default Timeline;
@@ -0,0 +1,16 @@
1
+ import { TimelineColorToken, TimelineColorValue } from './Timeline.colors';
2
+ export type TimelineEvent = {
3
+ id?: string;
4
+ startHour: string;
5
+ endHour?: string;
6
+ label: string;
7
+ color?: TimelineColorToken | TimelineColorValue;
8
+ };
9
+ export type TimelineProps = {
10
+ events: TimelineEvent[];
11
+ date: string;
12
+ startHour?: number;
13
+ endHour?: number;
14
+ className?: string;
15
+ headerClassName?: string;
16
+ };