ingred-ui 23.23.0 → 23.24.0
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/components/Calendar/Calendar/Calendar.d.ts +19 -0
- package/dist/components/Calendar/Calendar/Calendar.stories.d.ts +3 -0
- package/dist/components/Calendar/CalendarRange/CalendarRange.d.ts +31 -3
- package/dist/components/Calendar/CalendarRange/CalendarRange.stories.d.ts +4 -1
- package/dist/components/ContextMenu2/ContextMenu2.d.ts +4 -0
- package/dist/components/ContextMenu2/ContextMenu2.stories.d.ts +1 -0
- package/dist/components/DateField/DateRangeField/DateRangeField.stories.d.ts +1 -0
- package/dist/components/DateField/constants.d.ts +4 -1
- package/dist/components/DateField/utils.d.ts +33 -0
- package/dist/components/DatePicker/DatePicker.d.ts +26 -0
- package/dist/components/DatePicker/DatePicker.stories.d.ts +1 -0
- package/dist/components/DateRangePicker/DateRangePicker.d.ts +15 -0
- package/dist/components/DualListBox2/DualListBox2.stories.d.ts +1 -1
- package/dist/components/FilterComboBox/FilterComboBox.stories.d.ts +1 -1
- package/dist/components/TimeField/TimeField.d.ts +96 -0
- package/dist/components/TimeField/TimeField.stories.d.ts +12 -0
- package/dist/components/TimeField/__tests__/TimeField.test.d.ts +1 -0
- package/dist/components/TimeField/__tests__/utils.test.d.ts +1 -0
- package/dist/components/TimeField/index.d.ts +2 -0
- package/dist/components/TimeField/styled.d.ts +3 -0
- package/dist/components/TimeField/utils.d.ts +53 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/index.es.js +1100 -1098
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +1049 -1047
- package/dist/index.js.map +1 -1
- package/package.json +4 -3
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Dayjs } from "dayjs";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { PresetButton } from "../internal/Actions";
|
|
4
|
+
import { TimeFieldProps } from "../../TimeField/TimeField";
|
|
4
5
|
export type CalendarProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
5
6
|
/**
|
|
6
7
|
* 日付
|
|
@@ -53,6 +54,15 @@ export type CalendarProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
53
54
|
* 日付が変更されたときに呼ばれる関数
|
|
54
55
|
*/
|
|
55
56
|
onDateChange: (value: Dayjs) => void;
|
|
57
|
+
/**
|
|
58
|
+
* カレンダー内にTimeFieldを表示する
|
|
59
|
+
* @default false
|
|
60
|
+
*/
|
|
61
|
+
showTimeFields?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* TimeFieldのprops
|
|
64
|
+
*/
|
|
65
|
+
timeFieldProps?: Partial<TimeFieldProps>;
|
|
56
66
|
};
|
|
57
67
|
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
58
68
|
/**
|
|
@@ -106,5 +116,14 @@ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponen
|
|
|
106
116
|
* 日付が変更されたときに呼ばれる関数
|
|
107
117
|
*/
|
|
108
118
|
onDateChange: (value: Dayjs) => void;
|
|
119
|
+
/**
|
|
120
|
+
* カレンダー内にTimeFieldを表示する
|
|
121
|
+
* @default false
|
|
122
|
+
*/
|
|
123
|
+
showTimeFields?: boolean | undefined;
|
|
124
|
+
/**
|
|
125
|
+
* TimeFieldのprops
|
|
126
|
+
*/
|
|
127
|
+
timeFieldProps?: Partial<TimeFieldProps> | undefined;
|
|
109
128
|
} & React.RefAttributes<HTMLDivElement>>>;
|
|
110
129
|
export default _default;
|
|
@@ -16,6 +16,8 @@ declare const _default: {
|
|
|
16
16
|
dateFieldFormat?: string | undefined;
|
|
17
17
|
isOutsideRange?: ((date: dayjs.Dayjs) => boolean) | undefined;
|
|
18
18
|
onDateChange: (value: dayjs.Dayjs) => void;
|
|
19
|
+
showTimeFields?: boolean | undefined;
|
|
20
|
+
timeFieldProps?: Partial<import("../..").TimeFieldProps> | undefined;
|
|
19
21
|
} & React.RefAttributes<HTMLDivElement>>>;
|
|
20
22
|
};
|
|
21
23
|
export default _default;
|
|
@@ -24,3 +26,4 @@ export declare const IsOutsideRange: StoryObj<CalendarProps>;
|
|
|
24
26
|
export declare const WithPresetButtons: StoryObj<CalendarProps>;
|
|
25
27
|
export declare const WithDateField: StoryObj<CalendarProps>;
|
|
26
28
|
export declare const WithDateFieldAndPresetButtons: StoryObj<CalendarProps>;
|
|
29
|
+
export declare const WithDateFieldsAndTimeFields: StoryObj<CalendarProps>;
|
|
@@ -2,6 +2,7 @@ import dayjs, { Dayjs } from "dayjs";
|
|
|
2
2
|
import { DateRange } from "../..";
|
|
3
3
|
import React from "react";
|
|
4
4
|
import { PresetButton } from "../internal/Actions";
|
|
5
|
+
import { TimeFieldProps } from "../../TimeField/TimeField";
|
|
5
6
|
export type CalendarRangeProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
6
7
|
/**
|
|
7
8
|
* 開始日
|
|
@@ -62,7 +63,16 @@ export type CalendarRangeProps = React.HTMLAttributes<HTMLDivElement> & {
|
|
|
62
63
|
/**
|
|
63
64
|
* 日付が変更されたときに呼ばれる関数
|
|
64
65
|
*/
|
|
65
|
-
onDatesChange
|
|
66
|
+
onDatesChange?: (dates: DateRange) => void;
|
|
67
|
+
/**
|
|
68
|
+
* カレンダー内にTimeFieldを表示する
|
|
69
|
+
* @default false
|
|
70
|
+
*/
|
|
71
|
+
showTimeFields?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* TimeFieldのprops
|
|
74
|
+
*/
|
|
75
|
+
timeFieldProps?: Partial<TimeFieldProps>;
|
|
66
76
|
};
|
|
67
77
|
/**
|
|
68
78
|
* CalendarRange
|
|
@@ -129,7 +139,16 @@ export declare const CalendarRange: React.ForwardRefExoticComponent<React.HTMLAt
|
|
|
129
139
|
/**
|
|
130
140
|
* 日付が変更されたときに呼ばれる関数
|
|
131
141
|
*/
|
|
132
|
-
onDatesChange
|
|
142
|
+
onDatesChange?: ((dates: DateRange) => void) | undefined;
|
|
143
|
+
/**
|
|
144
|
+
* カレンダー内にTimeFieldを表示する
|
|
145
|
+
* @default false
|
|
146
|
+
*/
|
|
147
|
+
showTimeFields?: boolean | undefined;
|
|
148
|
+
/**
|
|
149
|
+
* TimeFieldのprops
|
|
150
|
+
*/
|
|
151
|
+
timeFieldProps?: Partial<TimeFieldProps> | undefined;
|
|
133
152
|
} & React.RefAttributes<HTMLDivElement>>;
|
|
134
153
|
export type { DateRange };
|
|
135
154
|
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
|
|
@@ -192,6 +211,15 @@ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponen
|
|
|
192
211
|
/**
|
|
193
212
|
* 日付が変更されたときに呼ばれる関数
|
|
194
213
|
*/
|
|
195
|
-
onDatesChange
|
|
214
|
+
onDatesChange?: ((dates: DateRange) => void) | undefined;
|
|
215
|
+
/**
|
|
216
|
+
* カレンダー内にTimeFieldを表示する
|
|
217
|
+
* @default false
|
|
218
|
+
*/
|
|
219
|
+
showTimeFields?: boolean | undefined;
|
|
220
|
+
/**
|
|
221
|
+
* TimeFieldのprops
|
|
222
|
+
*/
|
|
223
|
+
timeFieldProps?: Partial<TimeFieldProps> | undefined;
|
|
196
224
|
} & React.RefAttributes<HTMLDivElement>>>;
|
|
197
225
|
export default _default;
|
|
@@ -17,7 +17,9 @@ declare const _default: {
|
|
|
17
17
|
dateFieldFormat?: string | undefined;
|
|
18
18
|
onClose?: ((clickState: any) => void) | undefined;
|
|
19
19
|
isOutsideRange?: ((date: dayjs.Dayjs) => boolean) | undefined;
|
|
20
|
-
onDatesChange
|
|
20
|
+
onDatesChange?: ((dates: import("./CalendarRange").DateRange) => void) | undefined;
|
|
21
|
+
showTimeFields?: boolean | undefined;
|
|
22
|
+
timeFieldProps?: Partial<import("../..").TimeFieldProps> | undefined;
|
|
21
23
|
} & React.RefAttributes<HTMLDivElement>>>;
|
|
22
24
|
};
|
|
23
25
|
export default _default;
|
|
@@ -26,3 +28,4 @@ export declare const IsOutsideRange: StoryObj<CalendarRangeProps>;
|
|
|
26
28
|
export declare const WithPresetButtons: StoryObj<CalendarRangeProps>;
|
|
27
29
|
export declare const WithDateField: StoryObj<CalendarRangeProps>;
|
|
28
30
|
export declare const WithDateFieldAndPresetButtons: StoryObj<CalendarRangeProps>;
|
|
31
|
+
export declare const WithDateFieldsAndTimeFields: StoryObj<CalendarRangeProps>;
|
|
@@ -10,6 +10,7 @@ declare const _default: {
|
|
|
10
10
|
}, "button">;
|
|
11
11
|
width?: number | undefined;
|
|
12
12
|
minWidth?: number | undefined;
|
|
13
|
+
maxHeight?: string | number | undefined;
|
|
13
14
|
children: React.ReactNode;
|
|
14
15
|
onOpenChange?: ((open: boolean) => void) | undefined;
|
|
15
16
|
stickyHeader?: React.ReactNode;
|
|
@@ -14,3 +14,4 @@ export declare const Disable: StoryObj<DateRangeFieldProps>;
|
|
|
14
14
|
export declare const Small: StoryObj<DateRangeFieldProps>;
|
|
15
15
|
export declare const Large: StoryObj<DateRangeFieldProps>;
|
|
16
16
|
export declare const Dark: StoryObj<DateRangeFieldProps>;
|
|
17
|
+
export declare const WithTimeFormat: StoryObj<DateRangeFieldProps>;
|
|
@@ -17,6 +17,9 @@ export declare const AllowedKeys: {
|
|
|
17
17
|
readonly "8": "8";
|
|
18
18
|
readonly "9": "9";
|
|
19
19
|
};
|
|
20
|
+
export declare const numpadCodes: string[];
|
|
20
21
|
export declare const numberKeys: string[];
|
|
21
|
-
export declare const allowedKeys: ("0" | "1" | "4" | "2" | "3" | "5" | "
|
|
22
|
+
export declare const allowedKeys: ("0" | "1" | "4" | "2" | "3" | "5" | "ArrowDown" | "ArrowUp" | "Backspace" | "Delete" | "ArrowLeft" | "ArrowRight" | "Tab" | "6" | "7" | "8" | "9")[];
|
|
23
|
+
export declare const isNumpadKey: (code: string) => boolean;
|
|
24
|
+
export declare const getNumpadNumber: (code: string) => string | null;
|
|
22
25
|
export type AllowedKeys = (typeof AllowedKeys)[keyof typeof AllowedKeys];
|
|
@@ -23,4 +23,37 @@ export declare const getSections: (formattedDate?: string | null) => Sections[];
|
|
|
23
23
|
* 開始位置と終了位置と値を持つセクションをフォーマットされた日付に変換する
|
|
24
24
|
*/
|
|
25
25
|
export declare const formatString: (sectionsWithCharacter: Sections[]) => string;
|
|
26
|
+
/**
|
|
27
|
+
* セクションの種類を判定する
|
|
28
|
+
*
|
|
29
|
+
* セクションとは、日付フォーマットを編集可能な部分に分割した単位のことです。
|
|
30
|
+
* 例: "2023-01-02" -> [
|
|
31
|
+
* { value: "2023", editable: true }, // 年セクション
|
|
32
|
+
* { value: "-", editable: false }, // 区切り文字
|
|
33
|
+
* { value: "01", editable: true }, // 月セクション
|
|
34
|
+
* { value: "-", editable: false }, // 区切り文字
|
|
35
|
+
* { value: "02", editable: true } // 日セクション
|
|
36
|
+
* ]
|
|
37
|
+
*
|
|
38
|
+
* @param sectionLength セクションの値の長さ
|
|
39
|
+
* @param format 日付フォーマット
|
|
40
|
+
* @param sectionIndex セクションのインデックス
|
|
41
|
+
* @returns "year" | "month" | "day" | "unknown"
|
|
42
|
+
*/
|
|
43
|
+
export declare const getSectionType: (sectionLength: number, format: string, sectionIndex: number) => "year" | "month" | "day" | "unknown";
|
|
44
|
+
/**
|
|
45
|
+
* 入力が確定すべきかを判定
|
|
46
|
+
*
|
|
47
|
+
* セクションの種類に応じて、1桁目の入力で確定すべきかを判定します。
|
|
48
|
+
* - 年: 4桁入力完了で確定
|
|
49
|
+
* - 月: 1桁目が2-9なら即確定、0-1なら2桁目待ち
|
|
50
|
+
* - 日: 1桁目が4-9なら即確定、0-3なら2桁目待ち
|
|
51
|
+
*
|
|
52
|
+
* @param inputNumber 入力された数字
|
|
53
|
+
* @param keyDownCount 現在の入力カウント
|
|
54
|
+
* @param sectionType セクションの種類(年・月・日)
|
|
55
|
+
* @param sectionLength セクションの値の長さ
|
|
56
|
+
* @returns true: 確定して次のセクションへ移動, false: まだ入力を受け付ける
|
|
57
|
+
*/
|
|
58
|
+
export declare const shouldMoveToNextSection: (inputNumber: string, keyDownCount: number, sectionType: "year" | "month" | "day" | "unknown", sectionLength: number) => boolean;
|
|
26
59
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { PresetButton } from "../Calendar/internal/Actions";
|
|
3
3
|
import { Dayjs } from "dayjs";
|
|
4
|
+
import { TimeFieldProps } from "../TimeField/TimeField";
|
|
4
5
|
import { InputSize, InputVariant } from "../Input/types";
|
|
5
6
|
export type DatePickerProps = {
|
|
6
7
|
/**
|
|
@@ -85,6 +86,31 @@ export type DatePickerProps = {
|
|
|
85
86
|
* 日付が変更されたときに呼ばれる関数
|
|
86
87
|
*/
|
|
87
88
|
onDateChange: (date: Dayjs) => void;
|
|
89
|
+
/**
|
|
90
|
+
* 日付範囲が変更されたときに呼ばれる関数(useCalendarRange=trueの時)
|
|
91
|
+
*/
|
|
92
|
+
onDatesChange?: (dates: {
|
|
93
|
+
startDate: Dayjs;
|
|
94
|
+
endDate: Dayjs;
|
|
95
|
+
}) => void;
|
|
96
|
+
/**
|
|
97
|
+
* 終了日付(useCalendarRange=trueの時)
|
|
98
|
+
*/
|
|
99
|
+
endDate?: Dayjs;
|
|
100
|
+
/**
|
|
101
|
+
* カレンダー内にTimeFieldを表示する
|
|
102
|
+
* @default false
|
|
103
|
+
*/
|
|
104
|
+
showTimeFields?: boolean;
|
|
105
|
+
/**
|
|
106
|
+
* TimeFieldのprops
|
|
107
|
+
*/
|
|
108
|
+
timeFieldProps?: Partial<TimeFieldProps>;
|
|
109
|
+
/**
|
|
110
|
+
* CalendarRangeを使用するかどうか
|
|
111
|
+
* @default false
|
|
112
|
+
*/
|
|
113
|
+
useCalendarRange?: boolean;
|
|
88
114
|
};
|
|
89
115
|
export declare const DatePicker: React.ForwardRefExoticComponent<DatePickerProps & React.RefAttributes<HTMLDivElement>>;
|
|
90
116
|
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<DatePickerProps & React.RefAttributes<HTMLDivElement>>>;
|
|
@@ -21,3 +21,4 @@ export declare const LargeSize: StoryObj<DatePickerProps>;
|
|
|
21
21
|
export declare const DarkVariant: StoryObj<DatePickerProps>;
|
|
22
22
|
export declare const WithDateFields: StoryObj<DatePickerProps>;
|
|
23
23
|
export declare const WithDateFieldsAndPresetButtons: StoryObj<DatePickerProps>;
|
|
24
|
+
export declare const WithDateFieldsAndTimeFields: StoryObj<DatePickerProps>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { Dayjs } from "dayjs";
|
|
3
3
|
import { PresetButton } from "../Calendar/internal/Actions";
|
|
4
|
+
import { TimeFieldProps } from "../TimeField/TimeField";
|
|
4
5
|
import { InputSize, InputVariant } from "../Input/types";
|
|
5
6
|
export type DateRange = {
|
|
6
7
|
startDate: Dayjs;
|
|
@@ -85,6 +86,20 @@ export type DateRangePickerProps = {
|
|
|
85
86
|
* 日付が変更されたときに呼ばれる関数
|
|
86
87
|
*/
|
|
87
88
|
onDatesChange: (dates: DateRange) => void;
|
|
89
|
+
/**
|
|
90
|
+
* カレンダー内にTimeFieldを表示する
|
|
91
|
+
* @default false
|
|
92
|
+
*/
|
|
93
|
+
showTimeFields?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* TimeFieldのprops
|
|
96
|
+
*/
|
|
97
|
+
timeFieldProps?: Partial<TimeFieldProps>;
|
|
98
|
+
/**
|
|
99
|
+
* 日付の表示フォーマット
|
|
100
|
+
* @default "YYYY-MM-DD"
|
|
101
|
+
*/
|
|
102
|
+
format?: string;
|
|
88
103
|
};
|
|
89
104
|
export declare const DateRangePicker: React.ForwardRefExoticComponent<DateRangePickerProps & React.RefAttributes<HTMLDivElement>>;
|
|
90
105
|
declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<DateRangePickerProps & React.RefAttributes<HTMLDivElement>>>;
|
|
@@ -32,8 +32,8 @@ declare const meta: {
|
|
|
32
32
|
fn: (state: {
|
|
33
33
|
x: number;
|
|
34
34
|
y: number;
|
|
35
|
-
platform: import("@floating-ui/core").Platform;
|
|
36
35
|
placement: import("@floating-ui/utils").Placement;
|
|
36
|
+
platform: import("@floating-ui/core").Platform;
|
|
37
37
|
strategy: import("@floating-ui/utils").Strategy;
|
|
38
38
|
initialPlacement: import("@floating-ui/utils").Placement;
|
|
39
39
|
middlewareData: import("@floating-ui/core").MiddlewareData;
|
|
@@ -28,8 +28,8 @@ declare const meta: {
|
|
|
28
28
|
fn: (state: {
|
|
29
29
|
x: number;
|
|
30
30
|
y: number;
|
|
31
|
-
platform: import("@floating-ui/core").Platform;
|
|
32
31
|
placement: import("@floating-ui/utils").Placement;
|
|
32
|
+
platform: import("@floating-ui/core").Platform;
|
|
33
33
|
strategy: import("@floating-ui/utils").Strategy;
|
|
34
34
|
initialPlacement: import("@floating-ui/utils").Placement;
|
|
35
35
|
middlewareData: import("@floating-ui/core").MiddlewareData;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Dayjs } from "dayjs";
|
|
3
|
+
/**
|
|
4
|
+
* 時刻入力コンポーネント
|
|
5
|
+
*
|
|
6
|
+
* キーボード入力とドロップダウン選択の両方で時刻を入力できます。
|
|
7
|
+
* - キーボード入力: セクション(時、分)ごとに上下キーで増減、数字キーで直接入力
|
|
8
|
+
* - ドロップダウン: 矢印アイコンをクリックして時刻リストから選択
|
|
9
|
+
* - フィルター: filterTimeOptionsで選択可能な時刻をカスタマイズ可能
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```tsx
|
|
13
|
+
* const [time, setTime] = useState(dayjs().hour(9).minute(0));
|
|
14
|
+
*
|
|
15
|
+
* <TimeField
|
|
16
|
+
* time={time}
|
|
17
|
+
* onTimeChange={setTime}
|
|
18
|
+
* dropdownInterval={30}
|
|
19
|
+
* filterTimeOptions={[
|
|
20
|
+
* (time) => {
|
|
21
|
+
* const hour = parseInt(time.split(":")[0]);
|
|
22
|
+
* return hour >= 9 && hour < 18; // 9時〜18時のみ
|
|
23
|
+
* }
|
|
24
|
+
* ]}
|
|
25
|
+
* />
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
export type TimeFieldProps = {
|
|
29
|
+
/**
|
|
30
|
+
* 時刻
|
|
31
|
+
* @default dayjs()
|
|
32
|
+
*/
|
|
33
|
+
time?: Dayjs | null;
|
|
34
|
+
/**
|
|
35
|
+
* エラー状態
|
|
36
|
+
* Inputを警告色にするのみでエラーテキストは付随しない。
|
|
37
|
+
* errorTextを別途実装する場合などに利用する。
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
error?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* エラーメッセージのテキスト
|
|
43
|
+
* Inputを警告色にし、エラーテキストも表示する。
|
|
44
|
+
* 簡単にエラー状態を表現したい場合はこちらがおすすめ。
|
|
45
|
+
*/
|
|
46
|
+
errorText?: string;
|
|
47
|
+
/**
|
|
48
|
+
* 入力を無効にする
|
|
49
|
+
* @default false
|
|
50
|
+
*/
|
|
51
|
+
disabled?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* 時刻が変更されたときに呼ばれる関数
|
|
54
|
+
*/
|
|
55
|
+
onTimeChange?: (time: Dayjs) => void;
|
|
56
|
+
/**
|
|
57
|
+
* ドロップダウンの時刻間隔(分)
|
|
58
|
+
* @default 60
|
|
59
|
+
*/
|
|
60
|
+
dropdownInterval?: number;
|
|
61
|
+
/**
|
|
62
|
+
* 時刻選択肢をフィルタリングする関数の配列
|
|
63
|
+
* すべてのフィルターを通過した時刻のみが表示される
|
|
64
|
+
* 各フィルター関数は時刻文字列(例: "09:00")を受け取り、表示する場合はtrue、非表示にする場合はfalseを返す
|
|
65
|
+
*/
|
|
66
|
+
filterTimeOptions?: Array<(time: string) => boolean>;
|
|
67
|
+
/**
|
|
68
|
+
* サイズ
|
|
69
|
+
* @default "medium"
|
|
70
|
+
*/
|
|
71
|
+
size?: "small" | "medium" | "large";
|
|
72
|
+
/**
|
|
73
|
+
* バリアント
|
|
74
|
+
* @default "light"
|
|
75
|
+
*/
|
|
76
|
+
variant?: "light" | "dark";
|
|
77
|
+
/**
|
|
78
|
+
* 幅を明示的に指定
|
|
79
|
+
*/
|
|
80
|
+
width?: string;
|
|
81
|
+
/**
|
|
82
|
+
* ドロップダウンメニューの最大高さ
|
|
83
|
+
* @default 300
|
|
84
|
+
*/
|
|
85
|
+
maxHeight?: number | string;
|
|
86
|
+
/**
|
|
87
|
+
* フォーカスイベント
|
|
88
|
+
*/
|
|
89
|
+
onFocus?: () => void;
|
|
90
|
+
/**
|
|
91
|
+
* ブラーイベント
|
|
92
|
+
*/
|
|
93
|
+
onBlur?: () => void;
|
|
94
|
+
};
|
|
95
|
+
declare const _default: React.NamedExoticComponent<TimeFieldProps>;
|
|
96
|
+
export default _default;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Meta, StoryObj } from "@storybook/react";
|
|
2
|
+
import TimeField, { TimeFieldProps } from "./TimeField";
|
|
3
|
+
declare const meta: Meta<typeof TimeField>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<TimeFieldProps>;
|
|
6
|
+
export declare const Example: Story;
|
|
7
|
+
export declare const SmallSize: Story;
|
|
8
|
+
export declare const LargeSize: Story;
|
|
9
|
+
export declare const DarkVariant: Story;
|
|
10
|
+
export declare const Disabled: Story;
|
|
11
|
+
export declare const Error: Story;
|
|
12
|
+
export declare const FilteredTimeOptions: Story;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "@testing-library/jest-dom";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Dayjs } from "dayjs";
|
|
2
|
+
import { AllowedKeys } from "../DateField/constants";
|
|
3
|
+
import type { Sections } from "../DateField/types";
|
|
4
|
+
/**
|
|
5
|
+
* 指定した間隔で時刻オプションを生成する
|
|
6
|
+
* @param interval 間隔(分)
|
|
7
|
+
* @returns 時刻文字列の配列 ["00:00", "00:15", ...]
|
|
8
|
+
*/
|
|
9
|
+
export declare const generateTimeOptions: (interval?: number) => string[];
|
|
10
|
+
/**
|
|
11
|
+
* 左右キーでセクションを移動する際の移動量を計算する
|
|
12
|
+
* @param currentIndex 現在のセクションインデックス
|
|
13
|
+
* @param direction 移動方向 ("ArrowLeft" | "ArrowRight")
|
|
14
|
+
* @param sections セクション配列
|
|
15
|
+
* @returns 移動量(差分)
|
|
16
|
+
*/
|
|
17
|
+
export declare const calculateSectionIndexDelta: (currentIndex: number, direction: typeof AllowedKeys.ArrowLeft | typeof AllowedKeys.ArrowRight, sections: Sections[]) => number;
|
|
18
|
+
/**
|
|
19
|
+
* 上下キーで時刻を増減する
|
|
20
|
+
* @param currentTime 現在の時刻
|
|
21
|
+
* @param sectionIndex 現在のセクションインデックス(HH:mm形式の場合、0=時、2=分)
|
|
22
|
+
* @param increment 増減量(1または-1)
|
|
23
|
+
* @param format 時刻フォーマット(例: "HH:mm")
|
|
24
|
+
* @returns 増減後の時刻と正規化された値
|
|
25
|
+
*/
|
|
26
|
+
export declare const calculateIncrementedTime: (currentTime: Dayjs, sectionIndex: number, increment: number, format: string) => {
|
|
27
|
+
newTime: Dayjs;
|
|
28
|
+
normalizedValue: string;
|
|
29
|
+
} | null;
|
|
30
|
+
/**
|
|
31
|
+
* 数字入力処理の結果
|
|
32
|
+
*/
|
|
33
|
+
export type NumericInputResult = {
|
|
34
|
+
newSections: Sections[];
|
|
35
|
+
shouldMoveToNextSection: boolean;
|
|
36
|
+
newLastEditedSection: number | null;
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* 数字キーで値を直接入力する処理
|
|
40
|
+
* @param inputNumber 入力された数字文字列
|
|
41
|
+
* @param sections 現在のセクション配列
|
|
42
|
+
* @param sectionIndex 現在のセクションインデックス
|
|
43
|
+
* @param lastEditedSection 最後に編集したセクションのインデックス
|
|
44
|
+
* @returns 新しいセクション配列、次のセクションへの移動フラグ、新しい編集履歴
|
|
45
|
+
*/
|
|
46
|
+
export declare const processNumericInput: (inputNumber: string, sections: Sections[], sectionIndex: number, lastEditedSection: number | null) => NumericInputResult;
|
|
47
|
+
/**
|
|
48
|
+
* Backspaceキーで値をクリアする処理
|
|
49
|
+
* @param sections 現在のセクション配列
|
|
50
|
+
* @param sectionIndex 現在のセクションインデックス
|
|
51
|
+
* @returns 新しいセクション配列
|
|
52
|
+
*/
|
|
53
|
+
export declare const processBackspaceInput: (sections: Sections[], sectionIndex: number) => Sections[];
|
|
@@ -117,6 +117,8 @@ export { default as Tabs } from "./Tabs";
|
|
|
117
117
|
export * from "./Tabs";
|
|
118
118
|
export { default as TextField } from "./TextField";
|
|
119
119
|
export * from "./TextField";
|
|
120
|
+
export { TimeField } from "./TimeField";
|
|
121
|
+
export * from "./TimeField";
|
|
120
122
|
export { default as Toast } from "./Toast";
|
|
121
123
|
export * from "./Toast";
|
|
122
124
|
export { default as ToggleButton } from "./ToggleButton";
|