react-native-platform-components 0.0.3 → 0.3.1

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 (30) hide show
  1. package/PlatformComponents.podspec +1 -1
  2. package/README.md +2 -0
  3. package/android/src/main/java/com/platformcomponents/PCDatePickerView.kt +5 -7
  4. package/android/src/main/java/com/platformcomponents/PCSelectionMenuView.kt +273 -146
  5. package/android/src/main/java/com/platformcomponents/PCSelectionMenuViewManager.kt +5 -4
  6. package/ios/PCDatePickerView.swift +2 -11
  7. package/ios/PCSelectionMenu.mm +0 -10
  8. package/ios/PCSelectionMenu.swift +145 -179
  9. package/lib/module/DatePicker.js +3 -1
  10. package/lib/module/DatePicker.js.map +1 -1
  11. package/lib/module/SelectionMenu.js +4 -10
  12. package/lib/module/SelectionMenu.js.map +1 -1
  13. package/lib/module/SelectionMenuNativeComponent.ts +0 -9
  14. package/lib/module/index.js +1 -1
  15. package/lib/module/index.js.map +1 -1
  16. package/lib/typescript/src/DatePicker.d.ts +2 -0
  17. package/lib/typescript/src/DatePicker.d.ts.map +1 -1
  18. package/lib/typescript/src/SelectionMenu.d.ts +6 -10
  19. package/lib/typescript/src/SelectionMenu.d.ts.map +1 -1
  20. package/lib/typescript/src/SelectionMenuNativeComponent.d.ts +0 -7
  21. package/lib/typescript/src/SelectionMenuNativeComponent.d.ts.map +1 -1
  22. package/package.json +16 -9
  23. package/src/DatePicker.tsx +5 -1
  24. package/src/SelectionMenu.tsx +8 -33
  25. package/src/SelectionMenuNativeComponent.ts +0 -9
  26. package/lib/module/SelectionMenu.web.js +0 -57
  27. package/lib/module/SelectionMenu.web.js.map +0 -1
  28. package/lib/typescript/src/SelectionMenu.web.d.ts +0 -19
  29. package/lib/typescript/src/SelectionMenu.web.d.ts.map +0 -1
  30. package/src/SelectionMenu.web.tsx +0 -93
@@ -19,8 +19,6 @@ export type SelectionMenuSelectEvent = Readonly<{
19
19
  }>;
20
20
  /** Visibility state (headless mode only). */
21
21
  export type SelectionMenuVisible = 'open' | 'closed';
22
- /** Presentation hint (headless mode only). */
23
- export type SelectionMenuPresentation = 'auto' | 'popover' | 'sheet';
24
22
  /** Interactivity state (no booleans). */
25
23
  export type SelectionMenuInteractivity = 'enabled' | 'disabled';
26
24
  /** Anchor behavior (no booleans). */
@@ -64,11 +62,6 @@ export interface SelectionMenuProps extends ViewProps {
64
62
  * controls visibility.
65
63
  */
66
64
  visible?: string;
67
- /**
68
- * Headless mode only:
69
- * presentation hint.
70
- */
71
- presentation?: string;
72
65
  /**
73
66
  * Fired when the user selects an option.
74
67
  */
@@ -1 +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,MAAM,yBAAyB,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAErE,yCAAyC;AACzC,MAAM,MAAM,0BAA0B,GAAG,SAAS,GAAG,UAAU,CAAC;AAEhE,qCAAqC;AACrC,MAAM,MAAM,uBAAuB,GAAG,QAAQ,GAAG,UAAU,CAAC;AAE5D;;GAEG;AACH,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,YAAY,CAAC;CACxB;;AAED,wBAA6E"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-platform-components",
3
- "version": "0.0.3",
3
+ "version": "0.3.1",
4
4
  "description": "A cross-platform toolkit of native UI components for React Native.",
5
5
  "main": "./lib/module/index.js",
6
6
  "types": "./lib/typescript/src/index.d.ts",
@@ -38,8 +38,11 @@
38
38
  "prepare": "bob build",
39
39
  "typecheck": "tsc",
40
40
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
41
- "release": "release-it --only-version",
42
- "test": "jest"
41
+ "build": "tsc --noEmit",
42
+ "release": "release-it",
43
+ "test": "jest",
44
+ "upgrade:check": "yarn dlx npm-check-updates",
45
+ "upgrade:apply": "yarn dlx npm-check-updates -u && rm -rf node_modules && rm -rf package-lock.json && yarn install"
43
46
  },
44
47
  "keywords": [
45
48
  "react-native",
@@ -48,14 +51,14 @@
48
51
  ],
49
52
  "repository": {
50
53
  "type": "git",
51
- "url": "git+https://github.com/BearPeak-Technology-Group/react-native-platform-components.git"
54
+ "url": "git+https://github.com/JarX-Concepts/react-native-platform-components.git"
52
55
  },
53
56
  "author": "Andrew Tosh <andrew.tosh@jarxconcepts.com> (https://github.com/ajtosh77)",
54
57
  "license": "MIT",
55
58
  "bugs": {
56
- "url": "https://github.com/BearPeak-Technology-Group/react-native-platform-components/issues"
59
+ "url": "https://github.com/JarX-Concepts/react-native-platform-components/issues"
57
60
  },
58
- "homepage": "https://github.com/BearPeak-Technology-Group/react-native-platform-components#readme",
61
+ "homepage": "https://github.com/JarX-Concepts/react-native-platform-components#readme",
59
62
  "publishConfig": {
60
63
  "registry": "https://registry.npmjs.org/"
61
64
  },
@@ -70,6 +73,7 @@
70
73
  "@release-it/conventional-changelog": "^10.0.1",
71
74
  "@types/jest": "^29.5.14",
72
75
  "@types/react": "^19.1.0",
76
+ "@types/react-test-renderer": "^19.1.0",
73
77
  "commitlint": "^19.8.1",
74
78
  "del-cli": "^6.0.0",
75
79
  "eslint": "^9.35.0",
@@ -81,7 +85,8 @@
81
85
  "react": "19.1.0",
82
86
  "react-native": "0.81.1",
83
87
  "react-native-builder-bob": "^0.40.16",
84
- "release-it": "^19.1.0",
88
+ "react-test-renderer": "19.1.0",
89
+ "release-it": "^19.2.4",
85
90
  "turbo": "^2.5.6",
86
91
  "typescript": "^5.9.2"
87
92
  },
@@ -143,8 +148,7 @@
143
148
  "tagName": "v${version}"
144
149
  },
145
150
  "npm": {
146
- "publish": true,
147
- "skipChecks": true
151
+ "publish": false
148
152
  },
149
153
  "github": {
150
154
  "release": true
@@ -162,6 +166,9 @@
162
166
  "modulePathIgnorePatterns": [
163
167
  "<rootDir>/example/node_modules",
164
168
  "<rootDir>/lib/"
169
+ ],
170
+ "testPathIgnorePatterns": [
171
+ "<rootDir>/example/e2e/"
165
172
  ]
166
173
  },
167
174
  "create-react-native-library": {
@@ -40,6 +40,9 @@ export type DatePickerProps = {
40
40
  onConfirm?: (dateTime: Date) => void;
41
41
  onClosed?: () => void;
42
42
 
43
+ /** Test identifier */
44
+ testID?: string;
45
+
43
46
  ios?: {
44
47
  preferredStyle?: IOSDatePickerStyle;
45
48
  countDownDurationSeconds?: NativeIOSProps['countDownDurationSeconds'];
@@ -84,6 +87,7 @@ export function DatePicker(props: DatePickerProps): React.ReactElement {
84
87
  onClosed,
85
88
  ios,
86
89
  android,
90
+ testID,
87
91
  } = props;
88
92
 
89
93
  const handleConfirm = useCallback(
@@ -136,7 +140,7 @@ export function DatePicker(props: DatePickerProps): React.ReactElement {
136
140
  : undefined,
137
141
  };
138
142
 
139
- return <NativeDatePicker {...nativeProps} />;
143
+ return <NativeDatePicker testID={testID} {...nativeProps} />;
140
144
  }
141
145
 
142
146
  function createStyles() {
@@ -1,23 +1,15 @@
1
1
  // SelectionMenu.tsx
2
2
  import React, { useCallback, useMemo } from 'react';
3
- import {
4
- Platform,
5
- StyleSheet,
6
- type StyleProp,
7
- type ViewStyle,
8
- } from 'react-native';
3
+ import { Platform, StyleSheet, type ViewProps } from 'react-native';
9
4
 
10
5
  import NativeSelectionMenu, {
11
6
  type SelectionMenuOption,
12
7
  type SelectionMenuSelectEvent,
13
- type SelectionMenuPresentation,
14
8
  } from './SelectionMenuNativeComponent';
15
9
 
16
10
  import type { AndroidMaterialMode } from './sharedTypes';
17
11
 
18
- export type SelectionMenuProps = {
19
- style?: StyleProp<ViewStyle>;
20
-
12
+ export interface SelectionMenuProps extends ViewProps {
21
13
  /** Options are label + data (payload) */
22
14
  options: readonly SelectionMenuOption[];
23
15
 
@@ -42,12 +34,6 @@ export type SelectionMenuProps = {
42
34
  */
43
35
  visible?: boolean;
44
36
 
45
- /**
46
- * Headless mode only (inlineMode === false):
47
- * presentation hint ("auto" | "popover" | "sheet").
48
- */
49
- presentation?: SelectionMenuPresentation;
50
-
51
37
  /**
52
38
  * Called when the user selects an option.
53
39
  * Receives the selected `data` payload, plus label/index for convenience.
@@ -68,7 +54,10 @@ export type SelectionMenuProps = {
68
54
  /** Material preference ("auto" | "m2" | "m3"). */
69
55
  material?: AndroidMaterialMode;
70
56
  };
71
- };
57
+
58
+ /** Test identifier */
59
+ testID?: string;
60
+ }
72
61
 
73
62
  function normalizeSelectedData(selected: string | null): string {
74
63
  return selected ?? '';
@@ -83,15 +72,6 @@ function normalizeNativeVisible(
83
72
  return visible ? 'open' : 'closed';
84
73
  }
85
74
 
86
- function normalizeNativePresentation(
87
- inlineMode: boolean | undefined,
88
- presentation: SelectionMenuPresentation | undefined
89
- ): SelectionMenuPresentation | undefined {
90
- // Inline mode ignores presentation.
91
- if (inlineMode) return undefined;
92
- return presentation ?? 'auto';
93
- }
94
-
95
75
  export function SelectionMenu(props: SelectionMenuProps): React.ReactElement {
96
76
  const {
97
77
  style,
@@ -101,11 +81,11 @@ export function SelectionMenu(props: SelectionMenuProps): React.ReactElement {
101
81
  placeholder,
102
82
  inlineMode,
103
83
  visible,
104
- presentation,
105
84
  onSelect,
106
85
  onRequestClose,
107
86
  ios,
108
87
  android,
88
+ ...viewProps
109
89
  } = props;
110
90
 
111
91
  const selectedData = useMemo(
@@ -118,11 +98,6 @@ export function SelectionMenu(props: SelectionMenuProps): React.ReactElement {
118
98
  [inlineMode, visible]
119
99
  );
120
100
 
121
- const nativePresentation = useMemo(
122
- () => normalizeNativePresentation(inlineMode, presentation),
123
- [inlineMode, presentation]
124
- );
125
-
126
101
  const handleSelect = useCallback(
127
102
  (e: { nativeEvent: SelectionMenuSelectEvent }) => {
128
103
  const { index, label, data } = e.nativeEvent;
@@ -156,11 +131,11 @@ export function SelectionMenu(props: SelectionMenuProps): React.ReactElement {
156
131
  placeholder={placeholder}
157
132
  anchorMode={inlineMode ? 'inline' : 'headless'}
158
133
  visible={nativeVisible}
159
- presentation={nativePresentation}
160
134
  onSelect={onSelect ? handleSelect : undefined}
161
135
  onRequestClose={onRequestClose ? handleRequestClose : undefined}
162
136
  ios={ios}
163
137
  android={nativeAndroid}
138
+ {...viewProps}
164
139
  />
165
140
  );
166
141
  }
@@ -27,9 +27,6 @@ export type SelectionMenuSelectEvent = Readonly<{
27
27
  /** Visibility state (headless mode only). */
28
28
  export type SelectionMenuVisible = 'open' | 'closed';
29
29
 
30
- /** Presentation hint (headless mode only). */
31
- export type SelectionMenuPresentation = 'auto' | 'popover' | 'sheet';
32
-
33
30
  /** Interactivity state (no booleans). */
34
31
  export type SelectionMenuInteractivity = 'enabled' | 'disabled';
35
32
 
@@ -83,12 +80,6 @@ export interface SelectionMenuProps extends ViewProps {
83
80
  */
84
81
  visible?: string; // SelectionMenuVisible
85
82
 
86
- /**
87
- * Headless mode only:
88
- * presentation hint.
89
- */
90
- presentation?: string; // SelectionMenuPresentation
91
-
92
83
  /**
93
84
  * Fired when the user selects an option.
94
85
  */
@@ -1,57 +0,0 @@
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
@@ -1 +0,0 @@
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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CAAE;IACFK,MAAM,EAAEA,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":[]}
@@ -1,19 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,93 +0,0 @@
1
- // SelectionMenu.web.tsx
2
- import React, { useMemo } from 'react';
3
- import type { StyleProp, ViewStyle } from 'react-native';
4
-
5
- import type {
6
- SelectionMenuOption,
7
- SelectionMenuPresentation,
8
- } from './SelectionMenuNativeComponent';
9
-
10
- export type SelectionMenuProps = {
11
- style?: StyleProp<ViewStyle>;
12
-
13
- options: readonly SelectionMenuOption[];
14
- selected: string | null;
15
-
16
- disabled?: boolean;
17
- placeholder?: string;
18
-
19
- // kept for parity; ignored by <select>
20
- inlineMode?: boolean;
21
- visible?: boolean;
22
- presentation?: SelectionMenuPresentation;
23
-
24
- onSelect?: (data: string, label: string, index: number) => void;
25
- onRequestClose?: () => void;
26
-
27
- ios?: {};
28
- android?: {};
29
- };
30
-
31
- function toCssStyle(
32
- style: StyleProp<ViewStyle>
33
- ): React.CSSProperties | undefined {
34
- if (!style) return undefined;
35
- if (Array.isArray(style)) {
36
- const merged: any = {};
37
- for (const s of style) {
38
- if (s && typeof s === 'object') Object.assign(merged, s as any);
39
- }
40
- return merged as React.CSSProperties;
41
- }
42
- if (typeof style === 'object') return style as any;
43
- return undefined;
44
- }
45
-
46
- export function SelectionMenu(props: SelectionMenuProps): React.ReactElement {
47
- const {
48
- style,
49
- options,
50
- selected,
51
- disabled,
52
- placeholder,
53
- onSelect,
54
- onRequestClose,
55
- } = props;
56
-
57
- const cssStyle = useMemo(() => toCssStyle(style), [style]);
58
- const value = selected ?? '';
59
-
60
- return (
61
- <select
62
- style={cssStyle}
63
- value={value}
64
- disabled={!!disabled}
65
- onChange={(e: React.ChangeEvent<HTMLSelectElement>) => {
66
- const data = (e.currentTarget as any).value as string;
67
-
68
- // placeholder chosen (or no selection)
69
- if (data === '') return;
70
-
71
- const index = options.findIndex((o) => o.data === data);
72
- const opt = index >= 0 ? options[index] : undefined;
73
-
74
- onSelect?.(data, opt?.label ?? '', index);
75
- }}
76
- onBlur={() => {
77
- onRequestClose?.();
78
- }}
79
- >
80
- {placeholder ? (
81
- <option value="" disabled hidden>
82
- {placeholder}
83
- </option>
84
- ) : null}
85
-
86
- {options.map((opt, idx) => (
87
- <option key={`${opt.data}-${idx}`} value={opt.data}>
88
- {opt.label}
89
- </option>
90
- ))}
91
- </select>
92
- );
93
- }