react-native-platform-components 0.6.0 → 0.7.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 (99) hide show
  1. package/README.md +211 -44
  2. package/android/src/main/java/com/platformcomponents/PCContextMenuView.kt +2 -2
  3. package/android/src/main/java/com/platformcomponents/PCSegmentedControlView.kt +241 -0
  4. package/android/src/main/java/com/platformcomponents/PCSegmentedControlViewManager.kt +105 -0
  5. package/android/src/main/java/com/platformcomponents/PCSelectionMenuView.kt +4 -0
  6. package/android/src/main/java/com/platformcomponents/PlatformComponentsPackage.kt +1 -0
  7. package/app.plugin.cjs +4 -0
  8. package/expo-module.config.json +4 -0
  9. package/ios/PCContextMenu.swift +65 -22
  10. package/ios/PCDatePickerView.swift +28 -11
  11. package/ios/PCSegmentedControl.h +10 -0
  12. package/ios/PCSegmentedControl.mm +194 -0
  13. package/ios/PCSegmentedControl.swift +200 -0
  14. package/lib/commonjs/ContextMenu.js +118 -0
  15. package/lib/commonjs/ContextMenu.js.map +1 -0
  16. package/lib/commonjs/ContextMenuNativeComponent.ts +141 -0
  17. package/lib/commonjs/DatePicker.js +86 -0
  18. package/lib/commonjs/DatePicker.js.map +1 -0
  19. package/lib/commonjs/DatePickerNativeComponent.ts +69 -0
  20. package/lib/commonjs/SegmentedControl.js +93 -0
  21. package/lib/commonjs/SegmentedControl.js.map +1 -0
  22. package/lib/commonjs/SegmentedControlNativeComponent.ts +79 -0
  23. package/lib/commonjs/SelectionMenu.js +73 -0
  24. package/lib/commonjs/SelectionMenu.js.map +1 -0
  25. package/lib/commonjs/SelectionMenuNativeComponent.ts +97 -0
  26. package/lib/commonjs/index.js +61 -0
  27. package/lib/commonjs/index.js.map +1 -0
  28. package/lib/commonjs/package.json +1 -0
  29. package/lib/commonjs/sharedTypes.js +6 -0
  30. package/lib/commonjs/sharedTypes.js.map +1 -0
  31. package/lib/module/SegmentedControl.js +87 -0
  32. package/lib/module/SegmentedControl.js.map +1 -0
  33. package/lib/module/SegmentedControlNativeComponent.ts +79 -0
  34. package/lib/module/index.js +1 -0
  35. package/lib/module/index.js.map +1 -1
  36. package/lib/typescript/commonjs/package.json +1 -0
  37. package/lib/typescript/commonjs/src/ContextMenu.d.ts.map +1 -0
  38. package/lib/typescript/commonjs/src/ContextMenuNativeComponent.d.ts.map +1 -0
  39. package/lib/typescript/commonjs/src/DatePicker.d.ts.map +1 -0
  40. package/lib/typescript/commonjs/src/DatePickerNativeComponent.d.ts.map +1 -0
  41. package/lib/typescript/commonjs/src/SegmentedControl.d.ts +62 -0
  42. package/lib/typescript/commonjs/src/SegmentedControl.d.ts.map +1 -0
  43. package/lib/typescript/commonjs/src/SegmentedControlNativeComponent.d.ts +63 -0
  44. package/lib/typescript/commonjs/src/SegmentedControlNativeComponent.d.ts.map +1 -0
  45. package/lib/typescript/commonjs/src/SelectionMenu.d.ts.map +1 -0
  46. package/lib/typescript/commonjs/src/SelectionMenuNativeComponent.d.ts.map +1 -0
  47. package/lib/typescript/{src → commonjs/src}/index.d.ts +1 -0
  48. package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
  49. package/lib/typescript/commonjs/src/sharedTypes.d.ts.map +1 -0
  50. package/lib/typescript/module/src/ContextMenu.d.ts +79 -0
  51. package/lib/typescript/module/src/ContextMenu.d.ts.map +1 -0
  52. package/lib/typescript/module/src/ContextMenuNativeComponent.d.ts +122 -0
  53. package/lib/typescript/module/src/ContextMenuNativeComponent.d.ts.map +1 -0
  54. package/lib/typescript/module/src/DatePicker.d.ts +40 -0
  55. package/lib/typescript/module/src/DatePicker.d.ts.map +1 -0
  56. package/lib/typescript/module/src/DatePickerNativeComponent.d.ts +54 -0
  57. package/lib/typescript/module/src/DatePickerNativeComponent.d.ts.map +1 -0
  58. package/lib/typescript/module/src/SegmentedControl.d.ts +62 -0
  59. package/lib/typescript/module/src/SegmentedControl.d.ts.map +1 -0
  60. package/lib/typescript/module/src/SegmentedControlNativeComponent.d.ts +63 -0
  61. package/lib/typescript/module/src/SegmentedControlNativeComponent.d.ts.map +1 -0
  62. package/lib/typescript/module/src/SelectionMenu.d.ts +47 -0
  63. package/lib/typescript/module/src/SelectionMenu.d.ts.map +1 -0
  64. package/lib/typescript/module/src/SelectionMenuNativeComponent.d.ts +78 -0
  65. package/lib/typescript/module/src/SelectionMenuNativeComponent.d.ts.map +1 -0
  66. package/lib/typescript/module/src/index.d.ts +6 -0
  67. package/lib/typescript/module/src/index.d.ts.map +1 -0
  68. package/lib/typescript/module/src/sharedTypes.d.ts +12 -0
  69. package/lib/typescript/module/src/sharedTypes.d.ts.map +1 -0
  70. package/package.json +32 -12
  71. package/plugin/build/index.cjs +26 -0
  72. package/plugin/build/index.d.ts +22 -0
  73. package/plugin/build/index.d.ts.map +1 -0
  74. package/plugin/tsconfig.json +16 -0
  75. package/react-native.config.js +1 -0
  76. package/shared/PCSegmentedControlComponentDescriptors-custom.h +22 -0
  77. package/shared/PCSegmentedControlShadowNode-custom.cpp +54 -0
  78. package/shared/PCSegmentedControlShadowNode-custom.h +56 -0
  79. package/shared/PCSegmentedControlState-custom.h +62 -0
  80. package/shared/react/renderer/components/PlatformComponentsViewSpec/ComponentDescriptors.h +1 -0
  81. package/src/SegmentedControl.tsx +178 -0
  82. package/src/SegmentedControlNativeComponent.ts +79 -0
  83. package/src/index.tsx +1 -0
  84. package/lib/typescript/src/ContextMenu.d.ts.map +0 -1
  85. package/lib/typescript/src/ContextMenuNativeComponent.d.ts.map +0 -1
  86. package/lib/typescript/src/DatePicker.d.ts.map +0 -1
  87. package/lib/typescript/src/DatePickerNativeComponent.d.ts.map +0 -1
  88. package/lib/typescript/src/SelectionMenu.d.ts.map +0 -1
  89. package/lib/typescript/src/SelectionMenuNativeComponent.d.ts.map +0 -1
  90. package/lib/typescript/src/index.d.ts.map +0 -1
  91. package/lib/typescript/src/sharedTypes.d.ts.map +0 -1
  92. /package/lib/typescript/{src → commonjs/src}/ContextMenu.d.ts +0 -0
  93. /package/lib/typescript/{src → commonjs/src}/ContextMenuNativeComponent.d.ts +0 -0
  94. /package/lib/typescript/{src → commonjs/src}/DatePicker.d.ts +0 -0
  95. /package/lib/typescript/{src → commonjs/src}/DatePickerNativeComponent.d.ts +0 -0
  96. /package/lib/typescript/{src → commonjs/src}/SelectionMenu.d.ts +0 -0
  97. /package/lib/typescript/{src → commonjs/src}/SelectionMenuNativeComponent.d.ts +0 -0
  98. /package/lib/typescript/{src → commonjs/src}/sharedTypes.d.ts +0 -0
  99. /package/lib/typescript/{package.json → module/package.json} +0 -0
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.ContextMenu = ContextMenu;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _ContextMenuNativeComponent = _interopRequireDefault(require("./ContextMenuNativeComponent"));
9
+ var _jsxRuntime = require("react/jsx-runtime");
10
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
12
+ // ContextMenu.tsx
13
+
14
+ /**
15
+ * Attributes for a context menu action.
16
+ */
17
+
18
+ /**
19
+ * A single action in the context menu.
20
+ */
21
+
22
+ /**
23
+ * Convert user-friendly subaction to native format (no further nesting).
24
+ */
25
+ function normalizeSubaction(action) {
26
+ return {
27
+ id: action.id,
28
+ title: action.title,
29
+ subtitle: action.subtitle,
30
+ image: action.image,
31
+ imageColor: action.imageColor,
32
+ attributes: action.attributes ? {
33
+ destructive: action.attributes.destructive ? 'true' : 'false',
34
+ disabled: action.attributes.disabled ? 'true' : 'false',
35
+ hidden: action.attributes.hidden ? 'true' : 'false'
36
+ } : undefined,
37
+ state: action.state
38
+ };
39
+ }
40
+
41
+ /**
42
+ * Convert user-friendly action to native format.
43
+ * Note: Only one level of nesting is supported by the native component.
44
+ */
45
+ function normalizeAction(action) {
46
+ return {
47
+ id: action.id,
48
+ title: action.title,
49
+ subtitle: action.subtitle,
50
+ image: action.image,
51
+ imageColor: action.imageColor,
52
+ attributes: action.attributes ? {
53
+ destructive: action.attributes.destructive ? 'true' : 'false',
54
+ disabled: action.attributes.disabled ? 'true' : 'false',
55
+ hidden: action.attributes.hidden ? 'true' : 'false'
56
+ } : undefined,
57
+ state: action.state,
58
+ subactions: action.subactions?.map(normalizeSubaction)
59
+ };
60
+ }
61
+ function ContextMenu(props) {
62
+ const {
63
+ style,
64
+ title,
65
+ actions,
66
+ disabled,
67
+ trigger = 'longPress',
68
+ onPressAction,
69
+ onMenuOpen,
70
+ onMenuClose,
71
+ children,
72
+ ios,
73
+ android,
74
+ ...viewProps
75
+ } = props;
76
+ const nativeActions = (0, _react.useMemo)(() => actions.map(normalizeAction), [actions]);
77
+ const handlePressAction = (0, _react.useCallback)(e => {
78
+ const {
79
+ actionId,
80
+ actionTitle
81
+ } = e.nativeEvent;
82
+ onPressAction?.(actionId, actionTitle);
83
+ }, [onPressAction]);
84
+ const handleMenuOpen = (0, _react.useCallback)(() => {
85
+ onMenuOpen?.();
86
+ }, [onMenuOpen]);
87
+ const handleMenuClose = (0, _react.useCallback)(() => {
88
+ onMenuClose?.();
89
+ }, [onMenuClose]);
90
+ const nativeIOS = (0, _react.useMemo)(() => {
91
+ if (!ios) return undefined;
92
+ return {
93
+ enablePreview: ios.enablePreview ? 'true' : 'false'
94
+ };
95
+ }, [ios]);
96
+ const nativeAndroid = (0, _react.useMemo)(() => {
97
+ if (!android) return undefined;
98
+ return {
99
+ anchorPosition: android.anchorPosition,
100
+ visible: android.visible ? 'open' : 'closed'
101
+ };
102
+ }, [android]);
103
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ContextMenuNativeComponent.default, {
104
+ style: style,
105
+ title: title,
106
+ actions: nativeActions,
107
+ interactivity: disabled ? 'disabled' : 'enabled',
108
+ trigger: trigger,
109
+ onPressAction: onPressAction ? handlePressAction : undefined,
110
+ onMenuOpen: onMenuOpen ? handleMenuOpen : undefined,
111
+ onMenuClose: onMenuClose ? handleMenuClose : undefined,
112
+ ios: nativeIOS,
113
+ android: nativeAndroid,
114
+ ...viewProps,
115
+ children: children
116
+ });
117
+ }
118
+ //# sourceMappingURL=ContextMenu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_ContextMenuNativeComponent","_interopRequireDefault","_jsxRuntime","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","normalizeSubaction","action","id","title","subtitle","image","imageColor","attributes","destructive","disabled","hidden","undefined","state","normalizeAction","subactions","map","ContextMenu","props","style","actions","trigger","onPressAction","onMenuOpen","onMenuClose","children","ios","android","viewProps","nativeActions","useMemo","handlePressAction","useCallback","actionId","actionTitle","nativeEvent","handleMenuOpen","handleMenuClose","nativeIOS","enablePreview","nativeAndroid","anchorPosition","visible","jsx","interactivity"],"sourceRoot":"../../src","sources":["ContextMenu.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,2BAAA,GAAAC,sBAAA,CAAAF,OAAA;AAIsC,IAAAG,WAAA,GAAAH,OAAA;AAAA,SAAAE,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAL,wBAAAK,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,I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EAAEA,OAAQ;IACjBC,aAAa,EAAEA,aAAa,GAAGS,iBAAiB,GAAGnB,SAAU;IAC7DW,UAAU,EAAEA,UAAU,GAAGa,cAAc,GAAGxB,SAAU;IACpDY,WAAW,EAAEA,WAAW,GAAGa,eAAe,GAAGzB,SAAU;IACvDc,GAAG,EAAEY,SAAU;IACfX,OAAO,EAAEa,aAAc;IAAA,GACnBZ,SAAS;IAAAH,QAAA,EAEZA;EAAQ,CACQ,CAAC;AAExB","ignoreList":[]}
@@ -0,0 +1,141 @@
1
+ // ContextMenuNativeComponent.ts
2
+ import type { CodegenTypes, HostComponent, ViewProps } from 'react-native';
3
+ import { codegenNativeComponent } from 'react-native';
4
+
5
+ /**
6
+ * Attributes for a context menu action.
7
+ */
8
+ export type ContextMenuActionAttributes = Readonly<{
9
+ /** Whether the action is destructive (red styling) */
10
+ destructive?: string; // 'true' | 'false'
11
+ /** Whether the action is disabled (grayed out) */
12
+ disabled?: string; // 'true' | 'false'
13
+ /** Whether the action is hidden */
14
+ hidden?: string; // 'true' | 'false'
15
+ }>;
16
+
17
+ /**
18
+ * A leaf subaction (no further nesting to avoid codegen recursion issues).
19
+ */
20
+ export type ContextMenuSubaction = Readonly<{
21
+ /** Unique identifier returned in callbacks */
22
+ id: string;
23
+ /** Display title */
24
+ title: string;
25
+ /** Secondary text (iOS only) */
26
+ subtitle?: string;
27
+ /** Icon name (SF Symbol on iOS, drawable resource on Android) */
28
+ image?: string;
29
+ /** Tint color for the icon (hex string, e.g., "#FF0000") */
30
+ imageColor?: string;
31
+ /** Action attributes */
32
+ attributes?: ContextMenuActionAttributes;
33
+ /** Checkmark state: 'off' | 'on' | 'mixed' */
34
+ state?: string;
35
+ }>;
36
+
37
+ /**
38
+ * A single action in the context menu.
39
+ * Actions can be nested one level via `subactions` for submenus.
40
+ */
41
+ export type ContextMenuAction = Readonly<{
42
+ /** Unique identifier returned in callbacks */
43
+ id: string;
44
+ /** Display title */
45
+ title: string;
46
+ /** Secondary text (iOS only) */
47
+ subtitle?: string;
48
+ /** Icon name (SF Symbol on iOS, drawable resource on Android) */
49
+ image?: string;
50
+ /** Tint color for the icon (hex string, e.g., "#FF0000") */
51
+ imageColor?: string;
52
+ /** Action attributes */
53
+ attributes?: ContextMenuActionAttributes;
54
+ /** Checkmark state: 'off' | 'on' | 'mixed' */
55
+ state?: string;
56
+ /** Nested actions for submenu (one level deep) */
57
+ subactions?: ReadonlyArray<ContextMenuSubaction>;
58
+ }>;
59
+
60
+ /**
61
+ * Event emitted when an action is pressed.
62
+ */
63
+ export type ContextMenuPressActionEvent = Readonly<{
64
+ /** The action's unique identifier */
65
+ actionId: string;
66
+ /** The action's title */
67
+ actionTitle: string;
68
+ }>;
69
+
70
+ /** Interactivity state (no booleans for codegen). */
71
+ export type ContextMenuInteractivity = 'enabled' | 'disabled';
72
+
73
+ /** Trigger mode for opening the menu. */
74
+ export type ContextMenuTrigger = 'longPress' | 'tap';
75
+
76
+ /**
77
+ * iOS-specific configuration.
78
+ */
79
+ export type IOSProps = Readonly<{
80
+ /** Enable preview when long-pressing */
81
+ enablePreview?: string; // 'true' | 'false'
82
+ }>;
83
+
84
+ /**
85
+ * Android-specific configuration.
86
+ */
87
+ export type AndroidProps = Readonly<{
88
+ /** Anchor position for the popup menu */
89
+ anchorPosition?: string; // 'left' | 'right'
90
+ /**
91
+ * Programmatic visibility control (Android only).
92
+ * 'open' to show the menu, 'closed' to hide it.
93
+ */
94
+ visible?: string; // 'open' | 'closed'
95
+ }>;
96
+
97
+ export interface ContextMenuProps extends ViewProps {
98
+ /**
99
+ * Menu title (shown as header on iOS).
100
+ */
101
+ title?: string;
102
+
103
+ /**
104
+ * Menu actions.
105
+ */
106
+ actions: ReadonlyArray<ContextMenuAction>;
107
+
108
+ /**
109
+ * Enabled / disabled state.
110
+ */
111
+ interactivity?: string; // ContextMenuInteractivity
112
+
113
+ /**
114
+ * How the menu is triggered:
115
+ * - 'longPress' (default): Long-press opens the menu
116
+ * - 'tap': Single tap opens the menu
117
+ */
118
+ trigger?: string; // ContextMenuTrigger
119
+
120
+ /**
121
+ * Fired when user presses an action.
122
+ */
123
+ onPressAction?: CodegenTypes.BubblingEventHandler<ContextMenuPressActionEvent>;
124
+
125
+ /**
126
+ * Fired when menu opens.
127
+ */
128
+ onMenuOpen?: CodegenTypes.BubblingEventHandler<Readonly<{}>>;
129
+
130
+ /**
131
+ * Fired when menu closes.
132
+ */
133
+ onMenuClose?: CodegenTypes.BubblingEventHandler<Readonly<{}>>;
134
+
135
+ ios?: IOSProps;
136
+ android?: AndroidProps;
137
+ }
138
+
139
+ export default codegenNativeComponent<ContextMenuProps>(
140
+ 'PCContextMenu'
141
+ ) as HostComponent<ContextMenuProps>;
@@ -0,0 +1,86 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.DatePicker = DatePicker;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _DatePickerNativeComponent = _interopRequireDefault(require("./DatePickerNativeComponent"));
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
13
+ // DatePicker.tsx
14
+
15
+ // Sentinel value for "no date". Using MIN_SAFE_INTEGER ensures we don't
16
+ // conflict with valid negative timestamps (dates before 1970).
17
+ const NO_DATE_SENTINEL = Number.MIN_SAFE_INTEGER;
18
+ function dateToMsOrSentinel(d) {
19
+ if (!d) return NO_DATE_SENTINEL;
20
+ const ms = d.getTime();
21
+ return Number.isFinite(ms) ? ms : NO_DATE_SENTINEL;
22
+ }
23
+ function normalizeVisible(presentation, visible) {
24
+ // Only meaningful in modal presentation. Keep undefined for inline to avoid noise.
25
+ if (presentation !== 'modal') return undefined;
26
+ return visible ? 'open' : 'closed';
27
+ }
28
+ function DatePicker(props) {
29
+ const {
30
+ style,
31
+ date,
32
+ minDate,
33
+ maxDate,
34
+ locale,
35
+ timeZoneName,
36
+ mode,
37
+ presentation = 'modal',
38
+ visible,
39
+ onConfirm,
40
+ onClosed,
41
+ ios,
42
+ android,
43
+ testID
44
+ } = props;
45
+ const isModal = presentation === 'modal';
46
+ const handleConfirm = (0, _react.useCallback)(e => {
47
+ onConfirm?.(new Date(e.nativeEvent.timestampMs));
48
+ }, [onConfirm]);
49
+ const handleClosed = (0, _react.useCallback)(() => {
50
+ onClosed?.();
51
+ }, [onClosed]);
52
+ const nativeProps = {
53
+ style: [styles.picker, style],
54
+ mode,
55
+ locale,
56
+ timeZoneName,
57
+ presentation,
58
+ visible: normalizeVisible(presentation, visible),
59
+ dateMs: dateToMsOrSentinel(date),
60
+ minDateMs: dateToMsOrSentinel(minDate),
61
+ maxDateMs: dateToMsOrSentinel(maxDate),
62
+ onConfirm: onConfirm ? handleConfirm : undefined,
63
+ onClosed: isModal && onClosed ? handleClosed : undefined,
64
+ ios: ios ? {
65
+ preferredStyle: ios.preferredStyle,
66
+ countDownDurationSeconds: ios.countDownDurationSeconds,
67
+ minuteInterval: ios.minuteInterval,
68
+ roundsToMinuteInterval: ios.roundsToMinuteInterval
69
+ } : undefined,
70
+ android: android ? {
71
+ firstDayOfWeek: android.firstDayOfWeek,
72
+ material: android.material,
73
+ dialogTitle: android.dialogTitle,
74
+ positiveButtonTitle: android.positiveButtonTitle,
75
+ negativeButtonTitle: android.negativeButtonTitle
76
+ } : undefined
77
+ };
78
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_DatePickerNativeComponent.default, {
79
+ testID: testID,
80
+ ...nativeProps
81
+ });
82
+ }
83
+ const styles = _reactNative.StyleSheet.create({
84
+ picker: {}
85
+ });
86
+ //# sourceMappingURL=DatePicker.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_DatePickerNativeComponent","_interopRequireDefault","_jsxRuntime","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","NO_DATE_SENTINEL","Number","MIN_SAFE_INTEGER","dateToMsOrSentinel","d","ms","getTime","isFinite","normalizeVisible","presentation","visible","undefined","DatePicker","props","style","date","minDate","maxDate","locale","timeZoneName","mode","onConfirm","onClosed","ios","android","testID","isModal","handleConfirm","useCallback","Date","nativeEvent","timestampMs","handleClosed","nativeProps","styles","picker","dateMs","minDateMs","maxDateMs","preferredStyle","countDownDurationSeconds","minuteInterval","roundsToMinuteInterval","firstDayOfWeek","material","dialogTitle","positiveButtonTitle","negativeButtonTitle","jsx","StyleSheet","create"],"sourceRoot":"../../src","sources":["DatePicker.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,YAAA,GAAAD,OAAA;AAEA,IAAAE,0BAAA,GAAAC,sBAAA,CAAAH,OAAA;AASqC,IAAAI,WAAA,GAAAJ,OAAA;AAAA,SAAAG,uBAAAE,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAN,wBAAAM,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAV,uBAAA,YAAAA,CAAAM,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAAA,SAAAD,CAAA,MAAAO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AACmB;IAC9B,CAAC,GACD/B,SAAS;IAEba,OAAO,EAAEA,OAAO,GACZ;MACEmB,cAAc,EAAEnB,OAAO,CAACmB,cAAc;MACtCC,QAAQ,EAAEpB,OAAO,CAACoB,QAAQ;MAC1BC,WAAW,EAAErB,OAAO,CAACqB,WAAW;MAChCC,mBAAmB,EAAEtB,OAAO,CAACsB,mBAAmB;MAChDC,mBAAmB,EAAEvB,OAAO,CAACuB;IAC/B,CAAC,GACDpC;EACN,CAAC;EAED,oBAAO,IAAA/B,WAAA,CAAAoE,GAAA,EAACtE,0BAAA,CAAAK,OAAgB;IAAC0C,MAAM,EAAEA,MAAO;IAAA,GAAKQ;EAAW,CAAG,CAAC;AAC9D;AAEA,MAAMC,MAAM,GAAGe,uBAAU,CAACC,MAAM,CAAC;EAC/Bf,MAAM,EAAE,CAAC;AACX,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,69 @@
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
+ * - `Number.MIN_SAFE_INTEGER` means "no value / unbounded / unset".
39
+ * (Allows negative timestamps for pre-1970 dates.)
40
+ */
41
+ export type CommonProps = {
42
+ mode?: string; // DatePickerMode
43
+
44
+ dateMs?: CodegenTypes.WithDefault<TimestampMs, -9007199254740991>;
45
+ minDateMs?: CodegenTypes.WithDefault<TimestampMs, -9007199254740991>;
46
+ maxDateMs?: CodegenTypes.WithDefault<TimestampMs, -9007199254740991>;
47
+
48
+ locale?: string;
49
+ timeZoneName?: string;
50
+
51
+ /**
52
+ * Only used when presentation === "modal".
53
+ * Defaults should be applied in JS wrapper (recommended).
54
+ */
55
+ visible?: string; // Visible
56
+
57
+ /** Defaults should be applied in JS wrapper (recommended). */
58
+ presentation?: string; // DatePickerPresentation
59
+ };
60
+
61
+ export interface NativeProps extends ViewProps, CommonProps {
62
+ ios?: IOSProps;
63
+ android?: AndroidProps;
64
+
65
+ onConfirm?: CodegenTypes.BubblingEventHandler<DateChangeEvent>;
66
+ onClosed?: CodegenTypes.BubblingEventHandler<Readonly<{}>>;
67
+ }
68
+
69
+ export default codegenNativeComponent<NativeProps>('PCDatePicker');
@@ -0,0 +1,93 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.SegmentedControl = SegmentedControl;
7
+ var _react = _interopRequireWildcard(require("react"));
8
+ var _reactNative = require("react-native");
9
+ var _SegmentedControlNativeComponent = _interopRequireDefault(require("./SegmentedControlNativeComponent"));
10
+ var _jsxRuntime = require("react/jsx-runtime");
11
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
13
+ // SegmentedControl.tsx
14
+
15
+ // Android: Minimum height to ensure visibility.
16
+ // Fabric's shadow node measurement isn't being called on initial render,
17
+ // so we apply a minHeight that matches Material design touch target guidelines.
18
+ const ANDROID_MIN_HEIGHT = 48;
19
+ function normalizeSelectedValue(selected) {
20
+ return selected ?? '';
21
+ }
22
+ function SegmentedControl(props) {
23
+ const {
24
+ style,
25
+ segments,
26
+ selectedValue,
27
+ disabled,
28
+ onSelect,
29
+ ios,
30
+ android,
31
+ ...viewProps
32
+ } = props;
33
+
34
+ // Normalize segments for native
35
+ const nativeSegments = (0, _react.useMemo)(() => {
36
+ return segments.map(seg => ({
37
+ label: seg.label,
38
+ value: seg.value,
39
+ disabled: seg.disabled ? 'disabled' : 'enabled',
40
+ icon: seg.icon ?? ''
41
+ }));
42
+ }, [segments]);
43
+ const selectedData = (0, _react.useMemo)(() => normalizeSelectedValue(selectedValue), [selectedValue]);
44
+ const handleSelect = (0, _react.useCallback)(e => {
45
+ const {
46
+ index,
47
+ value
48
+ } = e.nativeEvent;
49
+ onSelect?.(value, index);
50
+ }, [onSelect]);
51
+
52
+ // Normalize iOS props to native string format
53
+ const nativeIos = (0, _react.useMemo)(() => {
54
+ if (!ios) return undefined;
55
+ return {
56
+ momentary: ios.momentary ? 'true' : 'false',
57
+ apportionsSegmentWidthsByContent: ios.apportionsSegmentWidthsByContent ? 'true' : 'false',
58
+ selectedSegmentTintColor: ios.selectedSegmentTintColor ?? ''
59
+ };
60
+ }, [ios]);
61
+
62
+ // Normalize Android props
63
+ const nativeAndroid = (0, _react.useMemo)(() => {
64
+ if (!android) return undefined;
65
+ return {
66
+ selectionRequired: android.selectionRequired ? 'true' : 'false'
67
+ };
68
+ }, [android]);
69
+
70
+ // Merge user style with Android minHeight default
71
+ const mergedStyle = (0, _react.useMemo)(() => {
72
+ if (_reactNative.Platform.OS === 'android') {
73
+ return [styles.androidDefault, style];
74
+ }
75
+ return style;
76
+ }, [style]);
77
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_SegmentedControlNativeComponent.default, {
78
+ style: mergedStyle,
79
+ segments: nativeSegments,
80
+ selectedValue: selectedData,
81
+ interactivity: disabled ? 'disabled' : 'enabled',
82
+ onSelect: onSelect ? handleSelect : undefined,
83
+ ios: nativeIos,
84
+ android: nativeAndroid,
85
+ ...viewProps
86
+ });
87
+ }
88
+ const styles = _reactNative.StyleSheet.create({
89
+ androidDefault: {
90
+ minHeight: ANDROID_MIN_HEIGHT
91
+ }
92
+ });
93
+ //# sourceMappingURL=SegmentedControl.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_SegmentedControlNativeComponent","_interopRequireDefault","_jsxRuntime","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ANDROID_MIN_HEIGHT","normalizeSelectedValue","selected","SegmentedControl","props","style","segments","selectedValue","disabled","onSelect","ios","android","viewProps","nativeSegments","useMemo","map","seg","label","value","icon","selectedData","handleSelect","useCallback","index","nativeEvent","nativeIos","undefined","momentary","apportionsSegmentWidthsByContent","selectedSegmentTintColor","nativeAndroid","selectionRequired","mergedStyle","Platform","OS","styles","androidDefault","jsx","interactivity","StyleSheet","create","minHeight"],"sourceRoot":"../../src","sources":["SegmentedControl.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAQA,IAAAE,gCAAA,GAAAC,sBA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AAG,CAAC,CAAC;;EAET;EACA,MAAMoB,aAAa,GAAG,IAAAhB,cAAO,EAAC,MAAM;IAClC,IAAI,CAACH,OAAO,EAAE,OAAOe,SAAS;IAC9B,OAAO;MACLK,iBAAiB,EAAEpB,OAAO,CAACoB,iBAAiB,GAAG,MAAM,GAAG;IAC1D,CAAC;EACH,CAAC,EAAE,CAACpB,OAAO,CAAC,CAAC;;EAEb;EACA,MAAMqB,WAAW,GAAG,IAAAlB,cAAO,EAAC,MAA4B;IACtD,IAAImB,qBAAQ,CAACC,EAAE,KAAK,SAAS,EAAE;MAC7B,OAAO,CAACC,MAAM,CAACC,cAAc,EAAE/B,KAAK,CAAC;IACvC;IACA,OAAOA,KAAK;EACd,CAAC,EAAE,CAACA,KAAK,CAAC,CAAC;EAEX,oBACE,IAAAzB,WAAA,CAAAyD,GAAA,EAAC3D,gCAAA,CAAAK,OAAsB;IACrBsB,KAAK,EAAE2B,WAAY;IACnB1B,QAAQ,EAAEO,cAAe;IACzBN,aAAa,EAAEa,YAAa;IAC5BkB,aAAa,EAAE9B,QAAQ,GAAG,UAAU,GAAG,SAAU;IACjDC,QAAQ,EAAEA,QAAQ,GAAGY,YAAY,GAAGK,SAAU;IAC9ChB,GAAG,EAAEe,SAAU;IACfd,OAAO,EAAEmB,aAAc;IAAA,GACnBlB;EAAS,CACd,CAAC;AAEN;AAEA,MAAMuB,MAAM,GAAGI,uBAAU,CAACC,MAAM,CAAC;EAC/BJ,cAAc,EAAE;IACdK,SAAS,EAAEzC;EACb;AACF,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,79 @@
1
+ // SegmentedControlNativeComponent.ts
2
+ import type { CodegenTypes, ViewProps } from 'react-native';
3
+ import { codegenNativeComponent } from 'react-native';
4
+
5
+ /**
6
+ * A single segment in the control.
7
+ */
8
+ export type SegmentedControlSegment = Readonly<{
9
+ label: string;
10
+ value: string;
11
+ disabled: string; // 'enabled' | 'disabled'
12
+ icon: string; // SF Symbol (iOS) or drawable name (Android), empty = none
13
+ }>;
14
+
15
+ /**
16
+ * Event emitted when the user selects a segment.
17
+ */
18
+ export type SegmentedControlSelectEvent = Readonly<{
19
+ /** Selected segment index */
20
+ index: CodegenTypes.Int32;
21
+
22
+ /** Selected segment value */
23
+ value: string;
24
+ }>;
25
+
26
+ /** Interactivity state (no booleans). */
27
+ export type SegmentedControlInteractivity = 'enabled' | 'disabled';
28
+
29
+ /**
30
+ * iOS-specific configuration.
31
+ */
32
+ export type IOSProps = Readonly<{
33
+ /** Momentary mode: segment springs back after touch */
34
+ momentary?: string; // 'true' | 'false'
35
+
36
+ /** Whether segment widths are proportional to content */
37
+ apportionsSegmentWidthsByContent?: string; // 'true' | 'false'
38
+
39
+ /** Selected segment tint color (hex string) */
40
+ selectedSegmentTintColor?: string;
41
+ }>;
42
+
43
+ /**
44
+ * Android-specific configuration.
45
+ */
46
+ export type AndroidProps = Readonly<{
47
+ /** Whether one segment must always be selected */
48
+ selectionRequired?: string; // 'true' | 'false'
49
+ }>;
50
+
51
+ export interface SegmentedControlProps extends ViewProps {
52
+ /**
53
+ * Segments to display.
54
+ */
55
+ segments: ReadonlyArray<SegmentedControlSegment>;
56
+
57
+ /**
58
+ * Controlled selection by `value`.
59
+ * Empty string means "no selection".
60
+ */
61
+ selectedValue?: CodegenTypes.WithDefault<string, ''>;
62
+
63
+ /**
64
+ * Enabled / disabled state.
65
+ */
66
+ interactivity?: string; // SegmentedControlInteractivity
67
+
68
+ /**
69
+ * Fired when the user selects a segment.
70
+ */
71
+ onSelect?: CodegenTypes.BubblingEventHandler<SegmentedControlSelectEvent>;
72
+
73
+ ios?: IOSProps;
74
+ android?: AndroidProps;
75
+ }
76
+
77
+ export default codegenNativeComponent<SegmentedControlProps>(
78
+ 'PCSegmentedControl'
79
+ );