@bug-on/m3-expressive 1.0.0 → 1.1.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/CHANGELOG.md +29 -2
- package/README.md +20 -18
- package/dist/assets/material-symbols-self-hosted.css +27 -26
- package/dist/buttons.d.mts +1 -1
- package/dist/buttons.d.ts +1 -1
- package/dist/buttons.js.map +1 -1
- package/dist/buttons.mjs.map +1 -1
- package/dist/core.d.mts +44 -44
- package/dist/core.d.ts +44 -44
- package/dist/core.js.map +1 -1
- package/dist/core.mjs.map +1 -1
- package/dist/feedback.d.mts +54 -54
- package/dist/feedback.d.ts +54 -54
- package/dist/feedback.js.map +1 -1
- package/dist/feedback.mjs.map +1 -1
- package/dist/index.css +3 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -8
- package/dist/index.mjs.map +1 -1
- package/dist/layout.d.mts +40 -40
- package/dist/layout.d.ts +40 -40
- package/dist/layout.js +5 -5
- package/dist/layout.js.map +1 -1
- package/dist/layout.mjs +5 -5
- package/dist/layout.mjs.map +1 -1
- package/dist/material-symbols-self-hosted.css +27 -26
- package/dist/navigation.js.map +1 -1
- package/dist/navigation.mjs.map +1 -1
- package/dist/overlays.d.mts +2 -2
- package/dist/overlays.d.ts +2 -2
- package/dist/overlays.js +2 -2
- package/dist/overlays.js.map +1 -1
- package/dist/overlays.mjs +2 -2
- package/dist/overlays.mjs.map +1 -1
- package/dist/pickers.d.mts +241 -243
- package/dist/pickers.d.ts +241 -243
- package/dist/pickers.js +1 -1
- package/dist/pickers.js.map +1 -1
- package/dist/pickers.mjs +1 -1
- package/dist/pickers.mjs.map +1 -1
- package/dist/{side-sheet-modal-BY6VCC8p.d.mts → side-sheet-modal-64FGhDxL.d.mts} +20 -21
- package/dist/{side-sheet-modal-CglP6KYA.d.ts → side-sheet-modal-Bd5Qqvp9.d.ts} +20 -21
- package/dist/{split-button-trailing-uncheckable-MXj_kyNt.d.mts → split-button-trailing-uncheckable-BRPuTqi1.d.mts} +140 -151
- package/dist/{split-button-trailing-uncheckable-C5CLCIKP.d.ts → split-button-trailing-uncheckable-CjOFCoyW.d.ts} +140 -151
- package/dist/typography.css +5 -0
- package/package.json +4 -4
package/dist/pickers.d.ts
CHANGED
|
@@ -3,58 +3,59 @@ import * as React from 'react';
|
|
|
3
3
|
/**
|
|
4
4
|
* @file date-time-pickers/shared/types.ts
|
|
5
5
|
*
|
|
6
|
-
* Shared TypeScript base types
|
|
7
|
-
*
|
|
6
|
+
* Shared TypeScript base types for Date Pickers and Time Pickers system.
|
|
7
|
+
* Designed for reuse across both picker systems.
|
|
8
8
|
*
|
|
9
9
|
* @see https://m3.material.io/components/date-pickers/overview
|
|
10
10
|
*/
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
13
|
-
* - `picker` — calendar/dial UI (
|
|
14
|
-
* - `input` — text input mode
|
|
12
|
+
* Picker display mode.
|
|
13
|
+
* - `picker` — calendar/dial UI (default)
|
|
14
|
+
* - `input` — text input mode for manual entry
|
|
15
15
|
*
|
|
16
|
-
*
|
|
16
|
+
* Equivalent to `DisplayMode` enum in Android Compose Material3.
|
|
17
17
|
*/
|
|
18
18
|
type DisplayMode = "picker" | "input";
|
|
19
19
|
/**
|
|
20
|
-
*
|
|
20
|
+
* First day of the week.
|
|
21
21
|
* - `0` = Sunday (US standard)
|
|
22
|
-
* - `1` = Monday (ISO 8601,
|
|
22
|
+
* - `1` = Monday (ISO 8601, default for this library)
|
|
23
23
|
*/
|
|
24
24
|
type WeekStartsOn = 0 | 1;
|
|
25
25
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
26
|
+
* Locale configuration for Date Picker.
|
|
27
|
+
* Uses native `Intl.DateTimeFormat` API — zero bundle overhead.
|
|
28
28
|
*
|
|
29
29
|
* @example
|
|
30
30
|
* ```tsx
|
|
31
31
|
* const state = useDatePickerState({
|
|
32
|
-
* locale: { locale: '
|
|
32
|
+
* locale: { locale: 'en-US', weekStartsOn: 1 }
|
|
33
33
|
* });
|
|
34
34
|
* ```
|
|
35
35
|
*/
|
|
36
36
|
interface DateLocale {
|
|
37
37
|
/**
|
|
38
38
|
* BCP 47 language tag.
|
|
39
|
-
* @example 'en-US', '
|
|
39
|
+
* @example 'en-US', 'fr-FR', 'ja-JP'
|
|
40
40
|
* @default navigator.language (runtime)
|
|
41
41
|
*/
|
|
42
42
|
locale?: string;
|
|
43
43
|
/**
|
|
44
|
-
*
|
|
44
|
+
* First day of the week.
|
|
45
45
|
* @default 1 (Monday)
|
|
46
46
|
*/
|
|
47
47
|
weekStartsOn?: WeekStartsOn;
|
|
48
48
|
}
|
|
49
|
-
/** Required version —
|
|
49
|
+
/** Required version — all fields resolved */
|
|
50
50
|
type ResolvedDateLocale = Required<DateLocale>;
|
|
51
51
|
/**
|
|
52
|
-
* Interface
|
|
53
|
-
*
|
|
52
|
+
* Interface for filtering selectable dates and years.
|
|
53
|
+
* Equivalent to `SelectableDates` interface in Android Compose Material3.
|
|
54
|
+
|
|
54
55
|
*
|
|
55
56
|
* @example
|
|
56
57
|
* ```tsx
|
|
57
|
-
* //
|
|
58
|
+
* // Disable weekends
|
|
58
59
|
* const selectableDates: SelectableDates = {
|
|
59
60
|
* isSelectableDate(utcMs) {
|
|
60
61
|
* const day = new Date(utcMs).getUTCDay();
|
|
@@ -68,193 +69,193 @@ type ResolvedDateLocale = Required<DateLocale>;
|
|
|
68
69
|
*/
|
|
69
70
|
interface SelectableDates {
|
|
70
71
|
/**
|
|
71
|
-
*
|
|
72
|
-
* @param utcTimeMs - UTC milliseconds (
|
|
73
|
-
* @returns `true`
|
|
72
|
+
* Checks if a date is selectable.
|
|
73
|
+
* @param utcTimeMs - UTC milliseconds (normalized to UTC midnight)
|
|
74
|
+
* @returns `true` if date is selectable
|
|
74
75
|
*/
|
|
75
76
|
isSelectableDate(utcTimeMs: number): boolean;
|
|
76
77
|
/**
|
|
77
|
-
*
|
|
78
|
-
*
|
|
78
|
+
* Checks if a year is selectable.
|
|
79
|
+
* Unselectable years are disabled in year grid view.
|
|
79
80
|
* @param year - Full year (e.g., 2025)
|
|
80
|
-
* @returns `true`
|
|
81
|
+
* @returns `true` if year is selectable
|
|
81
82
|
*/
|
|
82
83
|
isSelectableYear(year: number): boolean;
|
|
83
84
|
}
|
|
84
85
|
/**
|
|
85
|
-
*
|
|
86
|
-
*
|
|
86
|
+
* Date range with start and end.
|
|
87
|
+
* Both can be null during selection flow.
|
|
87
88
|
*/
|
|
88
89
|
interface DateRange {
|
|
89
|
-
/** UTC milliseconds
|
|
90
|
+
/** Start date UTC milliseconds (UTC midnight). Null if unselected. */
|
|
90
91
|
start: number | null;
|
|
91
|
-
/** UTC milliseconds
|
|
92
|
+
/** End date UTC milliseconds (UTC midnight). Null if unselected. */
|
|
92
93
|
end: number | null;
|
|
93
94
|
}
|
|
94
95
|
|
|
95
96
|
/**
|
|
96
97
|
* @file date-picker/date-picker.types.ts
|
|
97
98
|
*
|
|
98
|
-
* TypeScript interfaces
|
|
99
|
-
*
|
|
99
|
+
* TypeScript interfaces and types for Date Picker component system.
|
|
100
|
+
* Equivalent to DatePickerState + rememberDatePickerState in Android Compose.
|
|
100
101
|
*
|
|
101
102
|
* @see https://m3.material.io/components/date-pickers/overview
|
|
102
103
|
*/
|
|
103
104
|
|
|
104
105
|
/**
|
|
105
|
-
* State object
|
|
106
|
-
*
|
|
106
|
+
* State object for DatePicker — hoisted state pattern.
|
|
107
|
+
* Equivalent to `DatePickerState` class in Android Compose Material3.
|
|
107
108
|
*
|
|
108
109
|
* @example
|
|
109
110
|
* ```tsx
|
|
110
|
-
* const state = useDatePickerState({ locale: { locale: '
|
|
111
|
+
* const state = useDatePickerState({ locale: { locale: 'en-US' } });
|
|
111
112
|
*
|
|
112
113
|
* <DatePicker state={state} />
|
|
113
114
|
* <p>Selected: {state.selectedDateMs}</p>
|
|
114
115
|
* ```
|
|
115
116
|
*/
|
|
116
117
|
interface DatePickerState {
|
|
117
|
-
/** UTC ms
|
|
118
|
+
/** UTC ms of currently selected date. Null if unselected. */
|
|
118
119
|
readonly selectedDateMs: number | null;
|
|
119
|
-
/** UTC ms
|
|
120
|
+
/** UTC ms of 1st day of month currently displayed in calendar. */
|
|
120
121
|
readonly displayedMonthMs: number;
|
|
121
|
-
/**
|
|
122
|
+
/** Current display mode: 'picker' | 'input' */
|
|
122
123
|
readonly displayMode: DisplayMode;
|
|
123
|
-
/**
|
|
124
|
+
/** Selectable year range [min, max] */
|
|
124
125
|
readonly yearRange: [number, number];
|
|
125
|
-
/**
|
|
126
|
+
/** Resolved locale (with default values) */
|
|
126
127
|
readonly locale: ResolvedDateLocale;
|
|
127
128
|
/** SelectableDates config */
|
|
128
129
|
readonly selectableDates: SelectableDates;
|
|
129
|
-
/**
|
|
130
|
+
/** Selects a date by UTC ms. Pass null to deselect. */
|
|
130
131
|
selectDate(ms: number | null): void;
|
|
131
|
-
/**
|
|
132
|
+
/** Navigates month backward or forward */
|
|
132
133
|
navigateMonth(direction: "prev" | "next"): void;
|
|
133
|
-
/**
|
|
134
|
+
/** Navigates to a specific year and month */
|
|
134
135
|
navigateToMonth(year: number, month: number): void;
|
|
135
|
-
/**
|
|
136
|
+
/** Switches display mode between 'picker' and 'input' */
|
|
136
137
|
setDisplayMode(mode: DisplayMode): void;
|
|
137
|
-
/**
|
|
138
|
+
/** Resets to initial state */
|
|
138
139
|
reset(): void;
|
|
139
140
|
}
|
|
140
141
|
/**
|
|
141
|
-
* Options
|
|
142
|
-
*
|
|
142
|
+
* Options for `useDatePickerState` hook.
|
|
143
|
+
* Equivalent to `rememberDatePickerState()` parameters in Compose.
|
|
143
144
|
*/
|
|
144
145
|
interface UseDatePickerStateOptions {
|
|
145
146
|
/**
|
|
146
|
-
*
|
|
147
|
+
* Initial selected date (UTC ms or null).
|
|
147
148
|
* @default null
|
|
148
149
|
*/
|
|
149
150
|
initialSelectedDateMs?: number | null;
|
|
150
151
|
/**
|
|
151
|
-
*
|
|
152
|
-
* @default
|
|
152
|
+
* Initial displayed month (UTC ms of any date in target month).
|
|
153
|
+
* @default current month
|
|
153
154
|
*/
|
|
154
155
|
initialDisplayedMonthMs?: number;
|
|
155
156
|
/**
|
|
156
|
-
*
|
|
157
|
+
* Selectable year range [min, max].
|
|
157
158
|
* @default [1900, 2100]
|
|
158
159
|
*/
|
|
159
160
|
yearRange?: [number, number];
|
|
160
161
|
/**
|
|
161
|
-
* Filter
|
|
162
|
+
* Filter for unselectable dates/years.
|
|
162
163
|
* @default ALL_DATES_SELECTABLE
|
|
163
164
|
*/
|
|
164
165
|
selectableDates?: SelectableDates;
|
|
165
166
|
/**
|
|
166
|
-
*
|
|
167
|
+
* Initial display mode.
|
|
167
168
|
* @default 'picker'
|
|
168
169
|
*/
|
|
169
170
|
initialDisplayMode?: DisplayMode;
|
|
170
171
|
/**
|
|
171
|
-
* Locale configuration
|
|
172
|
+
* Locale configuration for calendar.
|
|
172
173
|
* @default { weekStartsOn: 1 } (Monday)
|
|
173
174
|
*/
|
|
174
175
|
locale?: DateLocale;
|
|
175
176
|
}
|
|
176
177
|
/**
|
|
177
|
-
* State object
|
|
178
|
-
*
|
|
178
|
+
* State object for DateRangePicker — hoisted state pattern.
|
|
179
|
+
* Equivalent to `DateRangePickerState` class in Android Compose Material3.
|
|
179
180
|
*/
|
|
180
181
|
interface DateRangePickerState {
|
|
181
|
-
/** UTC ms
|
|
182
|
+
/** Start date UTC ms. Null if unselected. */
|
|
182
183
|
readonly selectedStartMs: number | null;
|
|
183
|
-
/** UTC ms
|
|
184
|
+
/** End date UTC ms. Null if unselected. */
|
|
184
185
|
readonly selectedEndMs: number | null;
|
|
185
|
-
/** UTC ms
|
|
186
|
+
/** UTC ms of 1st day of displayed month. */
|
|
186
187
|
readonly displayedMonthMs: number;
|
|
187
|
-
/**
|
|
188
|
+
/** Display mode: 'picker' | 'input' */
|
|
188
189
|
readonly displayMode: DisplayMode;
|
|
189
|
-
/**
|
|
190
|
+
/** Selectable year range */
|
|
190
191
|
readonly yearRange: [number, number];
|
|
191
|
-
/**
|
|
192
|
+
/** Resolved locale */
|
|
192
193
|
readonly locale: ResolvedDateLocale;
|
|
193
194
|
/** SelectableDates config */
|
|
194
195
|
readonly selectableDates: SelectableDates;
|
|
195
196
|
/**
|
|
196
|
-
*
|
|
197
|
-
* Logic: click 1 = set start, click 2 = set end (
|
|
198
|
-
*
|
|
197
|
+
* Selects a date.
|
|
198
|
+
* Logic: click 1 = set start, click 2 = set end (if ms > start).
|
|
199
|
+
* If ms <= start or both start and end exist, resets to new start.
|
|
199
200
|
*/
|
|
200
201
|
selectDate(ms: number): void;
|
|
201
|
-
/**
|
|
202
|
+
/** Clears entire range selection */
|
|
202
203
|
clearRange(): void;
|
|
203
|
-
/**
|
|
204
|
+
/** Navigates month */
|
|
204
205
|
navigateMonth(direction: "prev" | "next"): void;
|
|
205
|
-
/**
|
|
206
|
+
/** Navigates to a specific year and month */
|
|
206
207
|
navigateToMonth(year: number, month: number): void;
|
|
207
|
-
/**
|
|
208
|
+
/** Switches display mode */
|
|
208
209
|
setDisplayMode(mode: DisplayMode): void;
|
|
209
|
-
/**
|
|
210
|
+
/** Resets */
|
|
210
211
|
reset(): void;
|
|
211
212
|
}
|
|
212
|
-
/** Options
|
|
213
|
+
/** Options for `useDateRangePickerState` */
|
|
213
214
|
interface UseDateRangePickerStateOptions {
|
|
214
|
-
/**
|
|
215
|
+
/** Initial start date (UTC ms) */
|
|
215
216
|
initialStartMs?: number | null;
|
|
216
|
-
/**
|
|
217
|
+
/** Initial end date (UTC ms) */
|
|
217
218
|
initialEndMs?: number | null;
|
|
218
|
-
/**
|
|
219
|
+
/** Initial displayed month */
|
|
219
220
|
initialDisplayedMonthMs?: number;
|
|
220
|
-
/**
|
|
221
|
+
/** Year range @default [1900, 2100] */
|
|
221
222
|
yearRange?: [number, number];
|
|
222
|
-
/** Filter
|
|
223
|
+
/** Filter unselectable dates */
|
|
223
224
|
selectableDates?: SelectableDates;
|
|
224
|
-
/**
|
|
225
|
+
/** Initial display mode @default 'picker' */
|
|
225
226
|
initialDisplayMode?: DisplayMode;
|
|
226
227
|
/** Locale config */
|
|
227
228
|
locale?: DateLocale;
|
|
228
229
|
}
|
|
229
|
-
/** Props
|
|
230
|
+
/** Props for `DatePicker` component */
|
|
230
231
|
interface DatePickerProps {
|
|
231
|
-
/** Hoisted state
|
|
232
|
+
/** Hoisted state from `useDatePickerState()` */
|
|
232
233
|
state: DatePickerState;
|
|
233
234
|
/**
|
|
234
|
-
*
|
|
235
|
+
* Show toggle button between picker and input mode.
|
|
235
236
|
* @default true
|
|
236
237
|
*/
|
|
237
238
|
showModeToggle?: boolean;
|
|
238
239
|
/**
|
|
239
|
-
* Title slot —
|
|
240
|
+
* Title slot — displayed above header.
|
|
240
241
|
* @default "Select date"
|
|
241
242
|
*/
|
|
242
243
|
title?: React.ReactNode;
|
|
243
244
|
/**
|
|
244
|
-
* Headline slot —
|
|
245
|
-
* @default formatted selected date
|
|
245
|
+
* Headline slot — displays selected date.
|
|
246
|
+
* @default formatted selected date or "--"
|
|
246
247
|
*/
|
|
247
248
|
headline?: React.ReactNode;
|
|
248
|
-
/** CSS class
|
|
249
|
+
/** Additional CSS class for container */
|
|
249
250
|
className?: string;
|
|
250
251
|
}
|
|
251
|
-
/** Props
|
|
252
|
+
/** Props for `DateRangePicker` component */
|
|
252
253
|
interface DateRangePickerProps {
|
|
253
|
-
/** Hoisted state
|
|
254
|
+
/** Hoisted state from `useDateRangePickerState()` */
|
|
254
255
|
state: DateRangePickerState;
|
|
255
256
|
/**
|
|
256
|
-
*
|
|
257
|
-
* @default false (range
|
|
257
|
+
* Show toggle button for picker/input mode.
|
|
258
|
+
* @default false (range pickers typically don't use text input mode)
|
|
258
259
|
*/
|
|
259
260
|
showModeToggle?: boolean;
|
|
260
261
|
/**
|
|
@@ -262,67 +263,66 @@ interface DateRangePickerProps {
|
|
|
262
263
|
* @default "Select dates"
|
|
263
264
|
*/
|
|
264
265
|
title?: React.ReactNode;
|
|
265
|
-
/** CSS class
|
|
266
|
+
/** Additional CSS class */
|
|
266
267
|
className?: string;
|
|
267
268
|
}
|
|
268
|
-
/** Props
|
|
269
|
+
/** Props for `DatePickerDialog` component */
|
|
269
270
|
interface DatePickerDialogProps {
|
|
270
|
-
/**
|
|
271
|
+
/** Open/close state of dialog */
|
|
271
272
|
open: boolean;
|
|
272
|
-
/** Callback
|
|
273
|
+
/** Callback when dialog requests dismissal (scrim click, Escape) */
|
|
273
274
|
onDismiss: () => void;
|
|
274
|
-
/** Title
|
|
275
|
+
/** Title for dialog (screen reader accessibility) */
|
|
275
276
|
title?: string;
|
|
276
277
|
/**
|
|
277
|
-
*
|
|
278
|
-
* Dialog không set up event handlers — caller tự xử lý.
|
|
278
|
+
* Confirm button element rendered by caller (e.g. Button "OK").
|
|
279
279
|
*/
|
|
280
280
|
confirmButton: React.ReactNode;
|
|
281
281
|
/**
|
|
282
|
-
*
|
|
282
|
+
* Optional cancel/dismiss button element.
|
|
283
283
|
* @default null
|
|
284
284
|
*/
|
|
285
285
|
dismissButton?: React.ReactNode;
|
|
286
|
-
/** Content —
|
|
286
|
+
/** Content — typically `DatePicker` or `DateRangePicker` */
|
|
287
287
|
children: React.ReactNode;
|
|
288
|
-
/** CSS class
|
|
288
|
+
/** Additional CSS class for dialog panel */
|
|
289
289
|
className?: string;
|
|
290
290
|
}
|
|
291
|
-
/** Props
|
|
291
|
+
/** Props for `DatePickerInput` component */
|
|
292
292
|
interface DatePickerInputProps {
|
|
293
293
|
/**
|
|
294
|
-
*
|
|
294
|
+
* Current text value (format: "MM/DD/YYYY").
|
|
295
295
|
*/
|
|
296
296
|
value: string;
|
|
297
|
-
/** Callback
|
|
297
|
+
/** Callback when user changes text */
|
|
298
298
|
onChange(value: string): void;
|
|
299
299
|
/**
|
|
300
|
-
* Callback
|
|
301
|
-
*
|
|
300
|
+
* Callback when user confirms date (blur or Enter).
|
|
301
|
+
* Passes parsed UTC ms, or null if invalid input.
|
|
302
302
|
*/
|
|
303
303
|
onCommit(ms: number | null): void;
|
|
304
|
-
/** Label
|
|
304
|
+
/** Label for text field */
|
|
305
305
|
label?: string;
|
|
306
|
-
/** Error message (
|
|
306
|
+
/** Error message (shown when format is invalid) */
|
|
307
307
|
error?: string;
|
|
308
|
-
/** Locale string
|
|
308
|
+
/** Locale string for format hint */
|
|
309
309
|
locale?: string;
|
|
310
|
-
/** CSS class
|
|
310
|
+
/** Additional CSS class */
|
|
311
311
|
className?: string;
|
|
312
312
|
}
|
|
313
313
|
|
|
314
314
|
/**
|
|
315
315
|
* @file date-picker/date-picker.tsx
|
|
316
316
|
*
|
|
317
|
-
* DatePicker — calendar UI component (
|
|
318
|
-
*
|
|
317
|
+
* DatePicker — calendar UI component (excluding dialog wrapper).
|
|
318
|
+
* Equivalent to `DatePicker` composable in Android Compose Material3.
|
|
319
319
|
*
|
|
320
320
|
* Layout:
|
|
321
321
|
* CalendarHeader (title, headline, month nav)
|
|
322
322
|
* ↓
|
|
323
323
|
* CalendarGrid | YearPickerGrid (AnimatePresence toggle)
|
|
324
324
|
* ↓
|
|
325
|
-
* DatePickerInput (
|
|
325
|
+
* DatePickerInput (when displayMode === 'input')
|
|
326
326
|
*
|
|
327
327
|
* @see https://m3.material.io/components/date-pickers/overview
|
|
328
328
|
*/
|
|
@@ -332,12 +332,12 @@ interface DatePickerInputProps {
|
|
|
332
332
|
*
|
|
333
333
|
* @example
|
|
334
334
|
* ```tsx
|
|
335
|
-
* const state = useDatePickerState({ locale: { locale: '
|
|
335
|
+
* const state = useDatePickerState({ locale: { locale: 'en-US' } });
|
|
336
336
|
*
|
|
337
337
|
* <DatePicker
|
|
338
338
|
* state={state}
|
|
339
339
|
* showModeToggle
|
|
340
|
-
* title="
|
|
340
|
+
* title="Select date"
|
|
341
341
|
* />
|
|
342
342
|
* ```
|
|
343
343
|
*/
|
|
@@ -346,13 +346,13 @@ declare const DatePicker: React.FC<DatePickerProps>;
|
|
|
346
346
|
/**
|
|
347
347
|
* @file date-picker/date-picker.tokens.ts
|
|
348
348
|
*
|
|
349
|
-
* MD3 Design tokens
|
|
350
|
-
*
|
|
349
|
+
* MD3 Design tokens for Date Picker component.
|
|
350
|
+
* Maps from DatePickerModalTokens.kt → CSS variables in packages/tailwind/src/index.css.
|
|
351
351
|
*
|
|
352
352
|
* @see docs/m3/date-and-time-pickers/date-pickers/DatePickerModalTokens.kt
|
|
353
353
|
* @see packages/tailwind/src/index.css
|
|
354
354
|
*/
|
|
355
|
-
/** Color tokens —
|
|
355
|
+
/** Color tokens — uses CSS custom properties from MD3 theme */
|
|
356
356
|
declare const DP_COLORS: {
|
|
357
357
|
/** Dialog container — SurfaceContainerHigh */
|
|
358
358
|
readonly container: "var(--md-sys-color-surface-container-high)";
|
|
@@ -383,7 +383,7 @@ declare const DP_COLORS: {
|
|
|
383
383
|
/** Scrim overlay */
|
|
384
384
|
readonly scrim: "var(--md-sys-color-scrim)";
|
|
385
385
|
};
|
|
386
|
-
/** Shape tokens — corner radii
|
|
386
|
+
/** Shape tokens — corner radii from MD3 shape scale */
|
|
387
387
|
declare const DP_SHAPE: {
|
|
388
388
|
/** Dialog container — CornerExtraLarge = 28px */
|
|
389
389
|
readonly container: "var(--md-sys-shape-corner-extra-large)";
|
|
@@ -394,7 +394,7 @@ declare const DP_SHAPE: {
|
|
|
394
394
|
/** Year chip — CornerFull */
|
|
395
395
|
readonly year: "var(--md-sys-shape-corner-full)";
|
|
396
396
|
};
|
|
397
|
-
/** Fixed dimension tokens
|
|
397
|
+
/** Fixed dimension tokens from DatePickerModalTokens.kt */
|
|
398
398
|
declare const DP_SIZE: {
|
|
399
399
|
/** Dialog container width */
|
|
400
400
|
readonly containerWidth: 360;
|
|
@@ -414,8 +414,8 @@ declare const DP_SIZE: {
|
|
|
414
414
|
readonly yearChipWidth: 72;
|
|
415
415
|
};
|
|
416
416
|
/**
|
|
417
|
-
* Tailwind utility class strings
|
|
418
|
-
*
|
|
417
|
+
* Tailwind utility class strings for Date Picker elements.
|
|
418
|
+
* Used with `cn()` function.
|
|
419
419
|
*/
|
|
420
420
|
declare const DP_CLASSES: {
|
|
421
421
|
/** Dialog container */
|
|
@@ -437,10 +437,10 @@ declare const DP_CLASSES: {
|
|
|
437
437
|
/**
|
|
438
438
|
* @file date-picker/date-picker-dialog.tsx
|
|
439
439
|
*
|
|
440
|
-
* Modal container
|
|
441
|
-
*
|
|
440
|
+
* Modal container for Date Pickers — reuses Dialog + DialogPortal primitives.
|
|
441
|
+
* Equivalent to `DatePickerDialog` composable in Android Compose Material3.
|
|
442
442
|
*
|
|
443
|
-
* Tokens
|
|
443
|
+
* Tokens from DatePickerModalTokens.kt:
|
|
444
444
|
* - ContainerColor = SurfaceContainerHigh (#ece6f0)
|
|
445
445
|
* - ContainerShape = CornerExtraLarge (28px)
|
|
446
446
|
* - ContainerElevation = Level3
|
|
@@ -450,13 +450,13 @@ declare const DP_CLASSES: {
|
|
|
450
450
|
*/
|
|
451
451
|
|
|
452
452
|
/**
|
|
453
|
-
* Modal Date Picker dialog
|
|
453
|
+
* Modal Date Picker dialog with MD3 Expressive spring animations.
|
|
454
454
|
*
|
|
455
|
-
*
|
|
456
|
-
*
|
|
457
|
-
* layout specs MD3 Date Picker (không có padding p-6, kích thước cố định, animation riêng).
|
|
455
|
+
* Reuses `<Dialog>` (Root) and `<DialogPortal>` (AnimatePresence + Portal lifecycle)
|
|
456
|
+
* while managing Overlay and Content to preserve MD3 Date Picker layout specs.
|
|
458
457
|
*
|
|
459
458
|
* @example
|
|
459
|
+
|
|
460
460
|
* ```tsx
|
|
461
461
|
* const state = useDatePickerState();
|
|
462
462
|
* const [open, setOpen] = React.useState(false);
|
|
@@ -482,27 +482,27 @@ declare const DatePickerDialog: React.FC<DatePickerDialogProps>;
|
|
|
482
482
|
/**
|
|
483
483
|
* @file date-picker/date-picker-input.tsx
|
|
484
484
|
*
|
|
485
|
-
* Text input mode
|
|
486
|
-
*
|
|
485
|
+
* Text input mode for Date Picker — manual entry in MM/DD/YYYY format.
|
|
486
|
+
* Uses library TextField component.
|
|
487
487
|
*
|
|
488
488
|
* @see https://m3.material.io/components/date-pickers/overview
|
|
489
489
|
*/
|
|
490
490
|
|
|
491
491
|
/**
|
|
492
|
-
* Text input
|
|
493
|
-
*
|
|
492
|
+
* Text input for Date Picker with MM/DD/YYYY format.
|
|
493
|
+
* Validates realtime, commits on blur or Enter.
|
|
494
494
|
*/
|
|
495
495
|
declare const DatePickerInput: React.FC<DatePickerInputProps>;
|
|
496
496
|
|
|
497
497
|
/**
|
|
498
498
|
* @file date-picker/date-range-picker.tsx
|
|
499
499
|
*
|
|
500
|
-
* DateRangePicker — calendar UI
|
|
501
|
-
*
|
|
500
|
+
* DateRangePicker — calendar UI for date range selection.
|
|
501
|
+
* Equivalent to `DateRangePicker` composable in Android Compose Material3.
|
|
502
502
|
*
|
|
503
|
-
*
|
|
504
|
-
* -
|
|
505
|
-
* - Headline
|
|
503
|
+
* Differences from DatePicker:
|
|
504
|
+
* - Highlights range between start and end (SecondaryContainer)
|
|
505
|
+
* - Headline displays "Start date → End date"
|
|
506
506
|
* - Default title: "Select dates" (plural)
|
|
507
507
|
*
|
|
508
508
|
* @see https://m3.material.io/components/date-pickers/overview
|
|
@@ -526,13 +526,13 @@ declare const DateRangePicker: React.FC<DateRangePickerProps>;
|
|
|
526
526
|
/**
|
|
527
527
|
* @file date-picker/use-date-picker-state.ts
|
|
528
528
|
*
|
|
529
|
-
* Core state hook
|
|
530
|
-
*
|
|
529
|
+
* Core state hook for DatePicker — hoisted state pattern.
|
|
530
|
+
* Equivalent to `rememberDatePickerState()` in Android Compose Material3.
|
|
531
531
|
*
|
|
532
532
|
* @example
|
|
533
533
|
* ```tsx
|
|
534
534
|
* const state = useDatePickerState({
|
|
535
|
-
* locale: { locale: '
|
|
535
|
+
* locale: { locale: 'en-US', weekStartsOn: 1 },
|
|
536
536
|
* selectableDates: {
|
|
537
537
|
* isSelectableDate: (ms) => new Date(ms).getUTCDay() !== 0,
|
|
538
538
|
* isSelectableYear: (year) => year >= 2020,
|
|
@@ -545,24 +545,24 @@ declare const DateRangePicker: React.FC<DateRangePickerProps>;
|
|
|
545
545
|
*/
|
|
546
546
|
|
|
547
547
|
/**
|
|
548
|
-
* Hook
|
|
548
|
+
* Hook for managing state of DatePicker.
|
|
549
549
|
*
|
|
550
|
-
* @param options -
|
|
551
|
-
* @returns `DatePickerState` object
|
|
550
|
+
* @param options - Initial state configuration
|
|
551
|
+
* @returns `DatePickerState` object with state and actions
|
|
552
552
|
*/
|
|
553
553
|
declare const useDatePickerState: (options?: UseDatePickerStateOptions) => DatePickerState;
|
|
554
554
|
|
|
555
555
|
/**
|
|
556
556
|
* @file date-picker/use-date-range-picker-state.ts
|
|
557
557
|
*
|
|
558
|
-
* Core state hook
|
|
559
|
-
*
|
|
558
|
+
* Core state hook for DateRangePicker — hoisted state pattern.
|
|
559
|
+
* Equivalent to `rememberDateRangePickerState()` in Android Compose Material3.
|
|
560
560
|
*
|
|
561
|
-
*
|
|
561
|
+
* Range selection logic:
|
|
562
562
|
* - Click 1: set start date
|
|
563
563
|
* - Click 2 (ms > start): set end date → range complete
|
|
564
564
|
* - Click 2 (ms <= start): reset, set start = ms
|
|
565
|
-
* -
|
|
565
|
+
* - If both start and end exist: reset, set start = ms
|
|
566
566
|
*
|
|
567
567
|
* @example
|
|
568
568
|
* ```tsx
|
|
@@ -574,36 +574,36 @@ declare const useDatePickerState: (options?: UseDatePickerStateOptions) => DateP
|
|
|
574
574
|
*/
|
|
575
575
|
|
|
576
576
|
/**
|
|
577
|
-
* Hook
|
|
577
|
+
* Hook for managing state of DateRangePicker.
|
|
578
578
|
*
|
|
579
|
-
* @param options -
|
|
580
|
-
* @returns `DateRangePickerState` object
|
|
579
|
+
* @param options - Initial configuration
|
|
580
|
+
* @returns `DateRangePickerState` object with state and actions
|
|
581
581
|
*/
|
|
582
582
|
declare const useDateRangePickerState: (options?: UseDateRangePickerStateOptions) => DateRangePickerState;
|
|
583
583
|
|
|
584
584
|
/**
|
|
585
585
|
* @file time-picker/time-picker.types.ts
|
|
586
586
|
*
|
|
587
|
-
* TypeScript interfaces
|
|
588
|
-
*
|
|
587
|
+
* TypeScript interfaces and types for Time Picker component system.
|
|
588
|
+
* Ported from `TimePickerState` interface in Android Compose Material3.
|
|
589
589
|
*
|
|
590
590
|
* @see https://m3.material.io/components/time-pickers/overview
|
|
591
591
|
* @see docs/m3/date-and-time-pickers/time-pickers/TimePickerState.md
|
|
592
592
|
*/
|
|
593
593
|
|
|
594
594
|
/**
|
|
595
|
-
*
|
|
596
|
-
*
|
|
595
|
+
* Indicates which part of time is currently selected — hour or minute.
|
|
596
|
+
* Equivalent to `TimePickerSelectionMode` enum in Android Compose.
|
|
597
597
|
*/
|
|
598
598
|
type TimePickerSelectionMode = "hour" | "minute";
|
|
599
599
|
/** Visual arrangement of the clock display. */
|
|
600
600
|
type TimePickerLayout = "auto" | "vertical" | "horizontal";
|
|
601
601
|
/**
|
|
602
|
-
* State object
|
|
603
|
-
*
|
|
602
|
+
* State object for TimePicker — hoisted state pattern.
|
|
603
|
+
* Equivalent to `TimePickerState` interface in Android Compose Material3.
|
|
604
604
|
*
|
|
605
|
-
*
|
|
606
|
-
* (raw input,
|
|
605
|
+
* Separates `hour`/`minute` (always valid) and `hourInput`/`minuteInput`
|
|
606
|
+
* (raw input, can be invalid mid-typing in TimeInput mode).
|
|
607
607
|
*
|
|
608
608
|
* @example
|
|
609
609
|
* ```tsx
|
|
@@ -614,69 +614,69 @@ type TimePickerLayout = "auto" | "vertical" | "horizontal";
|
|
|
614
614
|
* ```
|
|
615
615
|
*/
|
|
616
616
|
interface TimePickerState {
|
|
617
|
-
/**
|
|
617
|
+
/** Current hour (0-23). Always valid. */
|
|
618
618
|
readonly hour: number;
|
|
619
|
-
/**
|
|
619
|
+
/** Current minute (0-59). Always valid. */
|
|
620
620
|
readonly minute: number;
|
|
621
621
|
/**
|
|
622
|
-
* Raw input
|
|
623
|
-
*
|
|
624
|
-
*
|
|
622
|
+
* Raw input for hour — bound to UI element.
|
|
623
|
+
* Can be invalid during typing (e.g. typing "1" before "2").
|
|
624
|
+
* Automatically updates `hour` when valid.
|
|
625
625
|
*/
|
|
626
626
|
readonly hourInput: number;
|
|
627
627
|
/**
|
|
628
|
-
* Raw input
|
|
629
|
-
*
|
|
630
|
-
*
|
|
628
|
+
* Raw input for minute — bound to UI element.
|
|
629
|
+
* Can be invalid during typing.
|
|
630
|
+
* Automatically updates `minute` when valid.
|
|
631
631
|
*/
|
|
632
632
|
readonly minuteInput: number;
|
|
633
|
-
/**
|
|
633
|
+
/** Format: `true` for 24h format, `false` for 12h AM/PM. */
|
|
634
634
|
readonly is24hour: boolean;
|
|
635
|
-
/**
|
|
635
|
+
/** Currently active selection mode ('hour' or 'minute'). */
|
|
636
636
|
readonly selection: TimePickerSelectionMode;
|
|
637
|
-
/** `true`
|
|
637
|
+
/** `true` if both hourInput and minuteInput are valid. */
|
|
638
638
|
readonly isInputValid: boolean;
|
|
639
|
-
/** `true`
|
|
639
|
+
/** `true` if hourInput is a valid hour (0-23 for 24h, 1-12 for 12h). */
|
|
640
640
|
readonly isHourInputValid: boolean;
|
|
641
|
-
/** `true`
|
|
641
|
+
/** `true` if minuteInput is a valid minute (0-59). */
|
|
642
642
|
readonly isMinuteInputValid: boolean;
|
|
643
|
-
/** `true`
|
|
643
|
+
/** `true` if current hour is PM (hour >= 12). */
|
|
644
644
|
readonly isPm: boolean;
|
|
645
645
|
/**
|
|
646
|
-
*
|
|
647
|
-
*
|
|
646
|
+
* Sets valid hour (0-23). Also updates hourInput.
|
|
647
|
+
* Used for clock dial interaction.
|
|
648
648
|
*/
|
|
649
649
|
setHour(h: number): void;
|
|
650
650
|
/**
|
|
651
|
-
*
|
|
652
|
-
*
|
|
651
|
+
* Sets valid minute (0-59). Also updates minuteInput.
|
|
652
|
+
* Used for clock dial interaction.
|
|
653
653
|
*/
|
|
654
654
|
setMinute(m: number): void;
|
|
655
655
|
/**
|
|
656
|
-
*
|
|
657
|
-
*
|
|
658
|
-
*
|
|
656
|
+
* Sets raw hour input (can be invalid).
|
|
657
|
+
* Used for TimeInput text field.
|
|
658
|
+
* Only updates `hour` when value is valid.
|
|
659
659
|
*/
|
|
660
660
|
setHourInput(h: number): void;
|
|
661
661
|
/**
|
|
662
|
-
*
|
|
663
|
-
*
|
|
664
|
-
*
|
|
662
|
+
* Sets raw minute input (can be invalid).
|
|
663
|
+
* Used for TimeInput text field.
|
|
664
|
+
* Only updates `minute` when value is valid.
|
|
665
665
|
*/
|
|
666
666
|
setMinuteInput(m: number): void;
|
|
667
|
-
/**
|
|
667
|
+
/** Switches selection mode between 'hour' and 'minute'. */
|
|
668
668
|
setSelection(mode: TimePickerSelectionMode): void;
|
|
669
669
|
/**
|
|
670
670
|
* Toggle AM/PM.
|
|
671
|
-
*
|
|
671
|
+
* Automatically converts internal hour (e.g. 7 AM → 19, 15 PM → 3 AM).
|
|
672
672
|
*/
|
|
673
673
|
setIsPm(pm: boolean): void;
|
|
674
|
-
/**
|
|
674
|
+
/** Resets to initial state. */
|
|
675
675
|
reset(): void;
|
|
676
676
|
}
|
|
677
677
|
/**
|
|
678
|
-
* Options
|
|
679
|
-
*
|
|
678
|
+
* Options for `useTimePickerState` hook.
|
|
679
|
+
* Equivalent to `rememberTimePickerState()` parameters in Compose.
|
|
680
680
|
*
|
|
681
681
|
* @example
|
|
682
682
|
* ```tsx
|
|
@@ -689,27 +689,27 @@ interface TimePickerState {
|
|
|
689
689
|
*/
|
|
690
690
|
interface UseTimePickerStateOptions {
|
|
691
691
|
/**
|
|
692
|
-
*
|
|
692
|
+
* Initial hour (0-23).
|
|
693
693
|
* @default 0
|
|
694
694
|
*/
|
|
695
695
|
initialHour?: number;
|
|
696
696
|
/**
|
|
697
|
-
*
|
|
697
|
+
* Initial minute (0-59).
|
|
698
698
|
* @default 0
|
|
699
699
|
*/
|
|
700
700
|
initialMinute?: number;
|
|
701
701
|
/**
|
|
702
|
-
*
|
|
703
|
-
* @default false (12h format
|
|
702
|
+
* Format: 24h format (`true`) or 12h AM/PM (`false`).
|
|
703
|
+
* @default false (12h format with AM/PM selector)
|
|
704
704
|
*/
|
|
705
705
|
is24hour?: boolean;
|
|
706
706
|
}
|
|
707
707
|
/**
|
|
708
|
-
* Props
|
|
709
|
-
*
|
|
708
|
+
* Props for `TimePicker` component (dial/clock mode).
|
|
709
|
+
* Equivalent to `TimePicker` composable in Android Compose.
|
|
710
710
|
*/
|
|
711
711
|
interface TimePickerProps {
|
|
712
|
-
/** Hoisted state
|
|
712
|
+
/** Hoisted state from `useTimePickerState()`. */
|
|
713
713
|
state: TimePickerState;
|
|
714
714
|
/**
|
|
715
715
|
* Arrangement of the clock header and dial.
|
|
@@ -718,58 +718,57 @@ interface TimePickerProps {
|
|
|
718
718
|
* @default "auto"
|
|
719
719
|
*/
|
|
720
720
|
layout?: TimePickerLayout;
|
|
721
|
-
/** CSS class
|
|
721
|
+
/** Additional CSS class for container. */
|
|
722
722
|
className?: string;
|
|
723
723
|
}
|
|
724
724
|
/**
|
|
725
|
-
* Props
|
|
726
|
-
*
|
|
725
|
+
* Props for `TimeInput` component (text input mode).
|
|
726
|
+
* Equivalent to `TimeInput` composable in Android Compose.
|
|
727
727
|
*/
|
|
728
728
|
interface TimeInputProps {
|
|
729
|
-
/** Hoisted state
|
|
729
|
+
/** Hoisted state from `useTimePickerState()`. */
|
|
730
730
|
state: TimePickerState;
|
|
731
|
-
/** CSS class
|
|
731
|
+
/** Additional CSS class for container. */
|
|
732
732
|
className?: string;
|
|
733
733
|
}
|
|
734
734
|
/**
|
|
735
|
-
* Props
|
|
736
|
-
*
|
|
735
|
+
* Props for `TimePickerDialog` component.
|
|
736
|
+
* Equivalent to `TimePickerDialog` composable in Android Compose.
|
|
737
737
|
*/
|
|
738
738
|
interface TimePickerDialogProps {
|
|
739
|
-
/**
|
|
739
|
+
/** Open/close state of the dialog. */
|
|
740
740
|
open: boolean;
|
|
741
|
-
/** Callback
|
|
741
|
+
/** Callback when dialog requests dismissal (scrim click, Escape). */
|
|
742
742
|
onDismiss: () => void;
|
|
743
743
|
/**
|
|
744
|
-
*
|
|
745
|
-
* Dialog không set up event handlers — caller tự xử lý.
|
|
744
|
+
* Confirm button element rendered by caller (e.g. Button "OK").
|
|
746
745
|
*/
|
|
747
746
|
confirmButton: React.ReactNode;
|
|
748
747
|
/**
|
|
749
|
-
*
|
|
748
|
+
* Optional cancel/dismiss button element.
|
|
750
749
|
* @default null
|
|
751
750
|
*/
|
|
752
751
|
dismissButton?: React.ReactNode;
|
|
753
752
|
/**
|
|
754
|
-
*
|
|
755
|
-
*
|
|
753
|
+
* Optional mode toggle button between Dial and Input mode.
|
|
754
|
+
* Positioned at bottom-left of footer.
|
|
756
755
|
*/
|
|
757
756
|
modeToggleButton?: React.ReactNode;
|
|
758
757
|
/**
|
|
759
|
-
*
|
|
758
|
+
* Accessible title displayed on dialog header.
|
|
760
759
|
* @default "Select time"
|
|
761
760
|
*/
|
|
762
761
|
title?: string;
|
|
763
|
-
/** Content —
|
|
762
|
+
/** Content — typically `<TimePicker>` or `<TimeInput>`. */
|
|
764
763
|
children: React.ReactNode;
|
|
765
|
-
/** CSS class
|
|
764
|
+
/** Additional CSS class for dialog panel. */
|
|
766
765
|
className?: string;
|
|
767
766
|
}
|
|
768
767
|
|
|
769
768
|
/**
|
|
770
769
|
* @file time-picker/time-input.tsx
|
|
771
770
|
*
|
|
772
|
-
* TimeInput — text input mode
|
|
771
|
+
* TimeInput — text input mode for time entry.
|
|
773
772
|
*
|
|
774
773
|
* Layout:
|
|
775
774
|
* ```
|
|
@@ -782,12 +781,12 @@ interface TimePickerDialogProps {
|
|
|
782
781
|
* ```
|
|
783
782
|
*
|
|
784
783
|
* Behavior:
|
|
785
|
-
* -
|
|
786
|
-
* - Auto-advance:
|
|
787
|
-
* - Validation: error state
|
|
788
|
-
* - AM/PM toggle
|
|
784
|
+
* - Two `<input>` fields for hour and minute
|
|
785
|
+
* - Auto-advance: entering 2 valid digits automatically focuses next field
|
|
786
|
+
* - Validation: error state when value is out of range
|
|
787
|
+
* - AM/PM toggle on right (hidden when is24hour)
|
|
789
788
|
*
|
|
790
|
-
*
|
|
789
|
+
* Ported from `TimeInputImpl` in TimePicker.kt.
|
|
791
790
|
*
|
|
792
791
|
* @see docs/m3/date-and-time-pickers/time-pickers/TimePicker.kt (TimeInputImpl)
|
|
793
792
|
*/
|
|
@@ -795,7 +794,7 @@ interface TimePickerDialogProps {
|
|
|
795
794
|
/**
|
|
796
795
|
* TimeInput — text input mode.
|
|
797
796
|
*
|
|
798
|
-
*
|
|
797
|
+
* Used with `useTimePickerState`:
|
|
799
798
|
*
|
|
800
799
|
* @example
|
|
801
800
|
* ```tsx
|
|
@@ -828,8 +827,8 @@ declare const TimePicker: React.FC<TimePickerProps>;
|
|
|
828
827
|
/**
|
|
829
828
|
* @file time-picker/time-picker.tokens.ts
|
|
830
829
|
*
|
|
831
|
-
* MD3 Design tokens
|
|
832
|
-
* Verified mapping
|
|
830
|
+
* MD3 Design tokens for Time Picker component system.
|
|
831
|
+
* Verified mapping from:
|
|
833
832
|
* - TimePickerTokens.kt → ClockDial, TimeSelector, PeriodSelector (Picker mode)
|
|
834
833
|
* - TimeInputTokens.kt → TimeField, PeriodSelector (Input mode)
|
|
835
834
|
*
|
|
@@ -840,8 +839,8 @@ declare const TimePicker: React.FC<TimePickerProps>;
|
|
|
840
839
|
* @see docs/m3/date-and-time-pickers/time-pickers/TimeInputTokens.kt
|
|
841
840
|
*/
|
|
842
841
|
/**
|
|
843
|
-
* Color tokens
|
|
844
|
-
*
|
|
842
|
+
* Color tokens for Time Picker — mapped from TimePickerTokens.kt + TimeInputTokens.kt.
|
|
843
|
+
* Uses CSS custom properties from MD3 theme (packages/tokens/src/colors.css).
|
|
845
844
|
*/
|
|
846
845
|
declare const TP_COLORS: {
|
|
847
846
|
/** Dial background — SurfaceContainerHighest */
|
|
@@ -892,9 +891,9 @@ declare const TP_COLORS: {
|
|
|
892
891
|
readonly headline: "var(--md-sys-color-on-surface-variant)";
|
|
893
892
|
};
|
|
894
893
|
/**
|
|
895
|
-
* Tailwind utility class strings
|
|
896
|
-
*
|
|
897
|
-
*
|
|
894
|
+
* Tailwind utility class strings for Time Picker elements.
|
|
895
|
+
* Used with `cn()` function.
|
|
896
|
+
* Mapped from packages/tailwind/src/index.css (--color-m3-* tokens).
|
|
898
897
|
*/
|
|
899
898
|
declare const TP_CLASSES: {
|
|
900
899
|
/** Main picker/input container */
|
|
@@ -921,10 +920,10 @@ declare const TP_CLASSES: {
|
|
|
921
920
|
readonly selectorPrimary: "fill-m3-primary stroke-m3-primary";
|
|
922
921
|
};
|
|
923
922
|
/**
|
|
924
|
-
* Shape tokens — corner radii
|
|
925
|
-
*
|
|
923
|
+
* Shape tokens — corner radii from MD3 shape scale.
|
|
924
|
+
* Mapped from ShapeKeyTokens in TimePickerTokens.kt + TimeInputTokens.kt.
|
|
926
925
|
*
|
|
927
|
-
*
|
|
926
|
+
* Uses Tailwind class names from packages/tailwind/src/index.css.
|
|
928
927
|
*/
|
|
929
928
|
declare const TP_SHAPE: {
|
|
930
929
|
/** Dialog container — CornerExtraLarge = 28px */
|
|
@@ -939,8 +938,8 @@ declare const TP_SHAPE: {
|
|
|
939
938
|
readonly timeField: "rounded-m3-sm";
|
|
940
939
|
};
|
|
941
940
|
/**
|
|
942
|
-
* Fixed dimension tokens
|
|
943
|
-
*
|
|
941
|
+
* Fixed dimension tokens from TimePickerTokens.kt + TimeInputTokens.kt.
|
|
942
|
+
* Unit: px (converted from dp).
|
|
944
943
|
*/
|
|
945
944
|
declare const TP_SIZE: {
|
|
946
945
|
/** ClockDialContainerSize = 256dp */
|
|
@@ -978,38 +977,37 @@ declare const TP_SIZE: {
|
|
|
978
977
|
/**
|
|
979
978
|
* @file time-picker/time-picker-dialog.tsx
|
|
980
979
|
*
|
|
981
|
-
* TimePickerDialog — modal container
|
|
982
|
-
*
|
|
983
|
-
* giống pattern của DatePickerDialog.
|
|
980
|
+
* TimePickerDialog — modal container for TimePicker and TimeInput.
|
|
981
|
+
* Reuses Dialog + DialogPortal primitives matching DatePickerDialog pattern.
|
|
984
982
|
*
|
|
985
983
|
* Layout:
|
|
986
984
|
* ```
|
|
987
985
|
* ┌─────────────────────┐
|
|
988
|
-
* │ [Content] │ ← TimePicker
|
|
986
|
+
* │ [Content] │ ← TimePicker or TimeInput
|
|
989
987
|
* │─────────────────────│
|
|
990
988
|
* │ 🎹 [Cancel] [OK] │ ← footer: modeToggle + spacer + dismiss + confirm
|
|
991
989
|
* └─────────────────────┘
|
|
992
990
|
* ```
|
|
993
991
|
*
|
|
994
|
-
* Tokens
|
|
992
|
+
* Tokens from TimePickerDialog.kt (shared with DatePickerDialog):
|
|
995
993
|
* - ContainerColor = SurfaceContainerHigh
|
|
996
994
|
* - ContainerShape = CornerExtraLarge (28px)
|
|
997
995
|
* - ContainerElevation = Level3
|
|
998
996
|
*
|
|
999
|
-
*
|
|
997
|
+
* Ported from `TimePickerDialog.kt` and `DatePickerDialog` pattern.
|
|
1000
998
|
*
|
|
1001
999
|
* @see docs/m3/date-and-time-pickers/time-pickers/TimePickerDialog.kt
|
|
1002
1000
|
* @see packages/react/src/ui/date-time-pickers/date-picker/date-picker-dialog.tsx
|
|
1003
1001
|
*/
|
|
1004
1002
|
|
|
1005
1003
|
/**
|
|
1006
|
-
* TimePickerDialog — modal dialog
|
|
1004
|
+
* TimePickerDialog — modal dialog container for TimePicker / TimeInput.
|
|
1007
1005
|
*
|
|
1008
|
-
*
|
|
1009
|
-
*
|
|
1010
|
-
* layout specs MD3 Time Picker.
|
|
1006
|
+
* Reuses `<Dialog>` (Root) and `<DialogPortal>` (AnimatePresence + Portal)
|
|
1007
|
+
* while managing Overlay and Content to preserve MD3 Time Picker specs.
|
|
1011
1008
|
*
|
|
1012
1009
|
* @example Basic usage
|
|
1010
|
+
|
|
1013
1011
|
* ```tsx
|
|
1014
1012
|
* const state = useTimePickerState({ initialHour: 7 });
|
|
1015
1013
|
* const [open, setOpen] = React.useState(false);
|
|
@@ -1041,11 +1039,11 @@ declare const TimePickerDialog: React.FC<TimePickerDialogProps>;
|
|
|
1041
1039
|
/**
|
|
1042
1040
|
* @file time-picker/use-time-picker-state.ts
|
|
1043
1041
|
*
|
|
1044
|
-
* Core state hook
|
|
1045
|
-
*
|
|
1042
|
+
* Core state hook for TimePicker — hoisted state pattern.
|
|
1043
|
+
* Ported from `rememberTimePickerState()` in Android Compose Material3.
|
|
1046
1044
|
*
|
|
1047
|
-
*
|
|
1048
|
-
* (raw input,
|
|
1045
|
+
* Separates `hour`/`minute` (always valid) and `hourInput`/`minuteInput`
|
|
1046
|
+
* (raw input, can be invalid mid-typing) — preserving Kotlin semantics.
|
|
1049
1047
|
*
|
|
1050
1048
|
* @see docs/m3/date-and-time-pickers/time-pickers/TimePickerState.md
|
|
1051
1049
|
*
|
|
@@ -1063,11 +1061,11 @@ declare const TimePickerDialog: React.FC<TimePickerDialogProps>;
|
|
|
1063
1061
|
*/
|
|
1064
1062
|
|
|
1065
1063
|
/**
|
|
1066
|
-
*
|
|
1067
|
-
*
|
|
1064
|
+
* State management hook for TimePicker and TimeInput.
|
|
1065
|
+
* Equivalent to `rememberTimePickerState()` in Android Compose.
|
|
1068
1066
|
*
|
|
1069
|
-
* @param options -
|
|
1070
|
-
* @returns `TimePickerState` object
|
|
1067
|
+
* @param options - Initial configuration options
|
|
1068
|
+
* @returns `TimePickerState` object with state and actions
|
|
1071
1069
|
*/
|
|
1072
1070
|
declare const useTimePickerState: (options?: UseTimePickerStateOptions) => TimePickerState;
|
|
1073
1071
|
|