@octane-xplat/date-picker 0.18.0 → 0.20.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 (35) hide show
  1. package/README.md +2 -139
  2. package/package.json +87 -81
  3. package/src/AppKitDatePicker.macos.css +1 -0
  4. package/src/AppKitDatePicker.macos.tsrx +43 -41
  5. package/src/AppKitDatePicker.tsrx +2 -0
  6. package/src/MaterialDatePicker.android.tsrx +51 -36
  7. package/src/MaterialDatePicker.tsrx +2 -0
  8. package/src/SwiftUIDatePicker.ios.tsrx +56 -37
  9. package/src/SwiftUIDatePicker.tsrx +2 -0
  10. package/src/android/index.ts +4 -4
  11. package/src/android/types.ts +151 -66
  12. package/src/date-picker-owner.macos.ts +264 -0
  13. package/src/ios/index.ts +3 -3
  14. package/src/ios/types.ts +29 -20
  15. package/src/macos/index.ts +3 -3
  16. package/src/macos/types.ts +27 -18
  17. package/src/style-merge.ts +59 -0
  18. package/types/generated/.tsrx-typegen-manifest.json +17 -0
  19. package/types/generated/AppKitDatePicker.macos.d.ts +10 -0
  20. package/types/generated/MaterialDatePicker.android.d.ts +15 -0
  21. package/types/generated/SwiftUIDatePicker.ios.d.ts +15 -0
  22. package/types/generated/android/index.d.ts +2 -0
  23. package/types/generated/android/types.d.ts +126 -0
  24. package/types/generated/date-picker-owner.macos.d.ts +29 -0
  25. package/types/generated/index.d.ts +1 -0
  26. package/types/generated/ios/index.d.ts +2 -0
  27. package/types/generated/ios/types.d.ts +33 -0
  28. package/types/generated/macos/index.d.ts +2 -0
  29. package/types/generated/macos/types.d.ts +31 -0
  30. package/types/generated/style-merge.d.ts +8 -0
  31. package/LICENSE +0 -21
  32. package/types/android/index.d.ts +0 -61
  33. package/types/index.d.ts +0 -1
  34. package/types/ios/index.d.ts +0 -21
  35. package/types/macos/index.d.ts +0 -20
@@ -0,0 +1,17 @@
1
+ {
2
+ "version": 1,
3
+ "files": [
4
+ "AppKitDatePicker.macos.d.ts",
5
+ "MaterialDatePicker.android.d.ts",
6
+ "SwiftUIDatePicker.ios.d.ts",
7
+ "android/index.d.ts",
8
+ "android/types.d.ts",
9
+ "date-picker-owner.macos.d.ts",
10
+ "index.d.ts",
11
+ "ios/index.d.ts",
12
+ "ios/types.d.ts",
13
+ "macos/index.d.ts",
14
+ "macos/types.d.ts",
15
+ "style-merge.d.ts"
16
+ ]
17
+ }
@@ -0,0 +1,10 @@
1
+ /** @jsxImportSource @octane-xplat/jsx */
2
+
3
+ import type { AppKitDatePickerProps } from './macos/types.js';
4
+ /** Embeds a real NSDatePicker in the leaf's backing view via the
5
+ * `__xplatAppKit` bridge. 'date' uses a text field (or the inline
6
+ * graphical calendar when `pickerStyle` is 'graphical'); 'time' uses the
7
+ * clock-and-calendar field; 'dateAndTime' shows both element groups.
8
+ * The host element carries an explicit size — the picker is pinned to
9
+ * its edges. */
10
+ export declare function AppKitDatePicker(props: AppKitDatePickerProps): unknown;
@@ -0,0 +1,15 @@
1
+ import type { Attributes } from '@octane-xplat/jsx/intrinsics';
2
+ import type { MaterialDatePickerProps } from './android/types.js';
3
+ declare module '@octane-xplat/jsx/intrinsics' {
4
+ interface NativeElements<TElement> {
5
+ xplatandroiddatepicker: Attributes<TElement, {
6
+ composeId?: string;
7
+ data?: Record<string, unknown>;
8
+ onComposeEvent?: (event: {
9
+ data?: unknown;
10
+ }) => void;
11
+ }>;
12
+ }
13
+ }
14
+ /** Renders a Material 3 DatePicker/TimePicker through the NativeScript Jetpack Compose bridge. */
15
+ export declare function MaterialDatePicker(props: MaterialDatePickerProps): unknown;
@@ -0,0 +1,15 @@
1
+ import type { Attributes } from '@octane-xplat/jsx/intrinsics';
2
+ import type { SwiftUIDatePickerProps } from './ios/types.js';
3
+ declare module '@octane-xplat/jsx/intrinsics' {
4
+ interface NativeElements<TElement> {
5
+ xplatiosdatepicker: Attributes<TElement, {
6
+ swiftId?: string;
7
+ data?: Record<string, unknown>;
8
+ onSwiftUIEvent?: (event: {
9
+ data?: unknown;
10
+ }) => void;
11
+ }>;
12
+ }
13
+ }
14
+ /** Renders a SwiftUI DatePicker through NativeScript's SwiftUI bridge. */
15
+ export declare function SwiftUIDatePicker(props: SwiftUIDatePickerProps): unknown;
@@ -0,0 +1,2 @@
1
+ export { MaterialDatePicker } from '../MaterialDatePicker.android.js';
2
+ export type { MaterialDatePickerComponents, MaterialDatePickerElementColors, MaterialDatePickerProps, MaterialDatePickerVariant, } from './types.js';
@@ -0,0 +1,126 @@
1
+ /** Date-picker presentation variant. */
2
+ export type MaterialDatePickerVariant = 'picker' | 'input';
3
+ /** Per-part Material color slots. */
4
+ export type MaterialDatePickerComponents = 'date' | 'hourAndMinute' | 'dateAndTime';
5
+ /**
6
+ * Color overrides for the Material 3 picker elements. Every field is a CSS
7
+ * hex string (`#rgb`, `#rrggbb`, or `#aarrggbb`); unset fields use the
8
+ * Material 3 theme defaults.
9
+ */
10
+ export interface MaterialDatePickerElementColors {
11
+ /** Part color override (any platform color string). */
12
+ containerColor?: string;
13
+ /** Part color override (any platform color string). */
14
+ titleContentColor?: string;
15
+ /** Part color override (any platform color string). */
16
+ headlineContentColor?: string;
17
+ /** Part color override (any platform color string). */
18
+ weekdayContentColor?: string;
19
+ /** Part color override (any platform color string). */
20
+ subheadContentColor?: string;
21
+ /** Part color override (any platform color string). */
22
+ navigationContentColor?: string;
23
+ /** Part color override (any platform color string). */
24
+ yearContentColor?: string;
25
+ /** Part color override (any platform color string). */
26
+ disabledYearContentColor?: string;
27
+ /** Part color override (any platform color string). */
28
+ currentYearContentColor?: string;
29
+ /** Part color override (any platform color string). */
30
+ selectedYearContentColor?: string;
31
+ /** Part color override (any platform color string). */
32
+ disabledSelectedYearContentColor?: string;
33
+ /** Part color override (any platform color string). */
34
+ selectedYearContainerColor?: string;
35
+ /** Part color override (any platform color string). */
36
+ disabledSelectedYearContainerColor?: string;
37
+ /** Part color override (any platform color string). */
38
+ dayContentColor?: string;
39
+ /** Part color override (any platform color string). */
40
+ disabledDayContentColor?: string;
41
+ /** Part color override (any platform color string). */
42
+ selectedDayContentColor?: string;
43
+ /** Part color override (any platform color string). */
44
+ disabledSelectedDayContentColor?: string;
45
+ /** Part color override (any platform color string). */
46
+ selectedDayContainerColor?: string;
47
+ /** Part color override (any platform color string). */
48
+ disabledSelectedDayContainerColor?: string;
49
+ /** Part color override (any platform color string). */
50
+ todayContentColor?: string;
51
+ /** Part color override (any platform color string). */
52
+ todayDateBorderColor?: string;
53
+ /** Part color override (any platform color string). */
54
+ dayInSelectionRangeContentColor?: string;
55
+ /** Part color override (any platform color string). */
56
+ dayInSelectionRangeContainerColor?: string;
57
+ /** Part color override (any platform color string). */
58
+ dividerColor?: string;
59
+ /** Part color override (any platform color string). */
60
+ clockDialColor?: string;
61
+ /** Part color override (any platform color string). */
62
+ clockDialSelectedContentColor?: string;
63
+ /** Part color override (any platform color string). */
64
+ clockDialUnselectedContentColor?: string;
65
+ /** Part color override (any platform color string). */
66
+ selectorColor?: string;
67
+ /** Part color override (any platform color string). */
68
+ periodSelectorBorderColor?: string;
69
+ /** Part color override (any platform color string). */
70
+ periodSelectorSelectedContainerColor?: string;
71
+ /** Part color override (any platform color string). */
72
+ periodSelectorUnselectedContainerColor?: string;
73
+ /** Part color override (any platform color string). */
74
+ periodSelectorSelectedContentColor?: string;
75
+ /** Part color override (any platform color string). */
76
+ periodSelectorUnselectedContentColor?: string;
77
+ /** Part color override (any platform color string). */
78
+ timeSelectorSelectedContainerColor?: string;
79
+ /** Part color override (any platform color string). */
80
+ timeSelectorUnselectedContainerColor?: string;
81
+ /** Part color override (any platform color string). */
82
+ timeSelectorSelectedContentColor?: string;
83
+ /** Part color override (any platform color string). */
84
+ timeSelectorUnselectedContentColor?: string;
85
+ }
86
+ /** Android date-picker props (Material3 date picker). */
87
+ export interface MaterialDatePickerProps {
88
+ /** Element id passed through to the host element. */
89
+ id?: string;
90
+ /** Class list applied to the picker element. */
91
+ className?: any;
92
+ /** Inline style (string CSS or object). */
93
+ style?: any;
94
+ /** Date the picker starts on. The picker keeps its own selection after mount. */
95
+ initialDate?: Date;
96
+ /** Calendar grid or text-field input. @default 'picker' */
97
+ variant?: MaterialDatePickerVariant;
98
+ /**
99
+ * `'date'` renders the M3 DatePicker, `'hourAndMinute'` the M3 TimePicker.
100
+ * `'dateAndTime'` renders the date picker (combined input is not supported).
101
+ * @default 'date'
102
+ */
103
+ displayedComponents?: MaterialDatePickerComponents;
104
+ /** Show the picker/input mode toggle. @default true */
105
+ showVariantToggle?: boolean;
106
+ /** 24-hour dial for the time picker. @default true */
107
+ is24Hour?: boolean;
108
+ /** Accent applied to a subset of elements when `elementColors` is unset. */
109
+ /** Part color override (any platform color string). */
110
+ color?: string;
111
+ /** Part color override (any platform color string). */
112
+ elementColors?: MaterialDatePickerElementColors;
113
+ /** Bounds the selectable date range; also derives the calendar year range. */
114
+ selectableDates?: {
115
+ start?: Date;
116
+ end?: Date;
117
+ };
118
+ /** Spoken name for assistive tech. */
119
+ accessibilityLabel?: string;
120
+ /**
121
+ * Called with the selected timestamp (null when the selection clears). The
122
+ * DatePicker emits the chosen UTC day; the TimePicker emits the chosen
123
+ * hour/minute on the initial date's day.
124
+ */
125
+ onDateSelected?: (date: Date | null) => void;
126
+ }
@@ -0,0 +1,29 @@
1
+ import type { AppKitDatePickerProps } from './macos/types.js';
2
+ export interface DatePickerOptions {
3
+ mode: NonNullable<AppKitDatePickerProps['components']>;
4
+ style: NonNullable<AppKitDatePickerProps['pickerStyle']>;
5
+ selectionMillis: number;
6
+ minimumMillis?: number;
7
+ maximumMillis?: number;
8
+ enabled: boolean;
9
+ accessibilityLabel?: string;
10
+ }
11
+ export interface DatePickerHandle {
12
+ update(options: DatePickerOptions): void;
13
+ detach(): void;
14
+ }
15
+ export type DatePickerAttach = (view: object, options: DatePickerOptions, onChange: (millis: number) => void) => DatePickerHandle | null;
16
+ export type DatePickerStatus = 'ready' | 'invalid' | 'unavailable';
17
+ /** Own one mounted attachment. Default selection seeds once; mode/view changes
18
+ * retain the accepted selection. This model does not prove native editing. */
19
+ export declare function createDatePickerOwner(deps: {
20
+ props(): AppKitDatePickerProps;
21
+ attach(): DatePickerAttach | undefined;
22
+ status?(status: DatePickerStatus): void;
23
+ now?(): number;
24
+ }): {
25
+ update: () => void;
26
+ bind(next: object | null): void;
27
+ dispose(): void;
28
+ getStatus: () => DatePickerStatus;
29
+ };
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export { SwiftUIDatePicker } from '../SwiftUIDatePicker.ios.js';
2
+ export type { SwiftUIDatePickerComponent, SwiftUIDatePickerProps, SwiftUIDatePickerStyle, } from './types.js';
@@ -0,0 +1,33 @@
1
+ /** SwiftUI date-picker style. */
2
+ export type SwiftUIDatePickerStyle = 'automatic' | 'compact' | 'graphical' | 'wheel';
3
+ /** SwiftUI picker component selector. */
4
+ export type SwiftUIDatePickerComponent = 'date' | 'hourAndMinute';
5
+ /** iOS date-picker props (SwiftUI DatePicker). */
6
+ export interface SwiftUIDatePickerProps {
7
+ /** Element id passed through to the host element. */
8
+ id?: string;
9
+ /** Class list applied to the picker element. */
10
+ className?: any;
11
+ /** Inline style (string CSS or object). */
12
+ style?: any;
13
+ /** Label shown next to the picker. When omitted, the label is hidden. */
14
+ title?: string;
15
+ /** Controlled selection. Pair with `onSelectionChange`. */
16
+ selection?: Date;
17
+ /** Initial selection when `selection` is not provided. */
18
+ defaultSelection?: Date;
19
+ /** Earliest selectable date. */
20
+ minimumDate?: Date;
21
+ /** Latest selectable date. */
22
+ maximumDate?: Date;
23
+ /** Which components the picker displays. @default ['date'] */
24
+ displayedComponents?: readonly SwiftUIDatePickerComponent[];
25
+ /** SwiftUI presentation style. `graphical` renders an inline calendar. @default 'automatic' */
26
+ pickerStyle?: SwiftUIDatePickerStyle;
27
+ /** Disables interaction with the picker. */
28
+ disabled?: boolean;
29
+ /** Spoken name for assistive tech. */
30
+ accessibilityLabel?: string;
31
+ /** Called when the user picks a new date; programmatic `selection` updates do not emit. */
32
+ onSelectionChange?: (date: Date) => void;
33
+ }
@@ -0,0 +1,2 @@
1
+ export { AppKitDatePicker } from '../AppKitDatePicker.macos.js';
2
+ export type { AppKitDatePickerComponents, AppKitDatePickerProps, AppKitDatePickerStyle, } from './types.js';
@@ -0,0 +1,31 @@
1
+ /** AppKit picker component slots. */
2
+ export type AppKitDatePickerComponents = 'date' | 'time' | 'dateAndTime';
3
+ /** macOS date-picker style. */
4
+ export type AppKitDatePickerStyle = 'textField' | 'graphical';
5
+ /** macOS date-picker props (NSDatePicker). */
6
+ export interface AppKitDatePickerProps {
7
+ /** Element id passed through to the host element. */
8
+ id?: string;
9
+ /** Class list applied to the picker element. */
10
+ className?: any;
11
+ /** Inline style (string CSS or object). */
12
+ style?: any;
13
+ /** Which element groups the NSDatePicker shows. @default 'date' */
14
+ components?: AppKitDatePickerComponents;
15
+ /** 'graphical' embeds the inline calendar (date mode only). @default 'textField' */
16
+ pickerStyle?: AppKitDatePickerStyle;
17
+ /** Controlled selection. Pair with `onSelectionChange`. */
18
+ selection?: Date;
19
+ /** Initial uncontrolled seed. Later defaults do not reset the mounted picker. */
20
+ defaultSelection?: Date;
21
+ /** Earliest selectable date. */
22
+ minimumDate?: Date;
23
+ /** Latest selectable date. */
24
+ maximumDate?: Date;
25
+ /** Disables interaction with the picker. */
26
+ disabled?: boolean;
27
+ /** Spoken name for assistive tech. */
28
+ accessibilityLabel?: string;
29
+ /** User selection changes; programmatic updates and retired controls do not emit. */
30
+ onSelectionChange?: (date: Date) => void;
31
+ }
@@ -0,0 +1,8 @@
1
+ /** Anything accepted as a style value, including nested arrays. */
2
+ export type StyleInput = string | Record<string, any> | null | undefined | readonly StyleInput[];
3
+ /** Merge component-emitted style defaults under the authored `style` prop.
4
+ * Authored keys win; array styles fold in order; a string style is appended
5
+ * after the serialized defaults so its declarations override them too. */
6
+ export declare function mergeStyle(base: Record<string, any>, style?: Record<string, any> | readonly (Record<string, any> | null | undefined)[] | null): Record<string, any>;
7
+ export declare function mergeStyle(base: Record<string, any>, style?: StyleInput): string | Record<string, any>;
8
+ export type StyleProp = string | Record<string, any> | readonly StyleProp[] | null | undefined;
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2026 Alec Larson
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
@@ -1,61 +0,0 @@
1
- export type MaterialDatePickerVariant = 'picker' | 'input'
2
-
3
- export type MaterialDatePickerComponents = 'date' | 'hourAndMinute' | 'dateAndTime'
4
-
5
- export interface MaterialDatePickerElementColors {
6
- containerColor?: string
7
- titleContentColor?: string
8
- headlineContentColor?: string
9
- weekdayContentColor?: string
10
- subheadContentColor?: string
11
- navigationContentColor?: string
12
- yearContentColor?: string
13
- disabledYearContentColor?: string
14
- currentYearContentColor?: string
15
- selectedYearContentColor?: string
16
- disabledSelectedYearContentColor?: string
17
- selectedYearContainerColor?: string
18
- disabledSelectedYearContainerColor?: string
19
- dayContentColor?: string
20
- disabledDayContentColor?: string
21
- selectedDayContentColor?: string
22
- disabledSelectedDayContentColor?: string
23
- selectedDayContainerColor?: string
24
- disabledSelectedDayContainerColor?: string
25
- todayContentColor?: string
26
- todayDateBorderColor?: string
27
- dayInSelectionRangeContentColor?: string
28
- dayInSelectionRangeContainerColor?: string
29
- dividerColor?: string
30
- clockDialColor?: string
31
- clockDialSelectedContentColor?: string
32
- clockDialUnselectedContentColor?: string
33
- selectorColor?: string
34
- periodSelectorBorderColor?: string
35
- periodSelectorSelectedContainerColor?: string
36
- periodSelectorUnselectedContainerColor?: string
37
- periodSelectorSelectedContentColor?: string
38
- periodSelectorUnselectedContentColor?: string
39
- timeSelectorSelectedContainerColor?: string
40
- timeSelectorUnselectedContainerColor?: string
41
- timeSelectorSelectedContentColor?: string
42
- timeSelectorUnselectedContentColor?: string
43
- }
44
-
45
- export interface MaterialDatePickerProps {
46
- id?: string
47
- className?: any
48
- style?: any
49
- initialDate?: Date
50
- variant?: MaterialDatePickerVariant
51
- displayedComponents?: MaterialDatePickerComponents
52
- showVariantToggle?: boolean
53
- is24Hour?: boolean
54
- color?: string
55
- elementColors?: MaterialDatePickerElementColors
56
- selectableDates?: { start?: Date; end?: Date }
57
- accessibilityLabel?: string
58
- onDateSelected?: (date: Date | null) => void
59
- }
60
-
61
- export declare function MaterialDatePicker(props: MaterialDatePickerProps): unknown
package/types/index.d.ts DELETED
@@ -1 +0,0 @@
1
- export {}
@@ -1,21 +0,0 @@
1
- export type SwiftUIDatePickerStyle = 'automatic' | 'compact' | 'graphical' | 'wheel'
2
-
3
- export type SwiftUIDatePickerComponent = 'date' | 'hourAndMinute'
4
-
5
- export interface SwiftUIDatePickerProps {
6
- id?: string
7
- className?: any
8
- style?: any
9
- title?: string
10
- selection?: Date
11
- defaultSelection?: Date
12
- minimumDate?: Date
13
- maximumDate?: Date
14
- displayedComponents?: readonly SwiftUIDatePickerComponent[]
15
- pickerStyle?: SwiftUIDatePickerStyle
16
- disabled?: boolean
17
- accessibilityLabel?: string
18
- onSelectionChange?: (date: Date) => void
19
- }
20
-
21
- export declare function SwiftUIDatePicker(props: SwiftUIDatePickerProps): unknown
@@ -1,20 +0,0 @@
1
- export type AppKitDatePickerComponents = 'date' | 'time' | 'dateAndTime'
2
-
3
- export type AppKitDatePickerStyle = 'textField' | 'graphical'
4
-
5
- export interface AppKitDatePickerProps {
6
- id?: string
7
- className?: any
8
- style?: any
9
- components?: AppKitDatePickerComponents
10
- pickerStyle?: AppKitDatePickerStyle
11
- selection?: Date
12
- defaultSelection?: Date
13
- minimumDate?: Date
14
- maximumDate?: Date
15
- disabled?: boolean
16
- accessibilityLabel?: string
17
- onSelectionChange?: (date: Date) => void
18
- }
19
-
20
- export declare function AppKitDatePicker(props: AppKitDatePickerProps): unknown