ingred-ui 23.22.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.
Files changed (37) hide show
  1. package/dist/components/Calendar/Calendar/Calendar.d.ts +52 -13
  2. package/dist/components/Calendar/Calendar/Calendar.stories.d.ts +11 -4
  3. package/dist/components/Calendar/CalendarRange/CalendarRange.d.ts +80 -22
  4. package/dist/components/Calendar/CalendarRange/CalendarRange.stories.d.ts +12 -5
  5. package/dist/components/Calendar/internal/Actions/Actions.d.ts +6 -5
  6. package/dist/components/Calendar/internal/Actions/index.d.ts +1 -1
  7. package/dist/components/Calendar/internal/Actions/styled.d.ts +6 -9
  8. package/dist/components/ContextMenu2/ContextMenu2.d.ts +4 -0
  9. package/dist/components/ContextMenu2/ContextMenu2.stories.d.ts +1 -0
  10. package/dist/components/DateField/DateField/DateField.d.ts +32 -4
  11. package/dist/components/DateField/DateField/DateField.stories.d.ts +3 -0
  12. package/dist/components/DateField/DateRangeField/DateRangeField.d.ts +34 -2
  13. package/dist/components/DateField/DateRangeField/DateRangeField.stories.d.ts +4 -0
  14. package/dist/components/DateField/DateRangeField/styled.d.ts +4 -1
  15. package/dist/components/DateField/constants.d.ts +4 -1
  16. package/dist/components/DateField/types.d.ts +2 -0
  17. package/dist/components/DateField/utils.d.ts +33 -0
  18. package/dist/components/DatePicker/DatePicker.d.ts +71 -7
  19. package/dist/components/DatePicker/DatePicker.stories.d.ts +9 -2
  20. package/dist/components/DateRangePicker/DateRangePicker.d.ts +56 -7
  21. package/dist/components/DateRangePicker/DateRangePicker.stories.d.ts +7 -2
  22. package/dist/components/DualListBox2/DualListBox2.stories.d.ts +1 -1
  23. package/dist/components/FilterComboBox/FilterComboBox.stories.d.ts +1 -1
  24. package/dist/components/TimeField/TimeField.d.ts +96 -0
  25. package/dist/components/TimeField/TimeField.stories.d.ts +12 -0
  26. package/dist/components/TimeField/__tests__/TimeField.test.d.ts +1 -0
  27. package/dist/components/TimeField/__tests__/utils.test.d.ts +1 -0
  28. package/dist/components/TimeField/index.d.ts +2 -0
  29. package/dist/components/TimeField/styled.d.ts +3 -0
  30. package/dist/components/TimeField/utils.d.ts +53 -0
  31. package/dist/components/index.d.ts +2 -0
  32. package/dist/index.es.js +1262 -1262
  33. package/dist/index.es.js.map +1 -1
  34. package/dist/index.js +1131 -1131
  35. package/dist/index.js.map +1 -1
  36. package/package.json +4 -3
  37. package/dist/components/DateField/DateField/styled.d.ts +0 -7
@@ -1,6 +1,7 @@
1
1
  import { Dayjs } from "dayjs";
2
2
  import React from "react";
3
- import { Action } from "../internal/Actions";
3
+ import { PresetButton } from "../internal/Actions";
4
+ import { TimeFieldProps } from "../../TimeField/TimeField";
4
5
  export type CalendarProps = React.HTMLAttributes<HTMLDivElement> & {
5
6
  /**
6
7
  * 日付
@@ -22,17 +23,27 @@ export type CalendarProps = React.HTMLAttributes<HTMLDivElement> & {
22
23
  */
23
24
  weekStart?: number;
24
25
  /**
25
- * デフォルトで選択されているアクション
26
+ * デフォルトで選択されているプリセットボタン
26
27
  */
27
- defaultClickAction?: string;
28
+ defaultPresetButton?: string;
28
29
  /**
29
- * カレンダーの左に表示するアクション
30
+ * カレンダーの左に表示するプリセットボタン
30
31
  */
31
- actions?: Action[];
32
+ presetButtons?: PresetButton[];
32
33
  /**
33
- * アクションをクリックしたときの挙動
34
+ * プリセットボタンをクリックしたときの挙動
34
35
  */
35
- onClickAction?: (action: Action) => void;
36
+ onPresetButtonClick?: (action: PresetButton) => void;
37
+ /**
38
+ * カレンダー内にDateFieldを表示する
39
+ * @default false
40
+ */
41
+ showDateFields?: boolean;
42
+ /**
43
+ * DateFieldに表示する日付のフォーマット
44
+ * @default "YYYY-MM-DD"
45
+ */
46
+ dateFieldFormat?: string;
36
47
  /**
37
48
  * 選択可能なカレンダーの領域を制限する
38
49
  * true が返る場合は、選択不可となる
@@ -43,6 +54,15 @@ export type CalendarProps = React.HTMLAttributes<HTMLDivElement> & {
43
54
  * 日付が変更されたときに呼ばれる関数
44
55
  */
45
56
  onDateChange: (value: Dayjs) => void;
57
+ /**
58
+ * カレンダー内にTimeFieldを表示する
59
+ * @default false
60
+ */
61
+ showTimeFields?: boolean;
62
+ /**
63
+ * TimeFieldのprops
64
+ */
65
+ timeFieldProps?: Partial<TimeFieldProps>;
46
66
  };
47
67
  declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
48
68
  /**
@@ -65,17 +85,27 @@ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponen
65
85
  */
66
86
  weekStart?: number | undefined;
67
87
  /**
68
- * デフォルトで選択されているアクション
88
+ * デフォルトで選択されているプリセットボタン
69
89
  */
70
- defaultClickAction?: string | undefined;
90
+ defaultPresetButton?: string | undefined;
71
91
  /**
72
- * カレンダーの左に表示するアクション
92
+ * カレンダーの左に表示するプリセットボタン
73
93
  */
74
- actions?: Action[] | undefined;
94
+ presetButtons?: PresetButton[] | undefined;
75
95
  /**
76
- * アクションをクリックしたときの挙動
96
+ * プリセットボタンをクリックしたときの挙動
77
97
  */
78
- onClickAction?: ((action: Action) => void) | undefined;
98
+ onPresetButtonClick?: ((action: PresetButton) => void) | undefined;
99
+ /**
100
+ * カレンダー内にDateFieldを表示する
101
+ * @default false
102
+ */
103
+ showDateFields?: boolean | undefined;
104
+ /**
105
+ * DateFieldに表示する日付のフォーマット
106
+ * @default "YYYY-MM-DD"
107
+ */
108
+ dateFieldFormat?: string | undefined;
79
109
  /**
80
110
  * 選択可能なカレンダーの領域を制限する
81
111
  * true が返る場合は、選択不可となる
@@ -86,5 +116,14 @@ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponen
86
116
  * 日付が変更されたときに呼ばれる関数
87
117
  */
88
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;
89
128
  } & React.RefAttributes<HTMLDivElement>>>;
90
129
  export default _default;
@@ -9,14 +9,21 @@ declare const _default: {
9
9
  monthFormat?: string | undefined;
10
10
  weekList?: string[] | undefined;
11
11
  weekStart?: number | undefined;
12
- defaultClickAction?: string | undefined;
13
- actions?: import("../internal/Actions").Action[] | undefined;
14
- onClickAction?: ((action: import("../internal/Actions").Action) => void) | undefined;
12
+ defaultPresetButton?: string | undefined;
13
+ presetButtons?: import("../internal/Actions").PresetButton[] | undefined;
14
+ onPresetButtonClick?: ((action: import("../internal/Actions").PresetButton) => void) | undefined;
15
+ showDateFields?: boolean | undefined;
16
+ dateFieldFormat?: string | undefined;
15
17
  isOutsideRange?: ((date: dayjs.Dayjs) => boolean) | undefined;
16
18
  onDateChange: (value: dayjs.Dayjs) => void;
19
+ showTimeFields?: boolean | undefined;
20
+ timeFieldProps?: Partial<import("../..").TimeFieldProps> | undefined;
17
21
  } & React.RefAttributes<HTMLDivElement>>>;
18
22
  };
19
23
  export default _default;
20
24
  export declare const Default: StoryObj<CalendarProps>;
21
- export declare const WithActions: StoryObj<CalendarProps>;
22
25
  export declare const IsOutsideRange: StoryObj<CalendarProps>;
26
+ export declare const WithPresetButtons: StoryObj<CalendarProps>;
27
+ export declare const WithDateField: StoryObj<CalendarProps>;
28
+ export declare const WithDateFieldAndPresetButtons: StoryObj<CalendarProps>;
29
+ export declare const WithDateFieldsAndTimeFields: StoryObj<CalendarProps>;
@@ -1,7 +1,8 @@
1
1
  import dayjs, { Dayjs } from "dayjs";
2
2
  import { DateRange } from "../..";
3
3
  import React from "react";
4
- import { Action } from "../internal/Actions";
4
+ import { PresetButton } from "../internal/Actions";
5
+ import { TimeFieldProps } from "../../TimeField/TimeField";
5
6
  export type CalendarRangeProps = React.HTMLAttributes<HTMLDivElement> & {
6
7
  /**
7
8
  * 開始日
@@ -28,17 +29,27 @@ export type CalendarRangeProps = React.HTMLAttributes<HTMLDivElement> & {
28
29
  */
29
30
  weekStart?: number;
30
31
  /**
31
- * デフォルトで選択されているアクション
32
+ * デフォルトで選択されているプリセットボタン
32
33
  */
33
- defaultClickAction?: string;
34
+ defaultPresetButton?: string;
34
35
  /**
35
- * カレンダーの左に表示するアクション
36
+ * 明日などのショートカットボタン
36
37
  */
37
- actions?: Action[];
38
+ presetButtons?: PresetButton[];
38
39
  /**
39
- * アクションをクリックしたときの挙動
40
+ * プリセットボタンをクリックしたときの挙動
40
41
  */
41
- onClickAction?: (action: Action) => void;
42
+ onPresetButtonClick?: (action: PresetButton) => void;
43
+ /**
44
+ * カレンダー内にDateFieldを表示する
45
+ * @default false
46
+ */
47
+ showDateFields?: boolean;
48
+ /**
49
+ * DateFieldに表示する日付のフォーマット
50
+ * @default "YYYY-MM-DD"
51
+ */
52
+ dateFieldFormat?: string;
42
53
  /**
43
54
  * 親コンポーネントで calendar を任意のタイミングで閉じたい場合に使用する
44
55
  */
@@ -52,7 +63,16 @@ export type CalendarRangeProps = React.HTMLAttributes<HTMLDivElement> & {
52
63
  /**
53
64
  * 日付が変更されたときに呼ばれる関数
54
65
  */
55
- onDatesChange: (dates: DateRange) => void;
66
+ onDatesChange?: (dates: DateRange) => void;
67
+ /**
68
+ * カレンダー内にTimeFieldを表示する
69
+ * @default false
70
+ */
71
+ showTimeFields?: boolean;
72
+ /**
73
+ * TimeFieldのprops
74
+ */
75
+ timeFieldProps?: Partial<TimeFieldProps>;
56
76
  };
57
77
  /**
58
78
  * CalendarRange
@@ -85,17 +105,27 @@ export declare const CalendarRange: React.ForwardRefExoticComponent<React.HTMLAt
85
105
  */
86
106
  weekStart?: number | undefined;
87
107
  /**
88
- * デフォルトで選択されているアクション
108
+ * デフォルトで選択されているプリセットボタン
109
+ */
110
+ defaultPresetButton?: string | undefined;
111
+ /**
112
+ * 明日などのショートカットボタン
113
+ */
114
+ presetButtons?: PresetButton[] | undefined;
115
+ /**
116
+ * プリセットボタンをクリックしたときの挙動
89
117
  */
90
- defaultClickAction?: string | undefined;
118
+ onPresetButtonClick?: ((action: PresetButton) => void) | undefined;
91
119
  /**
92
- * カレンダーの左に表示するアクション
120
+ * カレンダー内にDateFieldを表示する
121
+ * @default false
93
122
  */
94
- actions?: Action[] | undefined;
123
+ showDateFields?: boolean | undefined;
95
124
  /**
96
- * アクションをクリックしたときの挙動
125
+ * DateFieldに表示する日付のフォーマット
126
+ * @default "YYYY-MM-DD"
97
127
  */
98
- onClickAction?: ((action: Action) => void) | undefined;
128
+ dateFieldFormat?: string | undefined;
99
129
  /**
100
130
  * 親コンポーネントで calendar を任意のタイミングで閉じたい場合に使用する
101
131
  */
@@ -109,7 +139,16 @@ export declare const CalendarRange: React.ForwardRefExoticComponent<React.HTMLAt
109
139
  /**
110
140
  * 日付が変更されたときに呼ばれる関数
111
141
  */
112
- onDatesChange: (dates: DateRange) => void;
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;
113
152
  } & React.RefAttributes<HTMLDivElement>>;
114
153
  export type { DateRange };
115
154
  declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & {
@@ -138,17 +177,27 @@ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponen
138
177
  */
139
178
  weekStart?: number | undefined;
140
179
  /**
141
- * デフォルトで選択されているアクション
180
+ * デフォルトで選択されているプリセットボタン
181
+ */
182
+ defaultPresetButton?: string | undefined;
183
+ /**
184
+ * 明日などのショートカットボタン
142
185
  */
143
- defaultClickAction?: string | undefined;
186
+ presetButtons?: PresetButton[] | undefined;
144
187
  /**
145
- * カレンダーの左に表示するアクション
188
+ * プリセットボタンをクリックしたときの挙動
146
189
  */
147
- actions?: Action[] | undefined;
190
+ onPresetButtonClick?: ((action: PresetButton) => void) | undefined;
148
191
  /**
149
- * アクションをクリックしたときの挙動
192
+ * カレンダー内にDateFieldを表示する
193
+ * @default false
150
194
  */
151
- onClickAction?: ((action: Action) => void) | undefined;
195
+ showDateFields?: boolean | undefined;
196
+ /**
197
+ * DateFieldに表示する日付のフォーマット
198
+ * @default "YYYY-MM-DD"
199
+ */
200
+ dateFieldFormat?: string | undefined;
152
201
  /**
153
202
  * 親コンポーネントで calendar を任意のタイミングで閉じたい場合に使用する
154
203
  */
@@ -162,6 +211,15 @@ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponen
162
211
  /**
163
212
  * 日付が変更されたときに呼ばれる関数
164
213
  */
165
- onDatesChange: (dates: DateRange) => void;
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;
166
224
  } & React.RefAttributes<HTMLDivElement>>>;
167
225
  export default _default;
@@ -10,15 +10,22 @@ declare const _default: {
10
10
  monthFormat?: string | undefined;
11
11
  weekList?: string[] | undefined;
12
12
  weekStart?: number | undefined;
13
- defaultClickAction?: string | undefined;
14
- actions?: import("../internal/Actions").Action[] | undefined;
15
- onClickAction?: ((action: import("../internal/Actions").Action) => void) | undefined;
13
+ defaultPresetButton?: string | undefined;
14
+ presetButtons?: import("../internal/Actions").PresetButton[] | undefined;
15
+ onPresetButtonClick?: ((action: import("../internal/Actions").PresetButton) => void) | undefined;
16
+ showDateFields?: boolean | undefined;
17
+ dateFieldFormat?: string | undefined;
16
18
  onClose?: ((clickState: any) => void) | undefined;
17
19
  isOutsideRange?: ((date: dayjs.Dayjs) => boolean) | undefined;
18
- onDatesChange: (dates: import("./CalendarRange").DateRange) => void;
20
+ onDatesChange?: ((dates: import("./CalendarRange").DateRange) => void) | undefined;
21
+ showTimeFields?: boolean | undefined;
22
+ timeFieldProps?: Partial<import("../..").TimeFieldProps> | undefined;
19
23
  } & React.RefAttributes<HTMLDivElement>>>;
20
24
  };
21
25
  export default _default;
22
26
  export declare const Default: StoryObj<CalendarRangeProps>;
23
- export declare const WithActions: StoryObj<CalendarRangeProps>;
24
27
  export declare const IsOutsideRange: StoryObj<CalendarRangeProps>;
28
+ export declare const WithPresetButtons: StoryObj<CalendarRangeProps>;
29
+ export declare const WithDateField: StoryObj<CalendarRangeProps>;
30
+ export declare const WithDateFieldAndPresetButtons: StoryObj<CalendarRangeProps>;
31
+ export declare const WithDateFieldsAndTimeFields: StoryObj<CalendarRangeProps>;
@@ -1,11 +1,12 @@
1
1
  import React from "react";
2
- import { Action } from "./styled";
3
- export type Action = {
2
+ import { PresetButton } from "./styled";
3
+ export type PresetButton = {
4
4
  text: string;
5
5
  onClick: () => void;
6
6
  };
7
7
  export declare const Actions: React.NamedExoticComponent<{
8
- defaultClickAction?: string | undefined;
9
- actions?: Action[] | undefined;
10
- onClickAction?: ((action: Action) => void) | undefined;
8
+ defaultPresetButton?: string | undefined;
9
+ presetButtons?: PresetButton[] | undefined;
10
+ onPresetButtonClick?: ((action: PresetButton) => void) | undefined;
11
+ dateFields?: React.ReactNode;
11
12
  }>;
@@ -1,2 +1,2 @@
1
1
  export { Actions } from "./Actions";
2
- export type { Action } from "./Actions";
2
+ export type { PresetButton } from "./Actions";
@@ -1,11 +1,8 @@
1
- /// <reference types="react" />
2
- export declare const Action: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {
1
+ export declare const PresetButton: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {
3
2
  clicked: boolean;
4
3
  }, never>;
5
- export declare const ActionsContainer: import("styled-components").StyledComponent<import("react").ForwardRefExoticComponent<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
6
- height?: import("csstype").Property.Height<0 | (string & {})> | undefined;
7
- maxHeight?: import("csstype").Property.MaxHeight<0 | (string & {})> | undefined;
8
- minHeight?: import("csstype").Property.MinHeight<0 | (string & {})> | undefined;
9
- children: import("react").ComponentElement<HTMLElement, any>;
10
- } & import("react").RefAttributes<HTMLDivElement>>, import("styled-components").DefaultTheme, {}, never>;
11
- export declare const ActionsWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
4
+ export declare const ActionsContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
5
+ export declare const PresetButtonsWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
6
+ export declare const DateFieldWrapper: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
7
+ export declare const DateFieldsGroup: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {}, never>;
8
+ export declare const DateFieldLabel: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
@@ -30,6 +30,10 @@ type ContextMenu2Props = {
30
30
  * コンテキストメニューの最小幅
31
31
  */
32
32
  minWidth?: number;
33
+ /**
34
+ * コンテキストメニューの最大高さ(省略時は80vh)
35
+ */
36
+ maxHeight?: string | number;
33
37
  /**
34
38
  * メニュー内の項目。ContextMenu2*** のコンポーネントのみで構成する前提
35
39
  */
@@ -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;
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
2
  import { Dayjs } from "dayjs";
3
+ import { InputSize, InputVariant } from "../types";
3
4
  export type DateFieldProps = {
4
5
  /**
5
6
  * 日付
@@ -11,8 +12,17 @@ export type DateFieldProps = {
11
12
  * @default YYYY-MM-DD
12
13
  */
13
14
  format?: string;
15
+ /**
16
+ * エラー状態
17
+ * Inputを警告色にするのみでエラーテキストは付随しない。
18
+ * errorTextを別途実装する場合などに利用する。
19
+ * @default false
20
+ */
21
+ error?: boolean;
14
22
  /**
15
23
  * エラーメッセージのテキスト
24
+ * Inputを警告色にし、エラーテキストも表示する。
25
+ * 簡単にエラー状態を表現したい場合はこちらがおすすめ。
16
26
  */
17
27
  errorText?: string;
18
28
  /**
@@ -21,13 +31,31 @@ export type DateFieldProps = {
21
31
  */
22
32
  disabled?: boolean;
23
33
  /**
24
- * 日付が変更されたときに呼ばれる関数
34
+ * コンポーネントのサイズ
35
+ * @default "medium"
25
36
  */
26
- onDateChange?: (date: Dayjs) => void;
37
+ size?: InputSize;
38
+ /**
39
+ * コンポーネントのバリアント
40
+ * @default "light"
41
+ */
42
+ variant?: InputVariant;
27
43
  /**
28
- * カレンダーアイコンをクリックした時に呼ばれる関数
44
+ * 入力フィールドの幅
29
45
  */
30
- onClick: () => void;
46
+ width?: string | number;
47
+ /**
48
+ * 後方アイコン(右側)
49
+ */
50
+ append?: React.ReactNode;
51
+ /**
52
+ * 後方アイコンクリック時のハンドラ
53
+ */
54
+ onAppendClick?: () => void;
55
+ /**
56
+ * 日付が変更されたときに呼ばれる関数
57
+ */
58
+ onDateChange?: (date: Dayjs) => void;
31
59
  };
32
60
  declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<DateFieldProps & React.RefAttributes<HTMLInputElement>>>;
33
61
  export default _default;
@@ -11,3 +11,6 @@ export declare const Custom: StoryObj<DateFieldProps>;
11
11
  export declare const Japanese: StoryObj<DateFieldProps>;
12
12
  export declare const Error: StoryObj<DateFieldProps>;
13
13
  export declare const Disable: StoryObj<DateFieldProps>;
14
+ export declare const Small: StoryObj<DateFieldProps>;
15
+ export declare const Large: StoryObj<DateFieldProps>;
16
+ export declare const Dark: StoryObj<DateFieldProps>;
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
2
  import { DateRange } from "../..";
3
+ import { InputSize, InputVariant } from "../types";
3
4
  export type DateRangeFieldProps = {
4
5
  /**
5
6
  * 日付
@@ -11,8 +12,17 @@ export type DateRangeFieldProps = {
11
12
  * @default YYYY-MM-DD
12
13
  */
13
14
  format?: string;
15
+ /**
16
+ * エラー状態
17
+ * Inputを警告色にするのみでエラーテキストは付随しない。
18
+ * errorTextを別途実装する場合などに利用する。
19
+ * @default false
20
+ */
21
+ error?: boolean;
14
22
  /**
15
23
  * エラーメッセージのテキスト
24
+ * Inputを警告色にし、エラーテキストも表示する。
25
+ * 簡単にエラー状態を表現したい場合はこちらがおすすめ。
16
26
  */
17
27
  errorText?: string;
18
28
  /**
@@ -21,9 +31,31 @@ export type DateRangeFieldProps = {
21
31
  */
22
32
  disabled?: boolean;
23
33
  /**
24
- * カレンダーアイコンをクリックした時に呼ばれる関数
34
+ * コンポーネントのサイズ
35
+ * @default "medium"
36
+ */
37
+ size?: InputSize;
38
+ /**
39
+ * コンポーネントのバリアント
40
+ * @default "light"
41
+ */
42
+ variant?: InputVariant;
43
+ /**
44
+ * 開始日フィールドの幅
45
+ */
46
+ startWidth?: string | number;
47
+ /**
48
+ * 終了日フィールドの幅
49
+ */
50
+ endWidth?: string | number;
51
+ /**
52
+ * 後方アイコン(右側)
53
+ */
54
+ append?: React.ReactNode;
55
+ /**
56
+ * 後方アイコンクリック時のハンドラ
25
57
  */
26
- onClickCalendarIcon?: () => void;
58
+ onAppendClick?: () => void;
27
59
  /**
28
60
  * 日付が変更されたときに呼ばれる関数
29
61
  */
@@ -11,3 +11,7 @@ export declare const Custom: StoryObj<DateRangeFieldProps>;
11
11
  export declare const Japanese: StoryObj<DateRangeFieldProps>;
12
12
  export declare const Error: StoryObj<DateRangeFieldProps>;
13
13
  export declare const Disable: StoryObj<DateRangeFieldProps>;
14
+ export declare const Small: StoryObj<DateRangeFieldProps>;
15
+ export declare const Large: StoryObj<DateRangeFieldProps>;
16
+ export declare const Dark: StoryObj<DateRangeFieldProps>;
17
+ export declare const WithTimeFormat: StoryObj<DateRangeFieldProps>;
@@ -1,5 +1,8 @@
1
+ import { InputSize, InputVariant } from "../../Input/types";
1
2
  export declare const InputContainer: import("styled-components").StyledComponent<"div", import("styled-components").DefaultTheme, {
2
3
  disabled: boolean;
3
4
  error?: boolean | undefined;
5
+ $size: InputSize;
6
+ $variant: InputVariant;
4
7
  }, never>;
5
- export declare const CalendarIcon: import("styled-components").StyledComponent<"button", import("styled-components").DefaultTheme, {}, never>;
8
+ export declare const Separator: import("styled-components").StyledComponent<"span", import("styled-components").DefaultTheme, {}, never>;
@@ -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" | "6" | "8" | "ArrowDown" | "ArrowUp" | "7" | "Backspace" | "Delete" | "ArrowLeft" | "ArrowRight" | "Tab" | "9")[];
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];
@@ -1,4 +1,5 @@
1
1
  import { DateFieldProps } from "./DateField/DateField";
2
+ import { InputSize, InputVariant } from "../Input/types";
2
3
  export type UseDateFieldProps = Omit<DateFieldProps, "onClick">;
3
4
  export type Sections = {
4
5
  start: number;
@@ -7,3 +8,4 @@ export type Sections = {
7
8
  editable: boolean;
8
9
  type?: "year" | "month" | "day";
9
10
  };
11
+ export type { InputSize, InputVariant };
@@ -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 {};