@youngduck/yd-ui 0.16.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.
- package/dist/HorizonDragScroll.cjs.js +1 -1
- package/dist/HorizonDragScroll.cjs.js.map +1 -1
- package/dist/HorizonDragScroll.d.ts +5 -2
- package/dist/HorizonDragScroll.esm.js +1 -1
- package/dist/HorizonDragScroll.esm.js.map +1 -1
- package/dist/Overlays.cjs.js +3 -1
- package/dist/Overlays.cjs.js.map +1 -1
- package/dist/Overlays.esm.js +3 -1
- package/dist/Overlays.esm.js.map +1 -1
- package/dist/index.cjs.js +5 -5
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +136 -4
- package/dist/index.esm.js +5 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/types/components/Calendars/DatePicker/DatePicker.d.ts +24 -0
- package/dist/types/components/Calendars/DatePicker/DatePicker.stories.d.ts +11 -0
- package/dist/types/components/Calendars/MonthPicker/MonthPicker.d.ts +24 -0
- package/dist/types/components/Calendars/MonthPicker/MonthPicker.stories.d.ts +10 -0
- package/dist/types/components/Calendars/YearPicker/YearPicker.d.ts +24 -0
- package/dist/types/components/Calendars/YearPicker/YearPicker.stories.d.ts +10 -0
- package/dist/types/components/Calendars/hooks/usePickerDropdown.d.ts +15 -0
- package/dist/types/components/Calendars/index.d.ts +6 -0
- package/dist/types/components/Calendars/utils/calendarDate.d.ts +46 -0
- package/dist/types/components/HorizonDragScroll/HorizonDragScroll.d.ts +5 -2
- package/dist/types/components/HorizonDragScroll/HorizonDragScroll.stories.d.ts +1 -0
- package/dist/types/components/Input/Input.d.ts +3 -4
- package/dist/types/components/Inputs/Input/Input.d.ts +21 -0
- package/dist/types/components/Inputs/Input/Input.stories.d.ts +11 -0
- package/dist/types/components/Inputs/NumberInput/NumberInput.d.ts +38 -0
- package/dist/types/components/Inputs/NumberInput/NumberInput.stories.d.ts +11 -0
- package/dist/types/components/Inputs/index.d.ts +4 -0
- package/dist/types/components/NumberInput/NumberInput.d.ts +38 -0
- package/dist/types/components/NumberInput/NumberInput.stories.d.ts +11 -0
- package/dist/types/components/Overlays/hooks/useFocusTrap.d.ts +1 -0
- package/dist/types/components/SelectBox/SelectBox.d.ts +2 -1
- package/dist/types/components/SelectBox/hooks/useSelectBox.d.ts +5 -0
- package/dist/types/components/Tabs/Tabs.d.ts +26 -0
- package/dist/types/components/Tabs/Tabs.stories.d.ts +17 -0
- package/dist/types/components/index.d.ts +6 -1
- package/dist/types/hooks/useFocusTrap.d.ts +1 -0
- package/package.json +5 -2
|
@@ -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,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 @@
|
|
|
1
|
+
export declare function useFocusTrap<T extends HTMLElement = HTMLElement>(): import("react").RefObject<T | null>;
|
|
@@ -10,6 +10,7 @@ declare const wrapperVariants: (props?: ({
|
|
|
10
10
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
11
11
|
export type SelectBoxProps = {
|
|
12
12
|
selectBoxHook: ReturnType<typeof useSelectBox>;
|
|
13
|
+
label?: string;
|
|
13
14
|
} & VariantProps<typeof wrapperVariants>;
|
|
14
|
-
export declare function SelectBox({ size, selectBoxHook }: SelectBoxProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export declare function SelectBox({ size, selectBoxHook, label }: SelectBoxProps): import("react/jsx-runtime").JSX.Element;
|
|
15
16
|
export {};
|
|
@@ -19,10 +19,15 @@ export declare const useSelectBox: (config: UseSelectBoxConfig) => {
|
|
|
19
19
|
options: SelectBoxOption[];
|
|
20
20
|
search: boolean;
|
|
21
21
|
containerRef: import("react").RefObject<HTMLDivElement | null>;
|
|
22
|
+
highlightedIndex: number;
|
|
22
23
|
handleClickOption: (option: SelectBoxOption) => void;
|
|
23
24
|
handleToggle: () => void;
|
|
24
25
|
handleSearch: (value: string) => void;
|
|
25
26
|
handleClose: () => void;
|
|
27
|
+
handleTriggerKeyDown: (e: React.KeyboardEvent) => void;
|
|
28
|
+
handleOptionKeyDown: (e: React.KeyboardEvent, option: SelectBoxOption, index: number) => void;
|
|
29
|
+
listboxRef: import("react").RefObject<HTMLDivElement | null>;
|
|
30
|
+
optionRefs: import("react").RefObject<(HTMLElement | null)[]>;
|
|
26
31
|
value: string;
|
|
27
32
|
label: string;
|
|
28
33
|
hasOption: boolean;
|
|
@@ -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 './
|
|
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';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useFocusTrap<T extends HTMLElement = HTMLElement>(): import("react").RefObject<T | null>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@youngduck/yd-ui",
|
|
3
|
-
"version": "0.
|
|
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": [
|
|
33
|
+
"files": [
|
|
34
|
+
"dist",
|
|
35
|
+
"dist/index.css"
|
|
36
|
+
],
|
|
34
37
|
"scripts": {
|
|
35
38
|
"build": "rollup -c",
|
|
36
39
|
"watch": "rollup -c -w",
|