@astryxdesign/core 0.5.2-canary.fa93107 → 0.5.2-canary.fb400d4
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/DateTimeInput/DateTimeInput.d.ts +47 -13
- package/dist/DateTimeInput/DateTimeInput.d.ts.map +1 -1
- package/dist/DateTimeInput/DateTimeInput.js +265 -162
- package/dist/DateTimeInput/NativeDateSegment.d.ts +24 -0
- package/dist/DateTimeInput/NativeDateSegment.d.ts.map +1 -0
- package/dist/DateTimeInput/NativeDateSegment.js +235 -0
- package/dist/DateTimeInput/NativeTimeSegment.d.ts +26 -0
- package/dist/DateTimeInput/NativeTimeSegment.d.ts.map +1 -0
- package/dist/DateTimeInput/NativeTimeSegment.js +240 -0
- package/dist/DateTimeInput/index.d.ts +1 -1
- package/dist/DateTimeInput/index.d.ts.map +1 -1
- package/dist/DateTimeInput/nativePickerSegmentStyles.d.ts +95 -0
- package/dist/DateTimeInput/nativePickerSegmentStyles.d.ts.map +1 -0
- package/dist/DateTimeInput/nativePickerSegmentStyles.js +103 -0
- package/package.json +2 -2
- package/src/DateTimeInput/DateTimeInput.doc.mjs +43 -23
- package/src/DateTimeInput/DateTimeInput.tsx +384 -181
- package/src/DateTimeInput/DateTimeInputTouch.test.tsx +10 -2
- package/src/DateTimeInput/NativeDateSegment.tsx +308 -0
- package/src/DateTimeInput/NativePickerSegments.test.tsx +626 -0
- package/src/DateTimeInput/NativeTimeSegment.tsx +323 -0
- package/src/DateTimeInput/index.ts +1 -0
- package/src/DateTimeInput/nativePickerSegmentStyles.ts +120 -0
|
@@ -5,6 +5,7 @@ import type { SizeValue } from '../utils/types';
|
|
|
5
5
|
export type ISODateTimeString = string & {
|
|
6
6
|
readonly __brand: 'ISODateTimeString';
|
|
7
7
|
};
|
|
8
|
+
export type DateTimeInputNativePicker = 'touch' | 'always' | 'never';
|
|
8
9
|
export type DateTimeInputHourFormat = '12h' | '24h';
|
|
9
10
|
export type DateTimeInputSize = 'sm' | 'md' | 'lg';
|
|
10
11
|
/** Supported minute increments for arrow-key stepping of the time field. */
|
|
@@ -112,9 +113,10 @@ export interface DateTimeInputProps extends Omit<BaseProps, 'onChange' | 'defaul
|
|
|
112
113
|
*/
|
|
113
114
|
hourFormat?: DateTimeInputHourFormat;
|
|
114
115
|
/**
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
116
|
+
* Minute step for the time field. Astryx's typed field uses it for arrow-key
|
|
117
|
+
* stepping. The default value permits the native time picker; a non-default
|
|
118
|
+
* value retains the Astryx time field because iOS does not apply native
|
|
119
|
+
* `step` as picker cadence. Ignored by the Astryx touch sheet.
|
|
118
120
|
* @default 1
|
|
119
121
|
*/
|
|
120
122
|
timeIncrement?: DateTimeInputTimeIncrement;
|
|
@@ -129,10 +131,10 @@ export interface DateTimeInputProps extends Omit<BaseProps, 'onChange' | 'defaul
|
|
|
129
131
|
* list is a shortcut, not a restriction, so a time between two options can
|
|
130
132
|
* still be typed.
|
|
131
133
|
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
134
|
+
* Setting this prop retains Astryx's typed/combobox time field even when
|
|
135
|
+
* `nativePicker` otherwise selects native controls, because the OS picker has
|
|
136
|
+
* no equivalent preset list. The Astryx touch sheet uses wheels instead.
|
|
137
|
+
* Independent of `timeIncrement`, which governs arrow-key stepping.
|
|
136
138
|
*/
|
|
137
139
|
timeOptionInterval?: DateTimeInputTimeOptionInterval;
|
|
138
140
|
/**
|
|
@@ -190,15 +192,47 @@ export interface DateTimeInputProps extends Omit<BaseProps, 'onChange' | 'defaul
|
|
|
190
192
|
* @default 0
|
|
191
193
|
*/
|
|
192
194
|
weekStartsOn?: DayOfWeek | DayOfWeekName;
|
|
195
|
+
/**
|
|
196
|
+
* When date and time picking are handed to the browser/OS instead of Astryx's
|
|
197
|
+
* calendar and time surfaces.
|
|
198
|
+
*
|
|
199
|
+
* - `'touch'` (default): native date and time inputs on a coarse primary
|
|
200
|
+
* pointer; Astryx's typed fields and popovers otherwise
|
|
201
|
+
* - `'always'`: native date and time inputs wherever the browser supports them
|
|
202
|
+
* - `'never'`: Astryx's own surfaces everywhere — typed fields on a fine
|
|
203
|
+
* pointer and the coordinated Date/Time bottom sheet on a coarse pointer
|
|
204
|
+
*
|
|
205
|
+
* Native pickers cannot express `numberOfMonths`, `weekStartsOn`,
|
|
206
|
+
* `dateConstraints`, or `timeOptionInterval`. Calendar-only options are
|
|
207
|
+
* ignored in native mode and constraints are enforced on commit. The native
|
|
208
|
+
* time control is used for the default minute-precision contract; requesting
|
|
209
|
+
* `hasSeconds`, a non-default `timeIncrement`, or `timeOptionInterval` keeps
|
|
210
|
+
* Astryx's time field because iOS cannot represent those behaviors faithfully.
|
|
211
|
+
* `min` / `max` are forwarded to each native control as hints and enforced in
|
|
212
|
+
* JavaScript. `hourFormat` formats the closed value; the OS picker follows the
|
|
213
|
+
* user's locale.
|
|
214
|
+
*
|
|
215
|
+
* @default 'touch'
|
|
216
|
+
* @example
|
|
217
|
+
* ```
|
|
218
|
+
* <DateTimeInput
|
|
219
|
+
* label="Event time"
|
|
220
|
+
* value={dateTime}
|
|
221
|
+
* onChange={setDateTime}
|
|
222
|
+
* nativePicker="never"
|
|
223
|
+
* />
|
|
224
|
+
* ```
|
|
225
|
+
*/
|
|
226
|
+
nativePicker?: DateTimeInputNativePicker;
|
|
193
227
|
}
|
|
194
228
|
/**
|
|
195
|
-
* A combined date and time picker
|
|
196
|
-
*
|
|
197
|
-
*
|
|
198
|
-
*
|
|
199
|
-
*
|
|
229
|
+
* A combined date and time picker whose `nativePicker` prop chooses both
|
|
230
|
+
* surfaces. Native modes use OS-owned date and time controls in Astryx field
|
|
231
|
+
* chrome. With `nativePicker="never"`, fine pointers keep the typed fields and
|
|
232
|
+
* popovers while coarse pointers get Astryx's coordinated Date/Time bottom
|
|
233
|
+
* sheet.
|
|
200
234
|
*/
|
|
201
|
-
export declare function DateTimeInput(props: DateTimeInputProps): import("react").JSX.Element;
|
|
235
|
+
export declare function DateTimeInput({ nativePicker, ...props }: DateTimeInputProps): import("react").JSX.Element;
|
|
202
236
|
export declare namespace DateTimeInput {
|
|
203
237
|
var displayName: string;
|
|
204
238
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateTimeInput.d.ts","sourceRoot":"","sources":["../../src/DateTimeInput/DateTimeInput.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DateTimeInput.d.ts","sourceRoot":"","sources":["../../src/DateTimeInput/DateTimeInput.tsx"],"names":[],"mappings":"AA4CA,OAAO,EAGL,KAAK,WAAW,EAKjB,MAAM,UAAU,CAAC;AAIlB,OAAO,EAIL,KAAK,SAAS,EACd,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;AA2BrB,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAa9C,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG;IACvC,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;CACvC,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAErE,MAAM,MAAM,uBAAuB,GAAG,KAAK,GAAG,KAAK,CAAC;AAEpD,MAAM,MAAM,iBAAiB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEnD,4EAA4E;AAC5E,MAAM,MAAM,0BAA0B,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAE9D;;;GAGG;AACH,MAAM,MAAM,+BAA+B,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAEpE,YAAY,EACV,WAAW,IAAI,mBAAmB,EAClC,eAAe,IAAI,uBAAuB,GAC3C,MAAM,UAAU,CA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