@object-ui/fields 11.4.0 → 13.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.
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Open the browser's native picker (date / datetime-local / time) for an input.
3
+ *
4
+ * Native date/time inputs only open their picker when the user clicks the small
5
+ * calendar/clock icon. Calling `showPicker()` on click makes the whole field
6
+ * behave like other widgets — clicking anywhere in the box opens the picker.
7
+ *
8
+ * `showPicker()` can throw (unsupported browser, not user-activated, or the input
9
+ * is disabled/hidden), so failures are swallowed and the native fallback stands.
10
+ */
11
+ export function openNativePicker(input: HTMLInputElement): void {
12
+ if (input.disabled || input.readOnly) return;
13
+ try {
14
+ (input as HTMLInputElement & { showPicker?: () => void }).showPicker?.();
15
+ } catch {
16
+ // Ignore — browsers throw when the picker can't be shown; the icon still works.
17
+ }
18
+ }