react-native-platform-components 1.2.0 → 1.4.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 +33 -31
- package/android/src/main/java/com/platformcomponents/PCButtonGroupView.kt +498 -0
- package/android/src/main/java/com/platformcomponents/PCButtonGroupViewManager.kt +191 -0
- package/android/src/main/java/com/platformcomponents/PCButtonSupport.kt +127 -0
- package/android/src/main/java/com/platformcomponents/PCButtonView.kt +345 -0
- package/android/src/main/java/com/platformcomponents/PCButtonViewManager.kt +126 -0
- package/android/src/main/java/com/platformcomponents/PCExpressive.kt +107 -0
- package/android/src/main/java/com/platformcomponents/PCFloatingToolbarView.kt +115 -0
- package/android/src/main/java/com/platformcomponents/PCFloatingToolbarViewManager.kt +65 -0
- package/android/src/main/java/com/platformcomponents/PCNativeThemeModule.kt +3 -0
- package/android/src/main/java/com/platformcomponents/PCSegmentedControlView.kt +13 -5
- package/android/src/main/java/com/platformcomponents/PCSegmentedControlViewManager.kt +6 -1
- package/android/src/main/java/com/platformcomponents/PCTextFieldView.kt +1018 -0
- package/android/src/main/java/com/platformcomponents/PCTextFieldViewManager.kt +248 -0
- package/android/src/main/java/com/platformcomponents/PlatformComponentsPackage.kt +13 -6
- package/android/src/main/jni/CMakeLists.txt +13 -1
- package/android/src/main/res/values/attrs.xml +13 -0
- package/android/src/main/res/values/styles.xml +183 -0
- package/ios/PCButton.h +10 -0
- package/ios/PCButton.mm +196 -0
- package/ios/PCButtonGroup.h +10 -0
- package/ios/PCButtonGroup.mm +256 -0
- package/ios/PCButtonGroupView.swift +254 -0
- package/ios/PCButtonSupport.swift +141 -0
- package/ios/PCButtonView.swift +155 -0
- package/ios/PCFloatingToolbar.h +10 -0
- package/ios/PCFloatingToolbar.mm +76 -0
- package/ios/PCFloatingToolbarView.swift +95 -0
- package/ios/PCNativeThemeModule.mm +13 -0
- package/ios/PCSelectionMenu.swift +9 -1
- package/ios/PCTextField.h +10 -0
- package/ios/PCTextField.mm +391 -0
- package/ios/PCTextFieldView.swift +1012 -0
- package/lib/commonjs/Button.js +77 -0
- package/lib/commonjs/Button.js.map +1 -0
- package/lib/commonjs/ButtonGroup.js +99 -0
- package/lib/commonjs/ButtonGroup.js.map +1 -0
- package/lib/commonjs/ButtonGroupNativeComponent.ts +121 -0
- package/lib/commonjs/ButtonNativeComponent.ts +76 -0
- package/lib/commonjs/ContextMenuNativeComponent.ts +5 -4
- package/lib/commonjs/DatePickerNativeComponent.ts +17 -11
- package/lib/commonjs/FloatingToolbar.js +69 -0
- package/lib/commonjs/FloatingToolbar.js.map +1 -0
- package/lib/commonjs/FloatingToolbarNativeComponent.ts +31 -0
- package/lib/commonjs/LiquidGlass.js +24 -4
- package/lib/commonjs/LiquidGlass.js.map +1 -1
- package/lib/commonjs/LiquidGlassNativeComponent.ts +6 -5
- package/lib/commonjs/NativePlatformComponentsTheme.js.map +1 -1
- package/lib/commonjs/SegmentedControl.js +11 -85
- package/lib/commonjs/SegmentedControl.js.map +1 -1
- package/lib/commonjs/SegmentedControlNativeComponent.ts +15 -11
- package/lib/commonjs/SelectionMenuNativeComponent.ts +6 -5
- package/lib/commonjs/TextField.js +195 -0
- package/lib/commonjs/TextField.js.map +1 -0
- package/lib/commonjs/TextFieldNativeComponent.ts +218 -0
- package/lib/commonjs/codegenTypes.js +6 -0
- package/lib/commonjs/codegenTypes.js.map +1 -0
- package/lib/commonjs/focusRegistry.js +78 -0
- package/lib/commonjs/focusRegistry.js.map +1 -0
- package/lib/commonjs/icons.js +92 -0
- package/lib/commonjs/icons.js.map +1 -0
- package/lib/commonjs/index.js +66 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/index.web.js +32 -2
- package/lib/commonjs/index.web.js.map +1 -1
- package/lib/commonjs/labelStyle.js +27 -0
- package/lib/commonjs/labelStyle.js.map +1 -0
- package/lib/commonjs/reactNativeInternals.d.js +2 -0
- package/lib/commonjs/reactNativeInternals.d.js.map +1 -0
- package/lib/module/Button.js +70 -0
- package/lib/module/Button.js.map +1 -0
- package/lib/module/ButtonGroup.js +92 -0
- package/lib/module/ButtonGroup.js.map +1 -0
- package/lib/module/ButtonGroupNativeComponent.ts +121 -0
- package/lib/module/ButtonNativeComponent.ts +76 -0
- package/lib/module/ContextMenuNativeComponent.ts +5 -4
- package/lib/module/DatePickerNativeComponent.ts +17 -11
- package/lib/module/FloatingToolbar.js +62 -0
- package/lib/module/FloatingToolbar.js.map +1 -0
- package/lib/module/FloatingToolbarNativeComponent.ts +31 -0
- package/lib/module/LiquidGlass.js +24 -4
- package/lib/module/LiquidGlass.js.map +1 -1
- package/lib/module/LiquidGlassNativeComponent.ts +6 -5
- package/lib/module/NativePlatformComponentsTheme.js.map +1 -1
- package/lib/module/SegmentedControl.js +12 -87
- package/lib/module/SegmentedControl.js.map +1 -1
- package/lib/module/SegmentedControlNativeComponent.ts +15 -11
- package/lib/module/SelectionMenuNativeComponent.ts +6 -5
- package/lib/module/TextField.js +189 -0
- package/lib/module/TextField.js.map +1 -0
- package/lib/module/TextFieldNativeComponent.ts +218 -0
- package/lib/module/codegenTypes.js +4 -0
- package/lib/module/codegenTypes.js.map +1 -0
- package/lib/module/focusRegistry.js +74 -0
- package/lib/module/focusRegistry.js.map +1 -0
- package/lib/module/icons.js +87 -0
- package/lib/module/icons.js.map +1 -0
- package/lib/module/index.js +6 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/index.web.js +28 -0
- package/lib/module/index.web.js.map +1 -1
- package/lib/module/labelStyle.js +23 -0
- package/lib/module/labelStyle.js.map +1 -0
- package/lib/module/reactNativeInternals.d.js +2 -0
- package/lib/module/reactNativeInternals.d.js.map +1 -0
- package/lib/typescript/commonjs/docs/sidebars.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/Button.d.ts +76 -0
- package/lib/typescript/commonjs/src/Button.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/ButtonGroup.d.ts +102 -0
- package/lib/typescript/commonjs/src/ButtonGroup.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/ButtonGroupNativeComponent.d.ts +93 -0
- package/lib/typescript/commonjs/src/ButtonGroupNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/ButtonNativeComponent.d.ts +57 -0
- package/lib/typescript/commonjs/src/ButtonNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/ContextMenuNativeComponent.d.ts +5 -4
- package/lib/typescript/commonjs/src/ContextMenuNativeComponent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/DatePickerNativeComponent.d.ts +12 -11
- package/lib/typescript/commonjs/src/DatePickerNativeComponent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/FloatingToolbar.d.ts +45 -0
- package/lib/typescript/commonjs/src/FloatingToolbar.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/FloatingToolbarNativeComponent.d.ts +24 -0
- package/lib/typescript/commonjs/src/FloatingToolbarNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/LiquidGlass.d.ts +4 -3
- package/lib/typescript/commonjs/src/LiquidGlass.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/LiquidGlassNativeComponent.d.ts +6 -5
- package/lib/typescript/commonjs/src/LiquidGlassNativeComponent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/NativePlatformComponentsTheme.d.ts +10 -2
- package/lib/typescript/commonjs/src/NativePlatformComponentsTheme.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/SegmentedControl.d.ts +17 -46
- package/lib/typescript/commonjs/src/SegmentedControl.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/SegmentedControlNativeComponent.d.ts +9 -6
- package/lib/typescript/commonjs/src/SegmentedControlNativeComponent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/SelectionMenuNativeComponent.d.ts +6 -5
- package/lib/typescript/commonjs/src/SelectionMenuNativeComponent.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/TextField.d.ts +174 -0
- package/lib/typescript/commonjs/src/TextField.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/TextFieldNativeComponent.d.ts +162 -0
- package/lib/typescript/commonjs/src/TextFieldNativeComponent.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/codegenTypes.d.ts +12 -0
- package/lib/typescript/commonjs/src/codegenTypes.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/focusRegistry.d.ts +13 -0
- package/lib/typescript/commonjs/src/focusRegistry.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/icons.d.ts +52 -0
- package/lib/typescript/commonjs/src/icons.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts +6 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/index.web.d.ts +121 -0
- package/lib/typescript/commonjs/src/index.web.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/labelStyle.d.ts +20 -0
- package/lib/typescript/commonjs/src/labelStyle.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/sharedTypes.d.ts +8 -3
- package/lib/typescript/commonjs/src/sharedTypes.d.ts.map +1 -1
- package/lib/typescript/module/docs/sidebars.d.ts.map +1 -1
- package/lib/typescript/module/src/Button.d.ts +76 -0
- package/lib/typescript/module/src/Button.d.ts.map +1 -0
- package/lib/typescript/module/src/ButtonGroup.d.ts +102 -0
- package/lib/typescript/module/src/ButtonGroup.d.ts.map +1 -0
- package/lib/typescript/module/src/ButtonGroupNativeComponent.d.ts +93 -0
- package/lib/typescript/module/src/ButtonGroupNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/ButtonNativeComponent.d.ts +57 -0
- package/lib/typescript/module/src/ButtonNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/ContextMenuNativeComponent.d.ts +5 -4
- package/lib/typescript/module/src/ContextMenuNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/src/DatePickerNativeComponent.d.ts +12 -11
- package/lib/typescript/module/src/DatePickerNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/src/FloatingToolbar.d.ts +45 -0
- package/lib/typescript/module/src/FloatingToolbar.d.ts.map +1 -0
- package/lib/typescript/module/src/FloatingToolbarNativeComponent.d.ts +24 -0
- package/lib/typescript/module/src/FloatingToolbarNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/LiquidGlass.d.ts +4 -3
- package/lib/typescript/module/src/LiquidGlass.d.ts.map +1 -1
- package/lib/typescript/module/src/LiquidGlassNativeComponent.d.ts +6 -5
- package/lib/typescript/module/src/LiquidGlassNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/src/NativePlatformComponentsTheme.d.ts +10 -2
- package/lib/typescript/module/src/NativePlatformComponentsTheme.d.ts.map +1 -1
- package/lib/typescript/module/src/SegmentedControl.d.ts +17 -46
- package/lib/typescript/module/src/SegmentedControl.d.ts.map +1 -1
- package/lib/typescript/module/src/SegmentedControlNativeComponent.d.ts +9 -6
- package/lib/typescript/module/src/SegmentedControlNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/src/SelectionMenuNativeComponent.d.ts +6 -5
- package/lib/typescript/module/src/SelectionMenuNativeComponent.d.ts.map +1 -1
- package/lib/typescript/module/src/TextField.d.ts +174 -0
- package/lib/typescript/module/src/TextField.d.ts.map +1 -0
- package/lib/typescript/module/src/TextFieldNativeComponent.d.ts +162 -0
- package/lib/typescript/module/src/TextFieldNativeComponent.d.ts.map +1 -0
- package/lib/typescript/module/src/codegenTypes.d.ts +12 -0
- package/lib/typescript/module/src/codegenTypes.d.ts.map +1 -0
- package/lib/typescript/module/src/focusRegistry.d.ts +13 -0
- package/lib/typescript/module/src/focusRegistry.d.ts.map +1 -0
- package/lib/typescript/module/src/icons.d.ts +52 -0
- package/lib/typescript/module/src/icons.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +6 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -1
- package/lib/typescript/module/src/index.web.d.ts +121 -0
- package/lib/typescript/module/src/index.web.d.ts.map +1 -1
- package/lib/typescript/module/src/labelStyle.d.ts +20 -0
- package/lib/typescript/module/src/labelStyle.d.ts.map +1 -0
- package/lib/typescript/module/src/sharedTypes.d.ts +8 -3
- package/lib/typescript/module/src/sharedTypes.d.ts.map +1 -1
- package/package.json +28 -6
- package/react-native.config.js +3 -0
- package/shared/PCButtonComponentDescriptors-custom.h +22 -0
- package/shared/PCButtonGroupComponentDescriptors-custom.h +22 -0
- package/shared/PCButtonGroupShadowNode-custom.cpp +48 -0
- package/shared/PCButtonGroupShadowNode-custom.h +55 -0
- package/shared/PCButtonGroupState-custom.h +61 -0
- package/shared/PCButtonShadowNode-custom.cpp +48 -0
- package/shared/PCButtonShadowNode-custom.h +55 -0
- package/shared/PCButtonState-custom.h +61 -0
- package/shared/PCDatePickerState-custom.h +2 -2
- package/shared/PCSegmentedControlState-custom.h +2 -2
- package/shared/PCSelectionMenuState-custom.h +2 -2
- package/shared/PCTextFieldComponentDescriptors-custom.h +22 -0
- package/shared/PCTextFieldShadowNode-custom.cpp +47 -0
- package/shared/PCTextFieldShadowNode-custom.h +55 -0
- package/shared/PCTextFieldState-custom.h +61 -0
- package/shared/react/renderer/components/PlatformComponentsViewSpec/ComponentDescriptors.h +3 -0
- package/src/Button.tsx +144 -0
- package/src/ButtonGroup.tsx +233 -0
- package/src/ButtonGroupNativeComponent.ts +121 -0
- package/src/ButtonNativeComponent.ts +76 -0
- package/src/ContextMenuNativeComponent.ts +5 -4
- package/src/DatePickerNativeComponent.ts +17 -11
- package/src/FloatingToolbar.tsx +113 -0
- package/src/FloatingToolbarNativeComponent.ts +31 -0
- package/src/LiquidGlass.tsx +24 -5
- package/src/LiquidGlassNativeComponent.ts +6 -5
- package/src/NativePlatformComponentsTheme.ts +11 -2
- package/src/SegmentedControl.tsx +26 -118
- package/src/SegmentedControlNativeComponent.ts +15 -11
- package/src/SelectionMenuNativeComponent.ts +6 -5
- package/src/TextField.tsx +494 -0
- package/src/TextFieldNativeComponent.ts +218 -0
- package/src/codegenTypes.ts +40 -0
- package/src/focusRegistry.ts +89 -0
- package/src/icons.ts +116 -0
- package/src/index.tsx +6 -0
- package/src/index.web.tsx +194 -0
- package/src/labelStyle.ts +36 -0
- package/src/reactNativeInternals.d.ts +22 -0
- package/src/sharedTypes.ts +9 -3
- /package/{app.plugin.cjs → app.plugin.js} +0 -0
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.Button = Button;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _ButtonNativeComponent = _interopRequireDefault(require("./ButtonNativeComponent"));
|
|
9
|
+
var _icons = require("./icons");
|
|
10
|
+
var _labelStyle = require("./labelStyle");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
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); }
|
|
14
|
+
// Button.tsx
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Emphasis of the button, from highest to lowest.
|
|
18
|
+
*
|
|
19
|
+
* | Variant | Android (Material 3 Expressive) | iOS (`UIButton.Configuration`) |
|
|
20
|
+
* | ---------- | ------------------------------- | ------------------------------ |
|
|
21
|
+
* | `filled` | Filled button | `.filled()` |
|
|
22
|
+
* | `tonal` | Filled tonal button | `.tinted()` |
|
|
23
|
+
* | `outlined` | Outlined button | `.bordered()` |
|
|
24
|
+
* | `text` | Text button | `.plain()` |
|
|
25
|
+
* | `elevated` | Elevated button | `.gray()` |
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Button size. Material 3 Expressive defines five sizes; iOS maps them onto
|
|
30
|
+
* `UIButton.Configuration.Size` (`xsmall` → mini, `xlarge` → large).
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Corner shape. `round` is a pill; `square` keeps rounded corners. Unset
|
|
35
|
+
* means the platform default (round on Android, dynamic on iOS).
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
function Button(props) {
|
|
39
|
+
const {
|
|
40
|
+
label,
|
|
41
|
+
icon,
|
|
42
|
+
variant,
|
|
43
|
+
size,
|
|
44
|
+
shape,
|
|
45
|
+
disabled,
|
|
46
|
+
color,
|
|
47
|
+
tintColor,
|
|
48
|
+
labelStyle,
|
|
49
|
+
accessibilityLabel,
|
|
50
|
+
onPress,
|
|
51
|
+
android,
|
|
52
|
+
...viewProps
|
|
53
|
+
} = props;
|
|
54
|
+
const nativeIcon = (0, _react.useMemo)(() => (0, _icons.resolveIcon)(icon), [icon]);
|
|
55
|
+
const nativeLabelStyle = (0, _react.useMemo)(() => (0, _labelStyle.normalizeLabelStyle)(labelStyle), [labelStyle]);
|
|
56
|
+
const handlePress = (0, _react.useCallback)(() => {
|
|
57
|
+
onPress?.();
|
|
58
|
+
}, [onPress]);
|
|
59
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonNativeComponent.default, {
|
|
60
|
+
label: label ?? '',
|
|
61
|
+
icon: nativeIcon,
|
|
62
|
+
variant: variant ?? 'filled',
|
|
63
|
+
size: size ?? 'small',
|
|
64
|
+
shape: shape ?? '',
|
|
65
|
+
interactivity: disabled ? 'disabled' : 'enabled',
|
|
66
|
+
color: color,
|
|
67
|
+
foregroundColor: tintColor,
|
|
68
|
+
androidRippleColor: android?.rippleColor,
|
|
69
|
+
androidStrokeColor: android?.strokeColor,
|
|
70
|
+
androidMaterial: android?.material ?? 'expressive',
|
|
71
|
+
labelStyle: nativeLabelStyle,
|
|
72
|
+
spokenLabel: accessibilityLabel ?? '',
|
|
73
|
+
onButtonPress: onPress ? handlePress : undefined,
|
|
74
|
+
...viewProps
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_ButtonNativeComponent","_interopRequireDefault","_icons","_labelStyle","_jsxRuntime","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","Button","props","label","icon","variant","size","shape","disabled","color","tintColor","labelStyle","accessibilityLabel","onPress","android","viewProps","nativeIcon","useMemo","resolveIcon","nativeLabelStyle","normalizeLabelStyle","handlePress","useCallback","jsx","interactivity","foregroundColor","androidRippleColor","rippleColor","androidStrokeColor","strokeColor","androidMaterial","material","spokenLabel","onButtonPress","undefined"],"sourceRoot":"../../src","sources":["Button.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,sBAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAAoE,IAAAK,WAAA,GAAAL,OAAA;AAAA,SAAAE,uBAAAI,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAAA,SAAAP,wBAAAO,CAAA,EAAAG,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAX,uBAAA,YAAAA,CAAAO,CAAA,EAAAG,CAAA,SAAAA,CAAA,IAAAH,CAAA,IAAAA,CAAA,CAAAC,UAA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AF,cAAO,EAC9B,MAAM,IAAAG,+BAAmB,EAACT,UAAU,CAAC,EACrC,CAACA,UAAU,CACb,CAAC;EAED,MAAMU,WAAW,GAAG,IAAAC,kBAAW,EAAC,MAAM;IACpCT,OAAO,GAAG,CAAC;EACb,CAAC,EAAE,CAACA,OAAO,CAAC,CAAC;EAEb,oBACE,IAAAhC,WAAA,CAAA0C,GAAA,EAAC9C,sBAAA,CAAAO,OAAY;IACXmB,KAAK,EAAEA,KAAK,IAAI,EAAG;IACnBC,IAAI,EAAEY,UAAW;IACjBX,OAAO,EAAEA,OAAO,IAAI,QAAS;IAC7BC,IAAI,EAAEA,IAAI,IAAI,OAAQ;IACtBC,KAAK,EAAEA,KAAK,IAAI,EAAG;IACnBiB,aAAa,EAAEhB,QAAQ,GAAG,UAAU,GAAG,SAAU;IACjDC,KAAK,EAAEA,KAAM;IACbgB,eAAe,EAAEf,SAAU;IAC3BgB,kBAAkB,EAAEZ,OAAO,EAAEa,WAAY;IACzCC,kBAAkB,EAAEd,OAAO,EAAEe,WAAY;IACzCC,eAAe,EAAEhB,OAAO,EAAEiB,QAAQ,IAAI,YAAa;IACnDpB,UAAU,EAAEQ,gBAAiB;IAC7Ba,WAAW,EAAEpB,kBAAkB,IAAI,EAAG;IACtCqB,aAAa,EAAEpB,OAAO,GAAGQ,WAAW,GAAGa,SAAU;IAAA,GAC7CnB;EAAS,CACd,CAAC;AAEN","ignoreList":[]}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.ButtonGroup = ButtonGroup;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _ButtonGroupNativeComponent = _interopRequireDefault(require("./ButtonGroupNativeComponent"));
|
|
9
|
+
var _icons = require("./icons");
|
|
10
|
+
var _labelStyle = require("./labelStyle");
|
|
11
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
|
+
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); }
|
|
14
|
+
// ButtonGroup.tsx
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Selection behavior of the group.
|
|
18
|
+
*
|
|
19
|
+
* - `none` (default): the buttons are plain actions.
|
|
20
|
+
* - `single`: at most one button is selected at a time.
|
|
21
|
+
* - `multiple`: any number of buttons can be selected.
|
|
22
|
+
*/
|
|
23
|
+
|
|
24
|
+
/** What happens to buttons that don't fit the group's width (Android). */
|
|
25
|
+
|
|
26
|
+
function ButtonGroup(props) {
|
|
27
|
+
const {
|
|
28
|
+
buttons,
|
|
29
|
+
variant,
|
|
30
|
+
size,
|
|
31
|
+
shape,
|
|
32
|
+
connected,
|
|
33
|
+
spacing,
|
|
34
|
+
selection,
|
|
35
|
+
selectedValues,
|
|
36
|
+
selectionRequired,
|
|
37
|
+
disabled,
|
|
38
|
+
color,
|
|
39
|
+
tintColor,
|
|
40
|
+
labelStyle,
|
|
41
|
+
onPress,
|
|
42
|
+
onSelectionChange,
|
|
43
|
+
android,
|
|
44
|
+
...viewProps
|
|
45
|
+
} = props;
|
|
46
|
+
const selectionMode = selection ?? 'none';
|
|
47
|
+
const nativeButtons = (0, _react.useMemo)(() => {
|
|
48
|
+
return buttons.map(button => ({
|
|
49
|
+
label: button.label ?? '',
|
|
50
|
+
value: button.value,
|
|
51
|
+
disabled: button.disabled ? 'disabled' : 'enabled',
|
|
52
|
+
accessibilityLabel: button.accessibilityLabel ?? '',
|
|
53
|
+
...(0, _icons.resolveIcon)(button.icon)
|
|
54
|
+
}));
|
|
55
|
+
}, [buttons]);
|
|
56
|
+
const nativeSelectedValues = (0, _react.useMemo)(() => {
|
|
57
|
+
if (selectionMode === 'none' || !selectedValues) return [];
|
|
58
|
+
return selectionMode === 'single' ? selectedValues.slice(0, 1) : [...selectedValues];
|
|
59
|
+
}, [selectionMode, selectedValues]);
|
|
60
|
+
const nativeLabelStyle = (0, _react.useMemo)(() => (0, _labelStyle.normalizeLabelStyle)(labelStyle), [labelStyle]);
|
|
61
|
+
const handlePress = (0, _react.useCallback)(e => {
|
|
62
|
+
const {
|
|
63
|
+
index,
|
|
64
|
+
value
|
|
65
|
+
} = e.nativeEvent;
|
|
66
|
+
onPress?.(value, index);
|
|
67
|
+
}, [onPress]);
|
|
68
|
+
const handleSelectionChange = (0, _react.useCallback)(e => {
|
|
69
|
+
onSelectionChange?.([...e.nativeEvent.values]);
|
|
70
|
+
}, [onSelectionChange]);
|
|
71
|
+
const nativeAndroid = (0, _react.useMemo)(() => ({
|
|
72
|
+
overflow: android?.overflow ?? 'none',
|
|
73
|
+
material: android?.material ?? 'expressive'
|
|
74
|
+
}), [android]);
|
|
75
|
+
const isConnected = connected ?? selectionMode !== 'none';
|
|
76
|
+
const isSelectionRequired = selectionRequired ?? (selectionMode === 'single' ? true : false);
|
|
77
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonGroupNativeComponent.default, {
|
|
78
|
+
buttons: nativeButtons,
|
|
79
|
+
variant: variant ?? 'outlined',
|
|
80
|
+
size: size ?? 'small',
|
|
81
|
+
shape: shape ?? '',
|
|
82
|
+
connected: isConnected ? 'true' : 'false',
|
|
83
|
+
spacing: spacing ?? -1,
|
|
84
|
+
selection: selectionMode,
|
|
85
|
+
selectedValues: nativeSelectedValues,
|
|
86
|
+
selectionRequired: isSelectionRequired ? 'true' : 'false',
|
|
87
|
+
interactivity: disabled ? 'disabled' : 'enabled',
|
|
88
|
+
color: color,
|
|
89
|
+
foregroundColor: tintColor,
|
|
90
|
+
androidRippleColor: android?.rippleColor,
|
|
91
|
+
androidStrokeColor: android?.strokeColor,
|
|
92
|
+
labelStyle: nativeLabelStyle,
|
|
93
|
+
onButtonPress: onPress ? handlePress : undefined,
|
|
94
|
+
onGroupSelectionChange: onSelectionChange ? handleSelectionChange : undefined,
|
|
95
|
+
android: nativeAndroid,
|
|
96
|
+
...viewProps
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
//# sourceMappingURL=ButtonGroup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_ButtonGroupNativeComponent","_interopRequireDefault","_icons","_labelStyle","_jsxRuntime","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ButtonGroup","props","buttons","variant","size","shape","connected","spacing","selection","selectedValues","selectionRequired","disabled","color","tintColor","labelStyle","onPress","onSelectionChange","android","viewProps","selectionMode","nativeButtons","useMemo","map","button","label","value","accessibilityLabel","resolveIcon","icon","nativeSelectedValues","slice","nativeLabelStyle","normalizeLabelStyle","handlePress","useCallback","index","nativeEvent","handleSelectionChange","values","nativeAndroid","overflow","material","isConnected","isSelectionRequired","jsx","interactivity","foregroundColor","androidRippleColor","rippleColor","androidStrokeColor","strokeColor","onButtonPress","undefined","onGroupSelectionChange"],"sourceRoot":"../../src","sources":["ButtonGroup.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAIA,IAAAC,2BAAA,GAAAC,sBAAA,CAAAF,OAAA;AAKA,IAAAG,MAAA,GAAAH,OAAA;AACA,IAAAI,WAAA,GAAAJ,OAAA;AAAoE,IAAAK,WAAA,GAAAL,OAAA;AAAA,SAAAE,uBAAA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CpC,UAAU,EAAEiB,gBAAiB;IAC7BoB,aAAa,EAAEpC,OAAO,GAAGkB,WAAW,GAAGmB,SAAU;IACjDC,sBAAsB,EACpBrC,iBAAiB,GAAGqB,qBAAqB,GAAGe,SAC7C;IACDnC,OAAO,EAAEsB,aAAc;IAAA,GACnBrB;EAAS,CACd,CAAC;AAEN","ignoreList":[]}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
// ButtonGroupNativeComponent.ts
|
|
2
|
+
import type { ColorValue, HostComponent, ViewProps } from 'react-native';
|
|
3
|
+
import { codegenNativeComponent } from 'react-native';
|
|
4
|
+
import type { BubblingEventHandler, Double, Int32 } from './codegenTypes';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A single button in the group. Icons are pre-resolved on the JS side (see
|
|
8
|
+
* icons.ts) so native only deals with flat strings.
|
|
9
|
+
*/
|
|
10
|
+
export type ButtonGroupButton = Readonly<{
|
|
11
|
+
label: string; // Empty for an icon-only button
|
|
12
|
+
value: string;
|
|
13
|
+
disabled: string; // 'enabled' | 'disabled'
|
|
14
|
+
iconType: string; // '' | 'sfSymbol' | 'drawable' | 'image'
|
|
15
|
+
iconName: string; // SF Symbol (iOS) or drawable resource name (Android)
|
|
16
|
+
iconUri: string; // Resolved image URI when iconType === 'image'
|
|
17
|
+
iconScale: Double; // Resolved image scale when iconType === 'image'
|
|
18
|
+
iconTinted: string; // 'true' | 'false' — draw the image as a tinted template
|
|
19
|
+
accessibilityLabel: string; // Screen-reader label, empty = use label
|
|
20
|
+
}>;
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Event emitted when a button is pressed.
|
|
24
|
+
*/
|
|
25
|
+
export type ButtonGroupPressEvent = Readonly<{
|
|
26
|
+
index: Int32;
|
|
27
|
+
value: string;
|
|
28
|
+
}>;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Event emitted when the selection changes (single / multiple selection).
|
|
32
|
+
*/
|
|
33
|
+
export type ButtonGroupSelectionEvent = Readonly<{
|
|
34
|
+
/** Values of the selected buttons, in button order. */
|
|
35
|
+
// Codegen only understands the `T[]` array form in event payloads.
|
|
36
|
+
values: string[];
|
|
37
|
+
}>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Label font. Empty strings / 0 mean "platform default".
|
|
41
|
+
*/
|
|
42
|
+
export type ButtonGroupLabelStyleProps = Readonly<{
|
|
43
|
+
fontFamily?: string;
|
|
44
|
+
fontSize?: Double;
|
|
45
|
+
fontWeight?: string; // 'normal' | 'bold' | '100'..'900'
|
|
46
|
+
fontStyle?: string; // 'normal' | 'italic'
|
|
47
|
+
}>;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Android-specific configuration.
|
|
51
|
+
*/
|
|
52
|
+
export type ButtonGroupAndroidProps = Readonly<{
|
|
53
|
+
/** What happens to buttons that don't fit: 'none' | 'menu' | 'wrap' */
|
|
54
|
+
overflow?: string;
|
|
55
|
+
|
|
56
|
+
/** Material style: 'm3' | 'expressive' */
|
|
57
|
+
material?: string;
|
|
58
|
+
}>;
|
|
59
|
+
|
|
60
|
+
export interface ButtonGroupNativeProps extends ViewProps {
|
|
61
|
+
/** Buttons to display. */
|
|
62
|
+
buttons: ReadonlyArray<ButtonGroupButton>;
|
|
63
|
+
|
|
64
|
+
/** 'filled' | 'tonal' | 'outlined' | 'text' | 'elevated' */
|
|
65
|
+
variant?: string;
|
|
66
|
+
|
|
67
|
+
/** 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' */
|
|
68
|
+
size?: string;
|
|
69
|
+
|
|
70
|
+
/** '' (platform default) | 'round' | 'square' */
|
|
71
|
+
shape?: string;
|
|
72
|
+
|
|
73
|
+
/** 'true' | 'false': connected group (shared outline, small inner corners) */
|
|
74
|
+
connected?: string;
|
|
75
|
+
|
|
76
|
+
/** Gap between buttons in points; negative means the platform default. */
|
|
77
|
+
spacing?: Double;
|
|
78
|
+
|
|
79
|
+
/** 'none' | 'single' | 'multiple' */
|
|
80
|
+
selection?: string;
|
|
81
|
+
|
|
82
|
+
/** Values of the selected buttons (single / multiple selection). */
|
|
83
|
+
selectedValues?: ReadonlyArray<string>;
|
|
84
|
+
|
|
85
|
+
/** 'true' | 'false': whether at least one button must stay selected */
|
|
86
|
+
selectionRequired?: string;
|
|
87
|
+
|
|
88
|
+
/** 'enabled' | 'disabled' */
|
|
89
|
+
interactivity?: string;
|
|
90
|
+
|
|
91
|
+
/** Container (background) color of the buttons. */
|
|
92
|
+
color?: ColorValue;
|
|
93
|
+
|
|
94
|
+
/** Label and icon color of the buttons. */
|
|
95
|
+
foregroundColor?: ColorValue;
|
|
96
|
+
|
|
97
|
+
/** Android: ripple color shown while pressing a button. */
|
|
98
|
+
androidRippleColor?: ColorValue;
|
|
99
|
+
|
|
100
|
+
/** Android: outline color (outlined variant). */
|
|
101
|
+
androidStrokeColor?: ColorValue;
|
|
102
|
+
|
|
103
|
+
/** Label font. */
|
|
104
|
+
labelStyle?: ButtonGroupLabelStyleProps;
|
|
105
|
+
|
|
106
|
+
/** Fired when a button is pressed. */
|
|
107
|
+
onButtonPress?: BubblingEventHandler<ButtonGroupPressEvent>;
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* Fired when the selection changes. Not `onSelectionChange`: React Native's
|
|
111
|
+
* TextInput registers `topSelectionChange` as a direct event, and an event
|
|
112
|
+
* name can't be both direct and bubbling.
|
|
113
|
+
*/
|
|
114
|
+
onGroupSelectionChange?: BubblingEventHandler<ButtonGroupSelectionEvent>;
|
|
115
|
+
|
|
116
|
+
android?: ButtonGroupAndroidProps;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export default codegenNativeComponent<ButtonGroupNativeProps>(
|
|
120
|
+
'PCButtonGroup'
|
|
121
|
+
) as HostComponent<ButtonGroupNativeProps>;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// ButtonNativeComponent.ts
|
|
2
|
+
import type { ColorValue, HostComponent, ViewProps } from 'react-native';
|
|
3
|
+
import { codegenNativeComponent } from 'react-native';
|
|
4
|
+
import type { BubblingEventHandler, Double } from './codegenTypes';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Icon fields, pre-resolved on the JS side (see icons.ts).
|
|
8
|
+
*/
|
|
9
|
+
export type ButtonIconProps = Readonly<{
|
|
10
|
+
iconType: string; // '' | 'sfSymbol' | 'drawable' | 'image'
|
|
11
|
+
iconName: string; // SF Symbol (iOS) or drawable resource name (Android)
|
|
12
|
+
iconUri: string; // Resolved image URI when iconType === 'image'
|
|
13
|
+
iconScale: Double; // Resolved image scale when iconType === 'image'
|
|
14
|
+
iconTinted: string; // 'true' | 'false' — draw the image as a tinted template
|
|
15
|
+
}>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Label font. Empty strings / 0 mean "platform default".
|
|
19
|
+
*/
|
|
20
|
+
export type ButtonLabelStyleProps = Readonly<{
|
|
21
|
+
fontFamily?: string;
|
|
22
|
+
fontSize?: Double;
|
|
23
|
+
fontWeight?: string; // 'normal' | 'bold' | '100'..'900'
|
|
24
|
+
fontStyle?: string; // 'normal' | 'italic'
|
|
25
|
+
}>;
|
|
26
|
+
|
|
27
|
+
export interface ButtonNativeProps extends ViewProps {
|
|
28
|
+
/** Button text. Empty for an icon-only button. */
|
|
29
|
+
label?: string;
|
|
30
|
+
|
|
31
|
+
/** Icon shown before the label, or alone when there is no label. */
|
|
32
|
+
icon?: ButtonIconProps;
|
|
33
|
+
|
|
34
|
+
/** 'filled' | 'tonal' | 'outlined' | 'text' | 'elevated' */
|
|
35
|
+
variant?: string;
|
|
36
|
+
|
|
37
|
+
/** 'xsmall' | 'small' | 'medium' | 'large' | 'xlarge' */
|
|
38
|
+
size?: string;
|
|
39
|
+
|
|
40
|
+
/** '' (platform default) | 'round' | 'square' */
|
|
41
|
+
shape?: string;
|
|
42
|
+
|
|
43
|
+
/** 'enabled' | 'disabled' */
|
|
44
|
+
interactivity?: string;
|
|
45
|
+
|
|
46
|
+
/** Container (background) color. */
|
|
47
|
+
color?: ColorValue;
|
|
48
|
+
|
|
49
|
+
/** Label and icon color. */
|
|
50
|
+
foregroundColor?: ColorValue;
|
|
51
|
+
|
|
52
|
+
/** Android: ripple color shown while pressing. */
|
|
53
|
+
androidRippleColor?: ColorValue;
|
|
54
|
+
|
|
55
|
+
/** Android: outline color (outlined variant). */
|
|
56
|
+
androidStrokeColor?: ColorValue;
|
|
57
|
+
|
|
58
|
+
/** Android: Material style, 'm3' | 'expressive' */
|
|
59
|
+
androidMaterial?: string;
|
|
60
|
+
|
|
61
|
+
/** Label font. */
|
|
62
|
+
labelStyle?: ButtonLabelStyleProps;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Screen-reader label, applied to the native button rather than the host
|
|
66
|
+
* view. Empty means "use the label".
|
|
67
|
+
*/
|
|
68
|
+
spokenLabel?: string;
|
|
69
|
+
|
|
70
|
+
/** Fired when the button is pressed. */
|
|
71
|
+
onButtonPress?: BubblingEventHandler<Readonly<{}>>;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export default codegenNativeComponent<ButtonNativeProps>(
|
|
75
|
+
'PCButton'
|
|
76
|
+
) as HostComponent<ButtonNativeProps>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// ContextMenuNativeComponent.ts
|
|
2
|
-
import type {
|
|
2
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
3
3
|
import { codegenNativeComponent } from 'react-native';
|
|
4
|
+
import type { BubblingEventHandler } from './codegenTypes';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Attributes for a context menu action.
|
|
@@ -120,17 +121,17 @@ export interface ContextMenuProps extends ViewProps {
|
|
|
120
121
|
/**
|
|
121
122
|
* Fired when user presses an action.
|
|
122
123
|
*/
|
|
123
|
-
onPressAction?:
|
|
124
|
+
onPressAction?: BubblingEventHandler<ContextMenuPressActionEvent>;
|
|
124
125
|
|
|
125
126
|
/**
|
|
126
127
|
* Fired when menu opens.
|
|
127
128
|
*/
|
|
128
|
-
onMenuOpen?:
|
|
129
|
+
onMenuOpen?: BubblingEventHandler<Readonly<{}>>;
|
|
129
130
|
|
|
130
131
|
/**
|
|
131
132
|
* Fired when menu closes.
|
|
132
133
|
*/
|
|
133
|
-
onMenuClose?:
|
|
134
|
+
onMenuClose?: BubblingEventHandler<Readonly<{}>>;
|
|
134
135
|
|
|
135
136
|
ios?: IOSProps;
|
|
136
137
|
android?: AndroidProps;
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
// DatePickerNativeComponent.ts
|
|
2
|
-
import type {
|
|
2
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
3
3
|
import { codegenNativeComponent } from 'react-native';
|
|
4
|
+
import type {
|
|
5
|
+
BubblingEventHandler,
|
|
6
|
+
Double,
|
|
7
|
+
Int32,
|
|
8
|
+
WithDefault,
|
|
9
|
+
} from './codegenTypes';
|
|
4
10
|
|
|
5
|
-
export type TimestampMs =
|
|
11
|
+
export type TimestampMs = Double;
|
|
6
12
|
|
|
7
13
|
export type DateChangeEvent = {
|
|
8
|
-
timestampMs:
|
|
14
|
+
timestampMs: Double;
|
|
9
15
|
confirmed: boolean;
|
|
10
16
|
};
|
|
11
17
|
|
|
@@ -18,14 +24,14 @@ export type IOSConfirmToolbar = 'show' | 'hide';
|
|
|
18
24
|
|
|
19
25
|
export type IOSProps = {
|
|
20
26
|
preferredStyle?: string; // IOSDatePickerStyle
|
|
21
|
-
countDownDurationSeconds?:
|
|
22
|
-
minuteInterval?:
|
|
27
|
+
countDownDurationSeconds?: Double;
|
|
28
|
+
minuteInterval?: Int32;
|
|
23
29
|
roundsToMinuteInterval?: string; // IOSRoundsToMinuteInterval
|
|
24
30
|
confirmToolbar?: string; // IOSConfirmToolbar
|
|
25
31
|
};
|
|
26
32
|
|
|
27
33
|
export type AndroidProps = {
|
|
28
|
-
firstDayOfWeek?:
|
|
34
|
+
firstDayOfWeek?: Int32;
|
|
29
35
|
material?: string; // AndroidMaterialMode
|
|
30
36
|
dialogTitle?: string;
|
|
31
37
|
positiveButtonTitle?: string;
|
|
@@ -44,9 +50,9 @@ export type MacOSProps = Readonly<{}>;
|
|
|
44
50
|
export type CommonProps = {
|
|
45
51
|
mode?: string; // DatePickerMode
|
|
46
52
|
|
|
47
|
-
dateMs?:
|
|
48
|
-
minDateMs?:
|
|
49
|
-
maxDateMs?:
|
|
53
|
+
dateMs?: WithDefault<TimestampMs, -9007199254740991>;
|
|
54
|
+
minDateMs?: WithDefault<TimestampMs, -9007199254740991>;
|
|
55
|
+
maxDateMs?: WithDefault<TimestampMs, -9007199254740991>;
|
|
50
56
|
|
|
51
57
|
locale?: string;
|
|
52
58
|
timeZoneName?: string;
|
|
@@ -65,8 +71,8 @@ export interface NativeProps extends ViewProps, CommonProps {
|
|
|
65
71
|
ios?: IOSProps;
|
|
66
72
|
android?: AndroidProps;
|
|
67
73
|
|
|
68
|
-
onConfirm?:
|
|
69
|
-
onClosed?:
|
|
74
|
+
onConfirm?: BubblingEventHandler<DateChangeEvent>;
|
|
75
|
+
onClosed?: BubblingEventHandler<Readonly<{}>>;
|
|
70
76
|
}
|
|
71
77
|
|
|
72
78
|
export default codegenNativeComponent<NativeProps>(
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.FloatingToolbar = FloatingToolbar;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _reactNative = require("react-native");
|
|
9
|
+
var _FloatingToolbarNativeComponent = _interopRequireDefault(require("./FloatingToolbarNativeComponent"));
|
|
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
|
+
// FloatingToolbar.tsx
|
|
14
|
+
|
|
15
|
+
/** Glass effect style of the toolbar on iOS 26. */
|
|
16
|
+
|
|
17
|
+
/** Material 3 color variant of the toolbar on Android. */
|
|
18
|
+
|
|
19
|
+
function FloatingToolbar(props) {
|
|
20
|
+
const {
|
|
21
|
+
style,
|
|
22
|
+
orientation,
|
|
23
|
+
color,
|
|
24
|
+
ios,
|
|
25
|
+
android,
|
|
26
|
+
children,
|
|
27
|
+
...viewProps
|
|
28
|
+
} = props;
|
|
29
|
+
const nativeIos = (0, _react.useMemo)(() => {
|
|
30
|
+
if (_reactNative.Platform.OS !== 'ios' || !ios) return undefined;
|
|
31
|
+
return {
|
|
32
|
+
effect: ios.effect ?? 'regular'
|
|
33
|
+
};
|
|
34
|
+
}, [ios]);
|
|
35
|
+
const nativeAndroid = (0, _react.useMemo)(() => {
|
|
36
|
+
if (_reactNative.Platform.OS !== 'android' || !android) return undefined;
|
|
37
|
+
return {
|
|
38
|
+
variant: android.variant ?? 'standard'
|
|
39
|
+
};
|
|
40
|
+
}, [android]);
|
|
41
|
+
const mergedStyle = (0, _react.useMemo)(() => [styles.toolbar, orientation === 'vertical' ? styles.vertical : styles.horizontal, style], [orientation, style]);
|
|
42
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_FloatingToolbarNativeComponent.default, {
|
|
43
|
+
style: mergedStyle,
|
|
44
|
+
color: color,
|
|
45
|
+
ios: nativeIos,
|
|
46
|
+
android: nativeAndroid,
|
|
47
|
+
...viewProps,
|
|
48
|
+
children: children
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Material 3 floating toolbar: 8dp container padding, 4dp between actions.
|
|
53
|
+
// The capsule shape comes from native.
|
|
54
|
+
const styles = _reactNative.StyleSheet.create({
|
|
55
|
+
toolbar: {
|
|
56
|
+
alignSelf: 'center',
|
|
57
|
+
alignItems: 'center',
|
|
58
|
+
justifyContent: 'center',
|
|
59
|
+
padding: 8,
|
|
60
|
+
gap: 4
|
|
61
|
+
},
|
|
62
|
+
horizontal: {
|
|
63
|
+
flexDirection: 'row'
|
|
64
|
+
},
|
|
65
|
+
vertical: {
|
|
66
|
+
flexDirection: 'column'
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=FloatingToolbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_reactNative","_FloatingToolbarNativeComponent","_interopRequireDefault","_jsxRuntime","e","__esModule","default","t","WeakMap","r","n","o","i","f","__proto__","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","FloatingToolbar","props","style","orientation","color","ios","android","children","viewProps","nativeIos","useMemo","Platform","OS","undefined","effect","nativeAndroid","variant","mergedStyle","styles","toolbar","vertical","horizontal","jsx","StyleSheet","create","alignSelf","alignItems","justifyContent","padding","gap","flexDirection"],"sourceRoot":"../../src","sources":["FloatingToolbar.tsx"],"mappings":";;;;;;AACA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AASA,IAAAE,+BAAA,GAAAC,sBAAA,CAAAH,OAAA;AAAqE,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,O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AAET,GAAG,CAACS,MAAM,IAAI;IAAU,CAAC;EAC5C,CAAC,EAAE,CAACT,GAAG,CAAC,CAAC;EAET,MAAMU,aAAa,GAAG,IAAAL,cAAO,EAAC,MAAM;IAClC,IAAIC,qBAAQ,CAACC,EAAE,KAAK,SAAS,IAAI,CAACN,OAAO,EAAE,OAAOO,SAAS;IAC3D,OAAO;MAAEG,OAAO,EAAEV,OAAO,CAACU,OAAO,IAAI;IAAW,CAAC;EACnD,CAAC,EAAE,CAACV,OAAO,CAAC,CAAC;EAEb,MAAMW,WAAW,GAAG,IAAAP,cAAO,EACzB,MAA4B,CAC1BQ,MAAM,CAACC,OAAO,EACdhB,WAAW,KAAK,UAAU,GAAGe,MAAM,CAACE,QAAQ,GAAGF,MAAM,CAACG,UAAU,EAChEnB,KAAK,CACN,EACD,CAACC,WAAW,EAAED,KAAK,CACrB,CAAC;EAED,oBACE,IAAAtB,WAAA,CAAA0C,GAAA,EAAC5C,+BAAA,CAAAK,OAAqB;IACpBmB,KAAK,EAAEe,WAAY;IACnBb,KAAK,EAAEA,KAAM;IACbC,GAAG,EAAEI,SAAU;IACfH,OAAO,EAAES,aAAc;IAAA,GACnBP,SAAS;IAAAD,QAAA,EAEZA;EAAQ,CACY,CAAC;AAE5B;;AAEA;AACA;AACA,MAAMW,MAAM,GAAGK,uBAAU,CAACC,MAAM,CAAC;EAC/BL,OAAO,EAAE;IACPM,SAAS,EAAE,QAAQ;IACnBC,UAAU,EAAE,QAAQ;IACpBC,cAAc,EAAE,QAAQ;IACxBC,OAAO,EAAE,CAAC;IACVC,GAAG,EAAE;EACP,CAAC;EACDR,UAAU,EAAE;IAAES,aAAa,EAAE;EAAM,CAAC;EACpCV,QAAQ,EAAE;IAAEU,aAAa,EAAE;EAAS;AACtC,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// FloatingToolbarNativeComponent.ts
|
|
2
|
+
import type { ColorValue, HostComponent, ViewProps } from 'react-native';
|
|
3
|
+
import { codegenNativeComponent } from 'react-native';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* iOS-specific configuration.
|
|
7
|
+
*/
|
|
8
|
+
export type FloatingToolbarIOSProps = Readonly<{
|
|
9
|
+
/** Glass effect style on iOS 26: 'regular' | 'clear' */
|
|
10
|
+
effect?: string;
|
|
11
|
+
}>;
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Android-specific configuration.
|
|
15
|
+
*/
|
|
16
|
+
export type FloatingToolbarAndroidProps = Readonly<{
|
|
17
|
+
/** Material color variant: 'standard' | 'vibrant' */
|
|
18
|
+
variant?: string;
|
|
19
|
+
}>;
|
|
20
|
+
|
|
21
|
+
export interface FloatingToolbarNativeProps extends ViewProps {
|
|
22
|
+
/** Container color. Default: the platform's toolbar material. */
|
|
23
|
+
color?: ColorValue;
|
|
24
|
+
|
|
25
|
+
ios?: FloatingToolbarIOSProps;
|
|
26
|
+
android?: FloatingToolbarAndroidProps;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default codegenNativeComponent<FloatingToolbarNativeProps>(
|
|
30
|
+
'PCFloatingToolbar'
|
|
31
|
+
) as HostComponent<FloatingToolbarNativeProps>;
|
|
@@ -8,18 +8,38 @@ exports.isLiquidGlassSupported = void 0;
|
|
|
8
8
|
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _reactNative = require("react-native");
|
|
10
10
|
var _LiquidGlassNativeComponent = _interopRequireDefault(require("./LiquidGlassNativeComponent"));
|
|
11
|
+
var _NativePlatformComponentsTheme = _interopRequireDefault(require("./NativePlatformComponentsTheme"));
|
|
11
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
13
14
|
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); }
|
|
14
15
|
// LiquidGlass.tsx
|
|
15
16
|
|
|
17
|
+
function resolveLiquidGlassSupport() {
|
|
18
|
+
if (_reactNative.Platform.OS !== 'ios') {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
// The native module answers for this build: Liquid Glass is compiled out
|
|
23
|
+
// when the library is built with an Xcode that predates the iOS 26 SDK,
|
|
24
|
+
// and then no device version makes it available.
|
|
25
|
+
const supported = _NativePlatformComponentsTheme.default?.isLiquidGlassSupported();
|
|
26
|
+
if (typeof supported === 'boolean') {
|
|
27
|
+
return supported;
|
|
28
|
+
}
|
|
29
|
+
} catch {
|
|
30
|
+
// Native module not available (web, tests): fall back to the OS version.
|
|
31
|
+
}
|
|
32
|
+
return parseInt(String(_reactNative.Platform.Version), 10) >= 26;
|
|
33
|
+
}
|
|
34
|
+
|
|
16
35
|
/**
|
|
17
|
-
* Whether the LiquidGlass effect is supported
|
|
18
|
-
*
|
|
36
|
+
* Whether the LiquidGlass effect is supported here: iOS 26 or newer, in a
|
|
37
|
+
* build compiled against the iOS 26 SDK. False on Android, on older iOS, and
|
|
38
|
+
* in builds made with an older Xcode, where the views fall back to a blur.
|
|
19
39
|
*
|
|
20
|
-
* Use this to conditionally render fallback UI
|
|
40
|
+
* Use this to conditionally render fallback UI.
|
|
21
41
|
*/
|
|
22
|
-
const isLiquidGlassSupported = exports.isLiquidGlassSupported =
|
|
42
|
+
const isLiquidGlassSupported = exports.isLiquidGlassSupported = resolveLiquidGlassSupport();
|
|
23
43
|
function LiquidGlass(props) {
|
|
24
44
|
const {
|
|
25
45
|
style,
|