@octane-xplat/date-picker 0.18.0 → 0.19.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/README.md +55 -13
- package/package.json +87 -81
- package/src/AppKitDatePicker.macos.css +1 -0
- package/src/AppKitDatePicker.macos.tsrx +42 -43
- package/src/MaterialDatePicker.android.tsrx +24 -10
- package/src/SwiftUIDatePicker.ios.tsrx +29 -12
- package/src/android/types.ts +85 -0
- package/src/date-picker-owner.macos.ts +234 -0
- package/src/ios/types.ts +9 -0
- package/src/macos/types.ts +10 -1
- package/src/style-merge.ts +56 -0
- package/types/generated/.tsrx-typegen-manifest.json +17 -0
- package/types/generated/AppKitDatePicker.macos.d.ts +10 -0
- package/types/generated/MaterialDatePicker.android.d.ts +15 -0
- package/types/generated/SwiftUIDatePicker.ios.d.ts +15 -0
- package/types/generated/android/index.d.ts +2 -0
- package/types/generated/android/types.d.ts +126 -0
- package/types/generated/date-picker-owner.macos.d.ts +29 -0
- package/types/generated/index.d.ts +1 -0
- package/types/generated/ios/index.d.ts +2 -0
- package/types/generated/ios/types.d.ts +33 -0
- package/types/generated/macos/index.d.ts +2 -0
- package/types/generated/macos/types.d.ts +31 -0
- package/types/generated/style-merge.d.ts +8 -0
- package/LICENSE +0 -21
- package/types/android/index.d.ts +0 -61
- package/types/index.d.ts +0 -1
- package/types/ios/index.d.ts +0 -21
- package/types/macos/index.d.ts +0 -20
|
@@ -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,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,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.
|
package/types/android/index.d.ts
DELETED
|
@@ -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 {}
|
package/types/ios/index.d.ts
DELETED
|
@@ -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
|
package/types/macos/index.d.ts
DELETED
|
@@ -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
|