react-native-platform-components 0.0.2
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/LICENSE +20 -0
- package/PlatformComponents.podspec +20 -0
- package/README.md +233 -0
- package/android/build.gradle +78 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/platformcomponents/DateConstraints.kt +83 -0
- package/android/src/main/java/com/platformcomponents/Helper.kt +27 -0
- package/android/src/main/java/com/platformcomponents/PCDatePickerView.kt +684 -0
- package/android/src/main/java/com/platformcomponents/PCDatePickerViewManager.kt +149 -0
- package/android/src/main/java/com/platformcomponents/PCMaterialMode.kt +16 -0
- package/android/src/main/java/com/platformcomponents/PCSelectionMenuView.kt +410 -0
- package/android/src/main/java/com/platformcomponents/PCSelectionMenuViewManager.kt +114 -0
- package/android/src/main/java/com/platformcomponents/PlatformComponentsPackage.kt +22 -0
- package/ios/PCDatePicker.h +11 -0
- package/ios/PCDatePicker.mm +248 -0
- package/ios/PCDatePickerView.swift +405 -0
- package/ios/PCSelectionMenu.h +10 -0
- package/ios/PCSelectionMenu.mm +182 -0
- package/ios/PCSelectionMenu.swift +434 -0
- package/lib/module/DatePicker.js +74 -0
- package/lib/module/DatePicker.js.map +1 -0
- package/lib/module/DatePickerNativeComponent.ts +68 -0
- package/lib/module/SelectionMenu.js +79 -0
- package/lib/module/SelectionMenu.js.map +1 -0
- package/lib/module/SelectionMenu.web.js +57 -0
- package/lib/module/SelectionMenu.web.js.map +1 -0
- package/lib/module/SelectionMenuNativeComponent.ts +106 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/sharedTypes.js +4 -0
- package/lib/module/sharedTypes.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/DatePicker.d.ts +38 -0
- package/lib/typescript/src/DatePicker.d.ts.map +1 -0
- package/lib/typescript/src/DatePickerNativeComponent.d.ts +53 -0
- package/lib/typescript/src/DatePickerNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/SelectionMenu.d.ts +50 -0
- package/lib/typescript/src/SelectionMenu.d.ts.map +1 -0
- package/lib/typescript/src/SelectionMenu.web.d.ts +19 -0
- package/lib/typescript/src/SelectionMenu.web.d.ts.map +1 -0
- package/lib/typescript/src/SelectionMenuNativeComponent.d.ts +85 -0
- package/lib/typescript/src/SelectionMenuNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/sharedTypes.d.ts +10 -0
- package/lib/typescript/src/sharedTypes.d.ts.map +1 -0
- package/package.json +178 -0
- package/shared/PCDatePickerComponentDescriptors-custom.h +52 -0
- package/shared/PCDatePickerShadowNode-custom.cpp +1 -0
- package/shared/PCDatePickerShadowNode-custom.h +27 -0
- package/shared/PCDatePickerState-custom.h +13 -0
- package/shared/PCSelectionMenuComponentDescriptors-custom.h +25 -0
- package/shared/PCSelectionMenuShadowNode-custom.cpp +36 -0
- package/shared/PCSelectionMenuShadowNode-custom.h +46 -0
- package/src/DatePicker.tsx +146 -0
- package/src/DatePickerNativeComponent.ts +68 -0
- package/src/SelectionMenu.tsx +170 -0
- package/src/SelectionMenu.web.tsx +93 -0
- package/src/SelectionMenuNativeComponent.ts +106 -0
- package/src/index.tsx +3 -0
- package/src/sharedTypes.ts +14 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// DatePickerNativeComponent.ts
|
|
2
|
+
import type { CodegenTypes, ViewProps } from 'react-native';
|
|
3
|
+
import { codegenNativeComponent } from 'react-native';
|
|
4
|
+
|
|
5
|
+
export type TimestampMs = CodegenTypes.Double;
|
|
6
|
+
|
|
7
|
+
export type DateChangeEvent = {
|
|
8
|
+
timestampMs: CodegenTypes.Double;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export type DatePickerMode = 'date' | 'time' | 'dateAndTime' | 'countDownTimer';
|
|
12
|
+
export type DatePickerPresentation = 'modal' | 'embedded';
|
|
13
|
+
|
|
14
|
+
export type IOSDatePickerStyle = 'automatic' | 'compact' | 'inline' | 'wheels';
|
|
15
|
+
export type IOSRoundsToMinuteInterval = 'inherit' | 'round' | 'noRound';
|
|
16
|
+
|
|
17
|
+
export type IOSProps = {
|
|
18
|
+
preferredStyle?: string; // IOSDatePickerStyle
|
|
19
|
+
countDownDurationSeconds?: CodegenTypes.Double;
|
|
20
|
+
minuteInterval?: CodegenTypes.Int32;
|
|
21
|
+
roundsToMinuteInterval?: string; // IOSRoundsToMinuteInterval
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export type AndroidProps = {
|
|
25
|
+
firstDayOfWeek?: CodegenTypes.Int32;
|
|
26
|
+
material?: string; // AndroidMaterialMode
|
|
27
|
+
dialogTitle?: string;
|
|
28
|
+
positiveButtonTitle?: string;
|
|
29
|
+
negativeButtonTitle?: string;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export type WebProps = Readonly<{}>;
|
|
33
|
+
export type WindowsProps = Readonly<{}>;
|
|
34
|
+
export type MacOSProps = Readonly<{}>;
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Sentinel convention:
|
|
38
|
+
* - `-1` means "no value / unbounded / unset".
|
|
39
|
+
*/
|
|
40
|
+
export type CommonProps = {
|
|
41
|
+
mode?: string; // DatePickerMode
|
|
42
|
+
|
|
43
|
+
dateMs?: CodegenTypes.WithDefault<TimestampMs, -1>;
|
|
44
|
+
minDateMs?: CodegenTypes.WithDefault<TimestampMs, -1>;
|
|
45
|
+
maxDateMs?: CodegenTypes.WithDefault<TimestampMs, -1>;
|
|
46
|
+
|
|
47
|
+
locale?: string;
|
|
48
|
+
timeZoneName?: string;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Only used when presentation === "modal".
|
|
52
|
+
* Defaults should be applied in JS wrapper (recommended).
|
|
53
|
+
*/
|
|
54
|
+
visible?: string; // Visible
|
|
55
|
+
|
|
56
|
+
/** Defaults should be applied in JS wrapper (recommended). */
|
|
57
|
+
presentation?: string; // DatePickerPresentation
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export interface NativeProps extends ViewProps, CommonProps {
|
|
61
|
+
ios?: IOSProps;
|
|
62
|
+
android?: AndroidProps;
|
|
63
|
+
|
|
64
|
+
onConfirm?: CodegenTypes.BubblingEventHandler<DateChangeEvent>;
|
|
65
|
+
onClosed?: CodegenTypes.BubblingEventHandler<Readonly<{}>>;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export default codegenNativeComponent<NativeProps>('PCDatePicker');
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// SelectionMenu.tsx
|
|
4
|
+
import React, { useCallback, useMemo } from 'react';
|
|
5
|
+
import { Platform, StyleSheet } from 'react-native';
|
|
6
|
+
import NativeSelectionMenu from './SelectionMenuNativeComponent';
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
function normalizeSelectedData(selected) {
|
|
9
|
+
return selected ?? '';
|
|
10
|
+
}
|
|
11
|
+
function normalizeNativeVisible(inlineMode, visible) {
|
|
12
|
+
// Inline mode ignores visible; keep it undefined so native isn't spammed.
|
|
13
|
+
if (inlineMode) return undefined;
|
|
14
|
+
return visible ? 'open' : 'closed';
|
|
15
|
+
}
|
|
16
|
+
function normalizeNativePresentation(inlineMode, presentation) {
|
|
17
|
+
// Inline mode ignores presentation.
|
|
18
|
+
if (inlineMode) return undefined;
|
|
19
|
+
return presentation ?? 'auto';
|
|
20
|
+
}
|
|
21
|
+
export function SelectionMenu(props) {
|
|
22
|
+
const {
|
|
23
|
+
style,
|
|
24
|
+
options,
|
|
25
|
+
selected,
|
|
26
|
+
disabled,
|
|
27
|
+
placeholder,
|
|
28
|
+
inlineMode,
|
|
29
|
+
visible,
|
|
30
|
+
presentation,
|
|
31
|
+
onSelect,
|
|
32
|
+
onRequestClose,
|
|
33
|
+
ios,
|
|
34
|
+
android
|
|
35
|
+
} = props;
|
|
36
|
+
const selectedData = useMemo(() => normalizeSelectedData(selected), [selected]);
|
|
37
|
+
const nativeVisible = useMemo(() => normalizeNativeVisible(inlineMode, visible), [inlineMode, visible]);
|
|
38
|
+
const nativePresentation = useMemo(() => normalizeNativePresentation(inlineMode, presentation), [inlineMode, presentation]);
|
|
39
|
+
const handleSelect = useCallback(e => {
|
|
40
|
+
const {
|
|
41
|
+
index,
|
|
42
|
+
label,
|
|
43
|
+
data
|
|
44
|
+
} = e.nativeEvent;
|
|
45
|
+
onSelect?.(data, label, index);
|
|
46
|
+
}, [onSelect]);
|
|
47
|
+
const handleRequestClose = useCallback(() => {
|
|
48
|
+
onRequestClose?.();
|
|
49
|
+
}, [onRequestClose]);
|
|
50
|
+
|
|
51
|
+
// Keep android prop stable and codegen-friendly (string unions live in native spec).
|
|
52
|
+
const nativeAndroid = useMemo(() => {
|
|
53
|
+
if (!android) return undefined;
|
|
54
|
+
return {
|
|
55
|
+
material: android.material
|
|
56
|
+
};
|
|
57
|
+
}, [android]);
|
|
58
|
+
const isAndroidM3Inline = android?.material && inlineMode && android.material === 'm3' && Platform.OS === 'android';
|
|
59
|
+
return /*#__PURE__*/_jsx(NativeSelectionMenu, {
|
|
60
|
+
style: [style, isAndroidM3Inline && styles.androidInline],
|
|
61
|
+
options: options,
|
|
62
|
+
selectedData: selectedData,
|
|
63
|
+
interactivity: disabled ? 'disabled' : 'enabled',
|
|
64
|
+
placeholder: placeholder,
|
|
65
|
+
anchorMode: inlineMode ? 'inline' : 'headless',
|
|
66
|
+
visible: nativeVisible,
|
|
67
|
+
presentation: nativePresentation,
|
|
68
|
+
onSelect: onSelect ? handleSelect : undefined,
|
|
69
|
+
onRequestClose: onRequestClose ? handleRequestClose : undefined,
|
|
70
|
+
ios: ios,
|
|
71
|
+
android: nativeAndroid
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
const styles = StyleSheet.create({
|
|
75
|
+
androidInline: {
|
|
76
|
+
minHeight: 60
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
//# sourceMappingURL=SelectionMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useCallback","useMemo","Platform","StyleSheet","NativeSelectionMenu","jsx","_jsx","normalizeSelectedData","selected","normalizeNativeVisible","inlineMode","visible","undefined","normalizeNativePresentation","presentation","SelectionMenu","props","style","options","disabled","placeholder","onSelect","onRequestClose","ios","android","selectedData","nativeVisible","nativePresentation","handleSelect","e","index","label","data","nativeEvent","handleRequestClose","nativeAndroid","material","isAndroidM3Inline","OS","styles","androidInline","interactivity","anchorMode","create","minHeight"],"sourceRoot":"../../src","sources":["SelectionMenu.tsx"],"mappings":";;AAAA;AACA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,OAAO,QAAQ,OAAO;AACnD,SACEC,QAAQ,EACRC,UAAU,QAGL,cAAc;AAErB,OAAOC,mBAAmB,MAInB,gCAAgC;AAAC,SAAAC,GAAA,IAAAC,IAAA;AA2DxC,SAASC,qBAAqBA,CAACC,QAAuB,EAAU;EAC9D,OAAOA,QAAQ,IAAI,EAAE;AACvB;AAEA,SAASC,sBAAsBA,CAC7BC,UAA+B,EAC/BC,OAA4B,EACG;EAC/B;EACA,IAAID,UAAU,EAAE,OAAOE,SAAS;EAChC,OAAOD,OAAO,GAAG,MAAM,GAAG,QAAQ;AACpC;AAEA,SAASE,2BAA2BA,CAClCH,UAA+B,EAC/BI,YAAmD,EACZ;EACvC;EACA,IAAIJ,UAAU,EAAE,OAAOE,SAAS;EAChC,OAAOE,YAAY,IAAI,MAAM;AAC/B;AAEA,OAAO,SAASC,aAAaA,CAACC,KAAyB,EAAsB;EAC3E,MAAM;IACJC,KAAK;IACLC,OAAO;IACPV,QAAQ;IACRW,QAAQ;IACRC,WAAW;IACXV,UAAU;IACVC,OAAO;IACPG,YAAY;IACZO,QAAQ;IACRC,cAAc;IACdC,G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B,OAAO,EAAEA,OAAQ;IACjBO,YAAY,EAAEA,YAAa;IAC3BgB,aAAa,EAAEtB,QAAQ,GAAG,UAAU,GAAG,SAAU;IACjDC,WAAW,EAAEA,WAAY;IACzBsB,UAAU,EAAEhC,UAAU,GAAG,QAAQ,GAAG,UAAW;IAC/CC,OAAO,EAAEe,aAAc;IACvBZ,YAAY,EAAEa,kBAAmB;IACjCN,QAAQ,EAAEA,QAAQ,GAAGO,YAAY,GAAGhB,SAAU;IAC9CU,cAAc,EAAEA,cAAc,GAAGY,kBAAkB,GAAGtB,SAAU;IAChEW,GAAG,EAAEA,GAAI;IACTC,OAAO,EAAEW;EAAc,CACxB,CAAC;AAEN;AAEA,MAAMI,MAAM,GAAGpC,UAAU,CAACwC,MAAM,CAAC;EAC/BH,aAAa,EAAE;IAAEI,SAAS,EAAE;EAAG;AACjC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
// SelectionMenu.web.tsx
|
|
4
|
+
import React, { useMemo } from 'react';
|
|
5
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
|
+
function toCssStyle(style) {
|
|
7
|
+
if (!style) return undefined;
|
|
8
|
+
if (Array.isArray(style)) {
|
|
9
|
+
const merged = {};
|
|
10
|
+
for (const s of style) {
|
|
11
|
+
if (s && typeof s === 'object') Object.assign(merged, s);
|
|
12
|
+
}
|
|
13
|
+
return merged;
|
|
14
|
+
}
|
|
15
|
+
if (typeof style === 'object') return style;
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
export function SelectionMenu(props) {
|
|
19
|
+
const {
|
|
20
|
+
style,
|
|
21
|
+
options,
|
|
22
|
+
selected,
|
|
23
|
+
disabled,
|
|
24
|
+
placeholder,
|
|
25
|
+
onSelect,
|
|
26
|
+
onRequestClose
|
|
27
|
+
} = props;
|
|
28
|
+
const cssStyle = useMemo(() => toCssStyle(style), [style]);
|
|
29
|
+
const value = selected ?? '';
|
|
30
|
+
return /*#__PURE__*/_jsxs("select", {
|
|
31
|
+
style: cssStyle,
|
|
32
|
+
value: value,
|
|
33
|
+
disabled: !!disabled,
|
|
34
|
+
onChange: e => {
|
|
35
|
+
const data = e.currentTarget.value;
|
|
36
|
+
|
|
37
|
+
// placeholder chosen (or no selection)
|
|
38
|
+
if (data === '') return;
|
|
39
|
+
const index = options.findIndex(o => o.data === data);
|
|
40
|
+
const opt = index >= 0 ? options[index] : undefined;
|
|
41
|
+
onSelect?.(data, opt?.label ?? '', index);
|
|
42
|
+
},
|
|
43
|
+
onBlur: () => {
|
|
44
|
+
onRequestClose?.();
|
|
45
|
+
},
|
|
46
|
+
children: [placeholder ? /*#__PURE__*/_jsx("option", {
|
|
47
|
+
value: "",
|
|
48
|
+
disabled: true,
|
|
49
|
+
hidden: true,
|
|
50
|
+
children: placeholder
|
|
51
|
+
}) : null, options.map((opt, idx) => /*#__PURE__*/_jsx("option", {
|
|
52
|
+
value: opt.data,
|
|
53
|
+
children: opt.label
|
|
54
|
+
}, `${opt.data}-${idx}`))]
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=SelectionMenu.web.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["React","useMemo","jsx","_jsx","jsxs","_jsxs","toCssStyle","style","undefined","Array","isArray","merged","s","Object","assign","SelectionMenu","props","options","selected","disabled","placeholder","onSelect","onRequestClose","cssStyle","value","onChange","e","data","currentTarget","index","findIndex","o","opt","label","onBlur","children","hidden","map","idx"],"sourceRoot":"../../src","sources":["SelectionMenu.web.tsx"],"mappings":";;AAAA;AACA,OAAOA,KAAK,IAAIC,OAAO,QAAQ,OAAO;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AA6BvC,SAASC,UAAUA,CACjBC,KAA2B,EACM;EACjC,IAAI,CAACA,KAAK,EAAE,OAAOC,SAAS;EA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A,CAAA,KAAM;MACZZ,cAAc,GAAG,CAAC;IACpB,CAAE;IAAAa,QAAA,GAEDf,WAAW,gBACVjB,IAAA;MAAQqB,KAAK,EAAC,EAAE;MAACL,QAAQ;MAACiB,MAAM;MAAAD,QAAA,EAC7Bf;IAAW,CACN,CAAC,GACP,IAAI,EAEPH,OAAO,CAACoB,GAAG,CAAC,CAACL,GAAG,EAAEM,GAAG,kBACpBnC,IAAA;MAAmCqB,KAAK,EAAEQ,GAAG,CAACL,IAAK;MAAAQ,QAAA,EAChDH,GAAG,CAACC;IAAK,GADC,GAAGD,GAAG,CAACL,IAAI,IAAIW,GAAG,EAEvB,CACT,CAAC;EAAA,CACI,CAAC;AAEb","ignoreList":[]}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// SelectionMenuNativeComponent.ts
|
|
2
|
+
import type { CodegenTypes, ViewProps } from 'react-native';
|
|
3
|
+
import { codegenNativeComponent } from 'react-native';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* A single option in the menu.
|
|
7
|
+
*/
|
|
8
|
+
export type SelectionMenuOption = Readonly<{
|
|
9
|
+
label: string;
|
|
10
|
+
data: string;
|
|
11
|
+
}>;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Event emitted when the user selects an option.
|
|
15
|
+
*/
|
|
16
|
+
export type SelectionMenuSelectEvent = Readonly<{
|
|
17
|
+
/** Selected option index (implementation detail; stable for this render) */
|
|
18
|
+
index: CodegenTypes.Int32;
|
|
19
|
+
|
|
20
|
+
/** Selected option label */
|
|
21
|
+
label: string;
|
|
22
|
+
|
|
23
|
+
/** Selected option data payload (source of truth) */
|
|
24
|
+
data: string;
|
|
25
|
+
}>;
|
|
26
|
+
|
|
27
|
+
/** Visibility state (headless mode only). */
|
|
28
|
+
export type SelectionMenuVisible = 'open' | 'closed';
|
|
29
|
+
|
|
30
|
+
/** Presentation hint (headless mode only). */
|
|
31
|
+
export type SelectionMenuPresentation = 'auto' | 'popover' | 'sheet';
|
|
32
|
+
|
|
33
|
+
/** Interactivity state (no booleans). */
|
|
34
|
+
export type SelectionMenuInteractivity = 'enabled' | 'disabled';
|
|
35
|
+
|
|
36
|
+
/** Anchor behavior (no booleans). */
|
|
37
|
+
export type SelectionMenuAnchorMode = 'inline' | 'headless';
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* iOS-specific configuration (reserved).
|
|
41
|
+
*/
|
|
42
|
+
export type IOSProps = Readonly<{}>;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Android-specific configuration.
|
|
46
|
+
*/
|
|
47
|
+
export type AndroidProps = Readonly<{
|
|
48
|
+
material?: string; // AndroidMaterialMode
|
|
49
|
+
}>;
|
|
50
|
+
|
|
51
|
+
export interface SelectionMenuProps extends ViewProps {
|
|
52
|
+
/**
|
|
53
|
+
* Menu options.
|
|
54
|
+
*/
|
|
55
|
+
options: ReadonlyArray<SelectionMenuOption>;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Controlled selection by `data`.
|
|
59
|
+
*
|
|
60
|
+
* - Empty string means "no selection".
|
|
61
|
+
* - Native should treat this as the single source of truth.
|
|
62
|
+
*/
|
|
63
|
+
selectedData?: CodegenTypes.WithDefault<string, ''>;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Enabled / disabled state.
|
|
67
|
+
*/
|
|
68
|
+
interactivity?: string; // SelectionMenuInteractivity
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Placeholder text shown when selectedData === "".
|
|
72
|
+
*/
|
|
73
|
+
placeholder?: string;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Inline vs headless behavior.
|
|
77
|
+
*/
|
|
78
|
+
anchorMode?: string; // SelectionMenuAnchorMode
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Headless mode only:
|
|
82
|
+
* controls visibility.
|
|
83
|
+
*/
|
|
84
|
+
visible?: string; // SelectionMenuVisible
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Headless mode only:
|
|
88
|
+
* presentation hint.
|
|
89
|
+
*/
|
|
90
|
+
presentation?: string; // SelectionMenuPresentation
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* Fired when the user selects an option.
|
|
94
|
+
*/
|
|
95
|
+
onSelect?: CodegenTypes.BubblingEventHandler<SelectionMenuSelectEvent>;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Fired when dismissed without selection.
|
|
99
|
+
*/
|
|
100
|
+
onRequestClose?: CodegenTypes.BubblingEventHandler<Readonly<{}>>;
|
|
101
|
+
|
|
102
|
+
ios?: IOSProps;
|
|
103
|
+
android?: AndroidProps;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export default codegenNativeComponent<SelectionMenuProps>('PCSelectionMenu');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,cAAc,iBAAc;AAC5B,cAAc,iBAAiB;AAC/B,cAAc,kBAAe","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../src","sources":["sharedTypes.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"type":"module"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import { type IOSProps as NativeIOSProps, type AndroidProps as NativeAndroidProps, type DatePickerPresentation, type DatePickerMode, type IOSRoundsToMinuteInterval, type IOSDatePickerStyle } from './DatePickerNativeComponent';
|
|
4
|
+
import type { AndroidMaterialMode } from './sharedTypes';
|
|
5
|
+
export type DatePickerProps = {
|
|
6
|
+
style?: StyleProp<ViewStyle>;
|
|
7
|
+
/** Controlled value. Use `null` for "no date selected". */
|
|
8
|
+
date: Date | null;
|
|
9
|
+
/** Optional bounds. Use `null` for "unbounded". */
|
|
10
|
+
minDate?: Date | null;
|
|
11
|
+
maxDate?: Date | null;
|
|
12
|
+
locale?: string;
|
|
13
|
+
timeZoneName?: string;
|
|
14
|
+
mode?: DatePickerMode;
|
|
15
|
+
presentation?: DatePickerPresentation;
|
|
16
|
+
/**
|
|
17
|
+
* Modal only. If presentation !== "modal", ignored.
|
|
18
|
+
* Wrapper ergonomics: boolean.
|
|
19
|
+
*/
|
|
20
|
+
visible?: boolean;
|
|
21
|
+
onConfirm?: (dateTime: Date) => void;
|
|
22
|
+
onClosed?: () => void;
|
|
23
|
+
ios?: {
|
|
24
|
+
preferredStyle?: IOSDatePickerStyle;
|
|
25
|
+
countDownDurationSeconds?: NativeIOSProps['countDownDurationSeconds'];
|
|
26
|
+
minuteInterval?: NativeIOSProps['minuteInterval'];
|
|
27
|
+
roundsToMinuteInterval?: IOSRoundsToMinuteInterval;
|
|
28
|
+
};
|
|
29
|
+
android?: {
|
|
30
|
+
firstDayOfWeek?: NativeAndroidProps['firstDayOfWeek'];
|
|
31
|
+
material?: AndroidMaterialMode;
|
|
32
|
+
dialogTitle?: NativeAndroidProps['dialogTitle'];
|
|
33
|
+
positiveButtonTitle?: NativeAndroidProps['positiveButtonTitle'];
|
|
34
|
+
negativeButtonTitle?: NativeAndroidProps['negativeButtonTitle'];
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
export declare function DatePicker(props: DatePickerProps): React.ReactElement;
|
|
38
|
+
//# sourceMappingURL=DatePicker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../src/DatePicker.tsx"],"names":[],"mappings":"AACA,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,KAAK,EAAwB,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG/E,OAAyB,EAGvB,KAAK,QAAQ,IAAI,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AC,CAAC;QAChE,mBAAmB,CAAC,EAAE,kBAAkB,CAAC,qBAAqB,CAAC,CAAC;KACjE,CAAC;CACH,CAAC;AAeF,wBAAgB,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,KAAK,CAAC,YAAY,CAoErE"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { CodegenTypes, ViewProps } from 'react-native';
|
|
2
|
+
export type TimestampMs = CodegenTypes.Double;
|
|
3
|
+
export type DateChangeEvent = {
|
|
4
|
+
timestampMs: CodegenTypes.Double;
|
|
5
|
+
};
|
|
6
|
+
export type DatePickerMode = 'date' | 'time' | 'dateAndTime' | 'countDownTimer';
|
|
7
|
+
export type DatePickerPresentation = 'modal' | 'embedded';
|
|
8
|
+
export type IOSDatePickerStyle = 'automatic' | 'compact' | 'inline' | 'wheels';
|
|
9
|
+
export type IOSRoundsToMinuteInterval = 'inherit' | 'round' | 'noRound';
|
|
10
|
+
export type IOSProps = {
|
|
11
|
+
preferredStyle?: string;
|
|
12
|
+
countDownDurationSeconds?: CodegenTypes.Double;
|
|
13
|
+
minuteInterval?: CodegenTypes.Int32;
|
|
14
|
+
roundsToMinuteInterval?: string;
|
|
15
|
+
};
|
|
16
|
+
export type AndroidProps = {
|
|
17
|
+
firstDayOfWeek?: CodegenTypes.Int32;
|
|
18
|
+
material?: string;
|
|
19
|
+
dialogTitle?: string;
|
|
20
|
+
positiveButtonTitle?: string;
|
|
21
|
+
negativeButtonTitle?: string;
|
|
22
|
+
};
|
|
23
|
+
export type WebProps = Readonly<{}>;
|
|
24
|
+
export type WindowsProps = Readonly<{}>;
|
|
25
|
+
export type MacOSProps = Readonly<{}>;
|
|
26
|
+
/**
|
|
27
|
+
* Sentinel convention:
|
|
28
|
+
* - `-1` means "no value / unbounded / unset".
|
|
29
|
+
*/
|
|
30
|
+
export type CommonProps = {
|
|
31
|
+
mode?: string;
|
|
32
|
+
dateMs?: CodegenTypes.WithDefault<TimestampMs, -1>;
|
|
33
|
+
minDateMs?: CodegenTypes.WithDefault<TimestampMs, -1>;
|
|
34
|
+
maxDateMs?: CodegenTypes.WithDefault<TimestampMs, -1>;
|
|
35
|
+
locale?: string;
|
|
36
|
+
timeZoneName?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Only used when presentation === "modal".
|
|
39
|
+
* Defaults should be applied in JS wrapper (recommended).
|
|
40
|
+
*/
|
|
41
|
+
visible?: string;
|
|
42
|
+
/** Defaults should be applied in JS wrapper (recommended). */
|
|
43
|
+
presentation?: string;
|
|
44
|
+
};
|
|
45
|
+
export interface NativeProps extends ViewProps, CommonProps {
|
|
46
|
+
ios?: IOSProps;
|
|
47
|
+
android?: AndroidProps;
|
|
48
|
+
onConfirm?: CodegenTypes.BubblingEventHandler<DateChangeEvent>;
|
|
49
|
+
onClosed?: CodegenTypes.BubblingEventHandler<Readonly<{}>>;
|
|
50
|
+
}
|
|
51
|
+
declare const _default: import("react-native/types_generated/Libraries/Utilities/codegenNativeComponent").NativeComponentType<NativeProps>;
|
|
52
|
+
export default _default;
|
|
53
|
+
//# sourceMappingURL=DatePickerNativeComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DatePickerNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/DatePickerNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG5D,MAAM,MAAM,WAAW,GAAG,YAAY,CAAC,MAAM,CAAC;AAE9C,MAAM,MAAM,eAAe,GAAG;IAC5B,WAAW,EAAE,YAAY,CAAC,MAAM,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,GAAG,aAAa,GAAG,gBAAgB,CAAC;AAChF,MAAM,MAAM,sBAAsB,GAAG,OAAO,GAAG,UAAU,CAAC;AAE1D,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,SAAS,GAAG,QAAQ,GAAG,QAAQ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C;CACvB,CAAC;AAEF,MAAM,WAAW,WAAY,SAAQ,SAAS,EAAE,WAAW;IACzD,GAAG,CAAC,EAAE,QAAQ,CAAC;IACf,OAAO,CAAC,EAAE,YAAY,CAAC;IAEvB,SAAS,CAAC,EAAE,YAAY,CAAC,oBAAoB,CAAC,eAAe,CAAC,CAAC;IAC/D,QAAQ,CAAC,EAAE,YAAY,CAAC,oBAAoB,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;CAC5D;;AAED,wBAAmE"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type StyleProp, type ViewStyle } from 'react-native';
|
|
3
|
+
import { type SelectionMenuOption, type SelectionMenuPresentation } from './SelectionMenuNativeComponent';
|
|
4
|
+
import type { AndroidMaterialMode } from './sharedTypes';
|
|
5
|
+
export type SelectionMenuProps = {
|
|
6
|
+
style?: StyleProp<ViewStyle>;
|
|
7
|
+
/** Options are label + data (payload) */
|
|
8
|
+
options: readonly SelectionMenuOption[];
|
|
9
|
+
/**
|
|
10
|
+
* Controlled selection by the option's `data`.
|
|
11
|
+
* Use `null` for "no selection".
|
|
12
|
+
*/
|
|
13
|
+
selected: string | null;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
placeholder?: string;
|
|
16
|
+
/**
|
|
17
|
+
* If true, native renders its own inline anchor and manages open/close internally.
|
|
18
|
+
* If false (default), component is headless and controlled by `visible`.
|
|
19
|
+
*/
|
|
20
|
+
inlineMode?: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Headless mode only (inlineMode === false):
|
|
23
|
+
* controls whether the native menu UI is presented.
|
|
24
|
+
*/
|
|
25
|
+
visible?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Headless mode only (inlineMode === false):
|
|
28
|
+
* presentation hint ("auto" | "popover" | "sheet").
|
|
29
|
+
*/
|
|
30
|
+
presentation?: SelectionMenuPresentation;
|
|
31
|
+
/**
|
|
32
|
+
* Called when the user selects an option.
|
|
33
|
+
* Receives the selected `data` payload, plus label/index for convenience.
|
|
34
|
+
*/
|
|
35
|
+
onSelect?: (data: string, label: string, index: number) => void;
|
|
36
|
+
/**
|
|
37
|
+
* Called when the user dismisses without selecting.
|
|
38
|
+
*/
|
|
39
|
+
onRequestClose?: () => void;
|
|
40
|
+
/**
|
|
41
|
+
* Pass-through platform props.
|
|
42
|
+
*/
|
|
43
|
+
ios?: {};
|
|
44
|
+
android?: {
|
|
45
|
+
/** Material preference ("auto" | "m2" | "m3"). */
|
|
46
|
+
material?: AndroidMaterialMode;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
export declare function SelectionMenu(props: SelectionMenuProps): React.ReactElement;
|
|
50
|
+
//# sourceMappingURL=SelectionMenu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectionMenu.d.ts","sourceRoot":"","sources":["../../../src/SelectionMenu.tsx"],"names":[],"mappings":"AACA,OAAO,KAA+B,MAAM,OAAO,CAAC;AACpD,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAEtB,OAA4B,EAC1B,KAAK,mBAAmB,EAExB,KAAK,yBAAyB,EAC/B,MAAM,gCAAgC,CAAC;AAExC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEzD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAE7B,yCAAyC;IACzC,OAAO,EAAE,SAAS,mBAAmB,EAAE,CAAC;IAExC;;;OAGG;IACH,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAExB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,YAAY,CAAC,EAAE,yBAAyB,CAAC;IAEzC;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAEhE;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAE5B;;OAEG;IACH,GAAG,CAAC,EAAE,EAAE,CAAC;IAET,OAAO,CAAC,EAAE;QACR,kDAAkD;QAClD,QAAQ,CAAC,EAAE,mBAAmB,CAAC;KAChC,CAAC;CACH,CAAC;AAwBF,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,KAAK,CAAC,YAAY,CAuE3E"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { StyleProp, ViewStyle } from 'react-native';
|
|
3
|
+
import type { SelectionMenuOption, SelectionMenuPresentation } from './SelectionMenuNativeComponent';
|
|
4
|
+
export type SelectionMenuProps = {
|
|
5
|
+
style?: StyleProp<ViewStyle>;
|
|
6
|
+
options: readonly SelectionMenuOption[];
|
|
7
|
+
selected: string | null;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
placeholder?: string;
|
|
10
|
+
inlineMode?: boolean;
|
|
11
|
+
visible?: boolean;
|
|
12
|
+
presentation?: SelectionMenuPresentation;
|
|
13
|
+
onSelect?: (data: string, label: string, index: number) => void;
|
|
14
|
+
onRequestClose?: () => void;
|
|
15
|
+
ios?: {};
|
|
16
|
+
android?: {};
|
|
17
|
+
};
|
|
18
|
+
export declare function SelectionMenu(props: SelectionMenuProps): React.ReactElement;
|
|
19
|
+
//# sourceMappingURL=SelectionMenu.web.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectionMenu.web.d.ts","sourceRoot":"","sources":["../../../src/SelectionMenu.web.tsx"],"names":[],"mappings":"AACA,OAAO,KAAkB,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,OAAO,KAAK,EACV,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,gCAAgC,CAAC;AAExC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAE7B,OAAO,EAAE,SAAS,mBAAmB,EAAE,CAAC;IACxC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IAExB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IAGrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,yBAAyB,CAAC;IAEzC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAChE,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAE5B,GAAG,CAAC,EAAE,EAAE,CAAC;IACT,OAAO,CAAC,EAAE,EAAE,CAAC;CACd,CAAC;AAiBF,wBAAgB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,KAAK,CAAC,YAAY,CA+C3E"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { CodegenTypes, ViewProps } from 'react-native';
|
|
2
|
+
/**
|
|
3
|
+
* A single option in the menu.
|
|
4
|
+
*/
|
|
5
|
+
export type SelectionMenuOption = Readonly<{
|
|
6
|
+
label: string;
|
|
7
|
+
data: string;
|
|
8
|
+
}>;
|
|
9
|
+
/**
|
|
10
|
+
* Event emitted when the user selects an option.
|
|
11
|
+
*/
|
|
12
|
+
export type SelectionMenuSelectEvent = Readonly<{
|
|
13
|
+
/** Selected option index (implementation detail; stable for this render) */
|
|
14
|
+
index: CodegenTypes.Int32;
|
|
15
|
+
/** Selected option label */
|
|
16
|
+
label: string;
|
|
17
|
+
/** Selected option data payload (source of truth) */
|
|
18
|
+
data: string;
|
|
19
|
+
}>;
|
|
20
|
+
/** Visibility state (headless mode only). */
|
|
21
|
+
export type SelectionMenuVisible = 'open' | 'closed';
|
|
22
|
+
/** Presentation hint (headless mode only). */
|
|
23
|
+
export type SelectionMenuPresentation = 'auto' | 'popover' | 'sheet';
|
|
24
|
+
/** Interactivity state (no booleans). */
|
|
25
|
+
export type SelectionMenuInteractivity = 'enabled' | 'disabled';
|
|
26
|
+
/** Anchor behavior (no booleans). */
|
|
27
|
+
export type SelectionMenuAnchorMode = 'inline' | 'headless';
|
|
28
|
+
/**
|
|
29
|
+
* iOS-specific configuration (reserved).
|
|
30
|
+
*/
|
|
31
|
+
export type IOSProps = Readonly<{}>;
|
|
32
|
+
/**
|
|
33
|
+
* Android-specific configuration.
|
|
34
|
+
*/
|
|
35
|
+
export type AndroidProps = Readonly<{
|
|
36
|
+
material?: string;
|
|
37
|
+
}>;
|
|
38
|
+
export interface SelectionMenuProps extends ViewProps {
|
|
39
|
+
/**
|
|
40
|
+
* Menu options.
|
|
41
|
+
*/
|
|
42
|
+
options: ReadonlyArray<SelectionMenuOption>;
|
|
43
|
+
/**
|
|
44
|
+
* Controlled selection by `data`.
|
|
45
|
+
*
|
|
46
|
+
* - Empty string means "no selection".
|
|
47
|
+
* - Native should treat this as the single source of truth.
|
|
48
|
+
*/
|
|
49
|
+
selectedData?: CodegenTypes.WithDefault<string, ''>;
|
|
50
|
+
/**
|
|
51
|
+
* Enabled / disabled state.
|
|
52
|
+
*/
|
|
53
|
+
interactivity?: string;
|
|
54
|
+
/**
|
|
55
|
+
* Placeholder text shown when selectedData === "".
|
|
56
|
+
*/
|
|
57
|
+
placeholder?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Inline vs headless behavior.
|
|
60
|
+
*/
|
|
61
|
+
anchorMode?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Headless mode only:
|
|
64
|
+
* controls visibility.
|
|
65
|
+
*/
|
|
66
|
+
visible?: string;
|
|
67
|
+
/**
|
|
68
|
+
* Headless mode only:
|
|
69
|
+
* presentation hint.
|
|
70
|
+
*/
|
|
71
|
+
presentation?: string;
|
|
72
|
+
/**
|
|
73
|
+
* Fired when the user selects an option.
|
|
74
|
+
*/
|
|
75
|
+
onSelect?: CodegenTypes.BubblingEventHandler<SelectionMenuSelectEvent>;
|
|
76
|
+
/**
|
|
77
|
+
* Fired when dismissed without selection.
|
|
78
|
+
*/
|
|
79
|
+
onRequestClose?: CodegenTypes.BubblingEventHandler<Readonly<{}>>;
|
|
80
|
+
ios?: IOSProps;
|
|
81
|
+
android?: AndroidProps;
|
|
82
|
+
}
|
|
83
|
+
declare const _default: import("react-native/types_generated/Libraries/Utilities/codegenNativeComponent").NativeComponentType<SelectionMenuProps>;
|
|
84
|
+
export default _default;
|
|
85
|
+
//# sourceMappingURL=SelectionMenuNativeComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectionMenuNativeComponent.d.ts","sourceRoot":"","sources":["../../../src/SelectionMenuNativeComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAG5D;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC;IACzC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,QAAQ,CAAC;IAC9C,4EAA4E;IAC5E,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC;IAE1B,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IAEd,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;CACd,CAAC,CAAC;AAEH,6CAA6C;AAC7C,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,QAAQ,CAAC;AAErD,8CAA8C;AAC9C,MAAM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Ac,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CodegenTypes } from 'react-native';
|
|
2
|
+
/** Shared “open/closed” control state. */
|
|
3
|
+
export type Visible = 'open' | 'closed';
|
|
4
|
+
/** Shared Material preference (Android). */
|
|
5
|
+
export type AndroidMaterialMode = 'system' | 'm3';
|
|
6
|
+
/** Common event empty payload type. */
|
|
7
|
+
export type EmptyEvent = Readonly<{}>;
|
|
8
|
+
/** Convenience alias (optional). */
|
|
9
|
+
export type Bubbling<T> = CodegenTypes.BubblingEventHandler<T>;
|
|
10
|
+
//# sourceMappingURL=sharedTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sharedTypes.d.ts","sourceRoot":"","sources":["../../../src/sharedTypes.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAEjD,0CAA0C;AAC1C,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAExC,4CAA4C;AAC5C,MAAM,MAAM,mBAAmB,GAAG,QAAQ,GAAG,IAAI,CAAC;AAElD,uCAAuC;AACvC,MAAM,MAAM,UAAU,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;AAEtC,oCAAoC;AACpC,MAAM,MAAM,QAAQ,CAAC,CAAC,IAAI,YAAY,CAAC,oBAAoB,CAAC,CAAC,CAAC,CAAC"}
|