@youngduck/yd-ui 0.17.1 → 0.18.1

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.
Files changed (27) hide show
  1. package/dist/index.cjs.js +5 -5
  2. package/dist/index.cjs.js.map +1 -1
  3. package/dist/index.css +1 -1
  4. package/dist/index.d.ts +136 -10
  5. package/dist/index.esm.js +5 -5
  6. package/dist/index.esm.js.map +1 -1
  7. package/dist/types/components/Calendars/DatePicker/DatePicker.d.ts +24 -0
  8. package/dist/types/components/Calendars/DatePicker/DatePicker.stories.d.ts +11 -0
  9. package/dist/types/components/Calendars/MonthPicker/MonthPicker.d.ts +24 -0
  10. package/dist/types/components/Calendars/MonthPicker/MonthPicker.stories.d.ts +10 -0
  11. package/dist/types/components/Calendars/YearPicker/YearPicker.d.ts +24 -0
  12. package/dist/types/components/Calendars/YearPicker/YearPicker.stories.d.ts +10 -0
  13. package/dist/types/components/Calendars/hooks/usePickerDropdown.d.ts +15 -0
  14. package/dist/types/components/Calendars/index.d.ts +6 -0
  15. package/dist/types/components/Calendars/utils/calendarDate.d.ts +46 -0
  16. package/dist/types/components/Input/Input.d.ts +3 -4
  17. package/dist/types/components/Inputs/Input/Input.d.ts +21 -0
  18. package/dist/types/components/Inputs/Input/Input.stories.d.ts +11 -0
  19. package/dist/types/components/Inputs/NumberInput/NumberInput.d.ts +38 -0
  20. package/dist/types/components/Inputs/NumberInput/NumberInput.stories.d.ts +11 -0
  21. package/dist/types/components/Inputs/index.d.ts +4 -0
  22. package/dist/types/components/NumberInput/NumberInput.d.ts +38 -0
  23. package/dist/types/components/NumberInput/NumberInput.stories.d.ts +11 -0
  24. package/dist/types/components/Tabs/Tabs.d.ts +26 -0
  25. package/dist/types/components/Tabs/Tabs.stories.d.ts +17 -0
  26. package/dist/types/components/index.d.ts +6 -1
  27. package/package.json +5 -2
@@ -0,0 +1,10 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { YearPicker } from './YearPicker';
3
+ declare const meta: Meta<typeof YearPicker>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof YearPicker>;
6
+ export declare const Default: Story;
7
+ export declare const WithDefaultValue: Story;
8
+ export declare const WithYearRange: Story;
9
+ export declare const AllSizes: Story;
10
+ export declare const Disabled: Story;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * 달력 피커 공통 드롭다운 훅.
3
+ * 패널 열림/닫힘 상태와 바깥 클릭·Escape 닫기를 담당하고,
4
+ * 키보드로 닫을 때는 트리거로 포커스를 복귀시킵니다.
5
+ * 패널이 열려 있는 동안 Tab 포커스는 패널 안에서 순환합니다. (dialog 패턴)
6
+ */
7
+ export declare function usePickerDropdown(): {
8
+ isOpen: boolean;
9
+ containerRef: import("react").RefObject<HTMLDivElement | null>;
10
+ triggerRef: import("react").RefObject<HTMLButtonElement | null>;
11
+ panelRef: import("react").RefObject<HTMLDivElement | null>;
12
+ toggle: () => void;
13
+ close: (focusTrigger?: boolean) => void;
14
+ handlePanelKeyDown: (event: React.KeyboardEvent<HTMLDivElement>) => void;
15
+ };
@@ -0,0 +1,6 @@
1
+ export { YearPicker } from './YearPicker/YearPicker';
2
+ export type { YearPickerSize } from './YearPicker/YearPicker';
3
+ export { MonthPicker } from './MonthPicker/MonthPicker';
4
+ export type { MonthPickerSize } from './MonthPicker/MonthPicker';
5
+ export { DatePicker } from './DatePicker/DatePicker';
6
+ export type { DatePickerSize } from './DatePicker/DatePicker';
@@ -0,0 +1,46 @@
1
+ /**
2
+ * 달력(Calendars) 공통 날짜 유틸.
3
+ * Date 객체 대신 { year, month, day } 숫자 값으로 계산합니다. (month: 1~12)
4
+ */
5
+ /** 요일 라벨 (일요일 시작) */
6
+ export declare const CALENDAR_WEEKDAY_LABELS: string[];
7
+ /** 숫자를 두 자리 문자열로 변환 (7 → '07') */
8
+ export declare const pad2: (value: number) => string;
9
+ /** 'YYYY' 형식 문자열을 연도 숫자로 변환. 형식이 다르면 null */
10
+ export declare const parseYearValue: (value: string) => number | null;
11
+ /** 'YYYY-MM' 형식 문자열을 { year, month } 로 변환. 형식이 다르면 null */
12
+ export declare const parseYearMonthValue: (value: string) => {
13
+ year: number;
14
+ month: number;
15
+ } | null;
16
+ /** 'YYYY-MM-DD' 형식 문자열을 { year, month, day } 로 변환. 달력상 존재하지 않는 날짜면 null */
17
+ export declare const parseDateValue: (value: string) => {
18
+ year: number;
19
+ month: number;
20
+ day: number;
21
+ } | null;
22
+ /** 연도를 'YYYY' 값 문자열로 변환 */
23
+ export declare const formatYearValue: (year: number) => string;
24
+ /** 연/월을 'YYYY-MM' 값 문자열로 변환 */
25
+ export declare const formatYearMonthValue: (year: number, month: number) => string;
26
+ /** 연/월/일을 'YYYY-MM-DD' 값 문자열로 변환 */
27
+ export declare const formatDateValue: (year: number, month: number, day: number) => string;
28
+ /** 해당 월의 일수 */
29
+ export declare const getDaysInMonth: (year: number, month: number) => number;
30
+ /** 해당 월 1일의 요일 (0: 일요일 ~ 6: 토요일) */
31
+ export declare const getFirstWeekday: (year: number, month: number) => number;
32
+ /** 오늘 날짜 */
33
+ export declare const getToday: () => {
34
+ year: number;
35
+ month: number;
36
+ day: number;
37
+ };
38
+ /** 연도를 minYear ~ maxYear 범위로 제한 */
39
+ export declare const clampYear: (year: number, minYear: number, maxYear: number) => number;
40
+ /**
41
+ * 그리드 키보드 탐색 공통 계산.
42
+ * 좌우 방향키는 한 칸, 상하 방향키는 한 행(cols) 단위로 이동하고
43
+ * Home / End 는 현재 행의 처음 / 끝으로 이동합니다.
44
+ * 탐색 키가 아니면 null, 더 이동할 수 없으면 현재 인덱스를 반환합니다.
45
+ */
46
+ export declare const moveGridFocus: (index: number, count: number, cols: number, key: string) => number | null;
@@ -1,21 +1,20 @@
1
1
  /**
2
2
  * 작성자: KYD
3
3
  * 기능: 사용자 입력을 받는 기본 입력 필드 컴포넌트
4
- * 프로세스 설명: 검색, 텍스트 입력, 폼 입력 등에 사용
4
+ * 프로세스 설명: 검색, 텍스트 입력, 폼 입력 등에 사용. 색상·간격·타이포그래피는 디자인 토큰에서 일괄 적용
5
5
  */
6
6
  import React from 'react';
7
7
  import { type VariantProps } from 'class-variance-authority';
8
8
  declare const inputVariants: (props?: ({
9
9
  size?: "sm" | "md" | "lg" | "full" | null | undefined;
10
- color?: "primary-400" | "primary-100" | "white" | null | undefined;
10
+ color?: "white" | "primary-400" | "primary-100" | null | undefined;
11
11
  variant?: "search" | "input" | null | undefined;
12
- disabled?: boolean | null | undefined;
13
12
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
14
13
  export type InputSize = VariantProps<typeof inputVariants>['size'];
15
14
  export type InputColor = VariantProps<typeof inputVariants>['color'];
16
15
  export type InputVariant = VariantProps<typeof inputVariants>['variant'];
17
16
  export type InputProps = {} & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'color'> & VariantProps<typeof inputVariants>;
18
- export declare function Input({ size, color, variant, disabled, ...props }: InputProps): import("react/jsx-runtime").JSX.Element;
17
+ export declare function Input({ size, color, variant, disabled, className, ...props }: InputProps): import("react/jsx-runtime").JSX.Element;
19
18
  export declare namespace Input {
20
19
  var displayName: string;
21
20
  }
@@ -0,0 +1,21 @@
1
+ /**
2
+ * 작성자: KYD
3
+ * 기능: 사용자 입력을 받는 기본 입력 필드 컴포넌트
4
+ * 프로세스 설명: 검색, 텍스트 입력, 폼 입력 등에 사용. 색상·간격·타이포그래피는 디자인 토큰에서 일괄 적용
5
+ */
6
+ import React from 'react';
7
+ import { type VariantProps } from 'class-variance-authority';
8
+ declare const inputVariants: (props?: ({
9
+ size?: "sm" | "md" | "lg" | "full" | null | undefined;
10
+ color?: "white" | "primary-400" | "primary-100" | null | undefined;
11
+ variant?: "search" | "input" | null | undefined;
12
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
13
+ export type InputSize = VariantProps<typeof inputVariants>['size'];
14
+ export type InputColor = VariantProps<typeof inputVariants>['color'];
15
+ export type InputVariant = VariantProps<typeof inputVariants>['variant'];
16
+ export type InputProps = {} & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'size' | 'color'> & VariantProps<typeof inputVariants>;
17
+ export declare function Input({ size, color, variant, disabled, className, ...props }: InputProps): import("react/jsx-runtime").JSX.Element;
18
+ export declare namespace Input {
19
+ var displayName: string;
20
+ }
21
+ export {};
@@ -0,0 +1,11 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { Input } from './Input';
3
+ declare const meta: Meta<typeof Input>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Input>;
6
+ export declare const Default: Story;
7
+ export declare const SearchVariant: Story;
8
+ export declare const AllSizes: Story;
9
+ export declare const AllColors: Story;
10
+ export declare const Disabled: Story;
11
+ export declare const Controlled: Story;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * 작성자: KYD
3
+ * 기능: 금액·수량 등 숫자 전용 입력 필드 컴포넌트
4
+ * 프로세스 설명: type="number" 의 네이티브 스핀 버튼·휠 증감 문제를 피하기 위해
5
+ * type="text" + inputMode="numeric" 조합에 천단위 콤마 포맷팅을 얹은 spinbutton 패턴입니다.
6
+ * 값은 콤마 없는 숫자 문자열('400000')로 전달됩니다. (0 이상 정수만 지원)
7
+ */
8
+ import React from 'react';
9
+ import { type VariantProps } from 'class-variance-authority';
10
+ declare const numberInputVariants: (props?: ({
11
+ size?: "sm" | "md" | "lg" | "full" | null | undefined;
12
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
13
+ export type NumberInputSize = VariantProps<typeof numberInputVariants>['size'];
14
+ type NumberInputProps = {
15
+ /** 현재 값 (콤마 없는 숫자 문자열, 미입력 시 빈 문자열) */
16
+ value: string;
17
+ /** 값이 변경될 때 호출 (콤마 없는 숫자 문자열 전달) */
18
+ onValueChange: (value: string) => void;
19
+ /** 최소값 (blur 시 보정, 방향키 증감 하한) */
20
+ min?: number;
21
+ /** 최대값 (blur 시 보정, 방향키 증감 상한) */
22
+ max?: number;
23
+ /** 방향키(↑/↓) 증감 단위 */
24
+ step?: number;
25
+ /** 입력 앞에 표시할 단위 문구 (예: '₩') */
26
+ prefix?: string;
27
+ /** 입력 뒤에 표시할 단위 문구 (예: '원') */
28
+ suffix?: string;
29
+ /** 텍스트 정렬 (숫자 관례상 기본 우측 정렬) */
30
+ align?: 'left' | 'right';
31
+ /** 입력 필드 비활성화 여부 */
32
+ disabled?: boolean;
33
+ } & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange' | 'size' | 'type' | 'prefix' | 'min' | 'max' | 'step'> & VariantProps<typeof numberInputVariants>;
34
+ export declare function NumberInput({ value, onValueChange, min, max, step, prefix, suffix, align, disabled, size, className, onBlur, onKeyDown, ...props }: NumberInputProps): import("react/jsx-runtime").JSX.Element;
35
+ export declare namespace NumberInput {
36
+ var displayName: string;
37
+ }
38
+ export {};
@@ -0,0 +1,11 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { NumberInput } from './NumberInput';
3
+ declare const meta: Meta<typeof NumberInput>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof NumberInput>;
6
+ export declare const Default: Story;
7
+ export declare const WithSuffix: Story;
8
+ export declare const WithMinMaxStep: Story;
9
+ export declare const AllSizes: Story;
10
+ export declare const Disabled: Story;
11
+ export declare const BudgetExample: Story;
@@ -0,0 +1,4 @@
1
+ export { Input } from './Input/Input';
2
+ export type { InputSize, InputColor, InputVariant } from './Input/Input';
3
+ export { NumberInput } from './NumberInput/NumberInput';
4
+ export type { NumberInputSize } from './NumberInput/NumberInput';
@@ -0,0 +1,38 @@
1
+ /**
2
+ * 작성자: KYD
3
+ * 기능: 금액·수량 등 숫자 전용 입력 필드 컴포넌트
4
+ * 프로세스 설명: type="number" 의 네이티브 스핀 버튼·휠 증감 문제를 피하기 위해
5
+ * type="text" + inputMode="numeric" 조합에 천단위 콤마 포맷팅을 얹은 spinbutton 패턴입니다.
6
+ * 값은 콤마 없는 숫자 문자열('400000')로 전달됩니다. (0 이상 정수만 지원)
7
+ */
8
+ import React from 'react';
9
+ import { type VariantProps } from 'class-variance-authority';
10
+ declare const numberInputVariants: (props?: ({
11
+ size?: "sm" | "md" | "lg" | "full" | null | undefined;
12
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
13
+ export type NumberInputSize = VariantProps<typeof numberInputVariants>['size'];
14
+ type NumberInputProps = {
15
+ /** 현재 값 (콤마 없는 숫자 문자열, 미입력 시 빈 문자열) */
16
+ value: string;
17
+ /** 값이 변경될 때 호출 (콤마 없는 숫자 문자열 전달) */
18
+ onValueChange: (value: string) => void;
19
+ /** 최소값 (blur 시 보정, 방향키 증감 하한) */
20
+ min?: number;
21
+ /** 최대값 (blur 시 보정, 방향키 증감 상한) */
22
+ max?: number;
23
+ /** 방향키(↑/↓) 증감 단위 */
24
+ step?: number;
25
+ /** 입력 앞에 표시할 단위 문구 (예: '₩') */
26
+ prefix?: string;
27
+ /** 입력 뒤에 표시할 단위 문구 (예: '원') */
28
+ suffix?: string;
29
+ /** 텍스트 정렬 (숫자 관례상 기본 우측 정렬) */
30
+ align?: 'left' | 'right';
31
+ /** 입력 필드 비활성화 여부 */
32
+ disabled?: boolean;
33
+ } & Omit<React.InputHTMLAttributes<HTMLInputElement>, 'value' | 'onChange' | 'size' | 'type' | 'prefix' | 'min' | 'max' | 'step'> & VariantProps<typeof numberInputVariants>;
34
+ export declare function NumberInput({ value, onValueChange, min, max, step, prefix, suffix, align, disabled, size, className, onBlur, onKeyDown, ...props }: NumberInputProps): import("react/jsx-runtime").JSX.Element;
35
+ export declare namespace NumberInput {
36
+ var displayName: string;
37
+ }
38
+ export {};
@@ -0,0 +1,11 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { NumberInput } from './NumberInput';
3
+ declare const meta: Meta<typeof NumberInput>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof NumberInput>;
6
+ export declare const Default: Story;
7
+ export declare const WithSuffix: Story;
8
+ export declare const WithMinMaxStep: Story;
9
+ export declare const AllSizes: Story;
10
+ export declare const Disabled: Story;
11
+ export declare const BudgetExample: Story;
@@ -0,0 +1,26 @@
1
+ import { type VariantProps } from 'class-variance-authority';
2
+ declare const tabsVariants: (props?: ({
3
+ size?: "sm" | "md" | "lg" | null | undefined;
4
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
5
+ export type TabsSize = VariantProps<typeof tabsVariants>['size'];
6
+ export type TabOption = {
7
+ /** 화면에 노출되는 라벨 */
8
+ label: string;
9
+ /** 선택 값으로 사용되는 고유 값 */
10
+ value: string;
11
+ /** 개별 탭 비활성화 여부 */
12
+ disabled?: boolean;
13
+ };
14
+ type TabsProps = {
15
+ /** 탭 항목 목록 */
16
+ options: TabOption[];
17
+ /** 현재 선택된 값 (제어 컴포넌트) */
18
+ value: string;
19
+ /** 값이 변경될 때 호출 */
20
+ onValueChange: (value: string) => void;
21
+ } & Omit<React.ComponentPropsWithoutRef<'div'>, 'onChange'> & VariantProps<typeof tabsVariants>;
22
+ export declare function Tabs({ options, value, onValueChange, size, className, ...props }: TabsProps): import("react/jsx-runtime").JSX.Element;
23
+ export declare namespace Tabs {
24
+ var displayName: string;
25
+ }
26
+ export {};
@@ -0,0 +1,17 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { Tabs } from './Tabs';
3
+ declare const meta: Meta<typeof Tabs>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof Tabs>;
6
+ export declare const Default: Story;
7
+ export declare const AllSizes: Story;
8
+ export declare const WithDisabledTab: Story;
9
+ export declare const Examples: {
10
+ parameters: {
11
+ layout: string;
12
+ docs: {
13
+ disable: boolean;
14
+ };
15
+ };
16
+ render: () => import("react/jsx-runtime").JSX.Element;
17
+ };
@@ -1,6 +1,11 @@
1
1
  export { Button } from './Button/Button';
2
2
  export { Card } from './Card/Card';
3
3
  export { Chips } from './Chips/Chips';
4
- export { Input } from './Input/Input';
4
+ export { Input, NumberInput } from './Inputs';
5
+ export type { InputSize, InputColor, InputVariant, NumberInputSize } from './Inputs';
5
6
  export { CheckBox } from './CheckBox/CheckBox';
6
7
  export { SelectBox, useSelectBox } from './SelectBox';
8
+ export { Tabs } from './Tabs/Tabs';
9
+ export type { TabsSize, TabOption } from './Tabs/Tabs';
10
+ export { YearPicker, MonthPicker, DatePicker } from './Calendars';
11
+ export type { YearPickerSize, MonthPickerSize, DatePickerSize } from './Calendars';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@youngduck/yd-ui",
3
- "version": "0.17.1",
3
+ "version": "0.18.1",
4
4
  "type": "module",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.js",
@@ -30,7 +30,10 @@
30
30
  "./dist/*": "./dist/*",
31
31
  "./package.json": "./package.json"
32
32
  },
33
- "files": ["dist", "dist/index.css"],
33
+ "files": [
34
+ "dist",
35
+ "dist/index.css"
36
+ ],
34
37
  "scripts": {
35
38
  "build": "rollup -c",
36
39
  "watch": "rollup -c -w",