@expo/ui 55.0.1 → 55.0.3
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/CHANGELOG.md +58 -0
- package/CONTRIBUTING.md +30 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/ui/AnimatedVisibilityView.kt +130 -0
- package/android/src/main/java/expo/modules/ui/CardView.kt +138 -34
- package/android/src/main/java/expo/modules/ui/CheckboxView.kt +98 -0
- package/android/src/main/java/expo/modules/ui/ChipView.kt +267 -142
- package/android/src/main/java/expo/modules/ui/DatePickerView.kt +302 -31
- package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +204 -57
- package/android/src/main/java/expo/modules/ui/HorizontalFloatingToolbarView.kt +21 -8
- package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +149 -40
- package/android/src/main/java/expo/modules/ui/ProgressView.kt +189 -89
- package/android/src/main/java/expo/modules/ui/RNHostView.kt +204 -50
- package/android/src/main/java/expo/modules/ui/RadioButtonView.kt +3 -7
- package/android/src/main/java/expo/modules/ui/SegmentedButtonView.kt +115 -0
- package/android/src/main/java/expo/modules/ui/SegmentedControlView.kt +35 -0
- package/android/src/main/java/expo/modules/ui/SliderView.kt +70 -12
- package/android/src/main/java/expo/modules/ui/SwitchView.kt +62 -104
- package/android/src/main/java/expo/modules/ui/ToggleButtonView.kt +95 -57
- package/android/src/main/java/expo/modules/ui/button/Button.kt +117 -158
- package/android/src/main/java/expo/modules/ui/button/FloatingActionButton.kt +92 -0
- package/android/src/main/java/expo/modules/ui/button/IconButton.kt +73 -80
- package/android/src/main/java/expo/modules/ui/convertibles/AnimatableFloat.kt +26 -0
- package/android/src/main/java/expo/modules/ui/convertibles/AnimationSpecParams.kt +93 -0
- package/android/src/main/java/expo/modules/ui/convertibles/GraphicsLayerParams.kt +24 -0
- package/android/src/main/java/expo/modules/ui/menu/DropdownMenu.kt +39 -0
- package/android/src/main/java/expo/modules/ui/menu/DropdownMenuItem.kt +70 -0
- package/android/src/main/java/expo/modules/ui/menu/DropdownMenuRecords.kt +18 -0
- package/build/jetpack-compose/AnimatedVisibility/index.d.ts +134 -0
- package/build/jetpack-compose/AnimatedVisibility/index.d.ts.map +1 -0
- package/build/jetpack-compose/AnimatedVisibility/symbols.d.ts +3 -0
- package/build/jetpack-compose/AnimatedVisibility/symbols.d.ts.map +1 -0
- package/build/jetpack-compose/Button/index.d.ts +65 -51
- package/build/jetpack-compose/Button/index.d.ts.map +1 -1
- package/build/jetpack-compose/Card/index.d.ts +72 -14
- package/build/jetpack-compose/Card/index.d.ts.map +1 -1
- package/build/jetpack-compose/Checkbox/index.d.ts +73 -0
- package/build/jetpack-compose/Checkbox/index.d.ts.map +1 -0
- package/build/jetpack-compose/Chip/index.d.ts +247 -27
- package/build/jetpack-compose/Chip/index.d.ts.map +1 -1
- package/build/jetpack-compose/DatePicker/index.d.ts +137 -3
- package/build/jetpack-compose/DatePicker/index.d.ts.map +1 -1
- package/build/jetpack-compose/DropdownMenu/DropdownMenuItem.d.ts +70 -0
- package/build/jetpack-compose/DropdownMenu/DropdownMenuItem.d.ts.map +1 -0
- package/build/jetpack-compose/DropdownMenu/index.d.ts +68 -0
- package/build/jetpack-compose/DropdownMenu/index.d.ts.map +1 -0
- package/build/jetpack-compose/FloatingActionButton/index.d.ts +150 -0
- package/build/jetpack-compose/FloatingActionButton/index.d.ts.map +1 -0
- package/build/jetpack-compose/HorizontalFloatingToolbar/index.d.ts +2 -2
- package/build/jetpack-compose/HorizontalFloatingToolbar/index.d.ts.map +1 -1
- package/build/jetpack-compose/IconButton/index.d.ts +45 -29
- package/build/jetpack-compose/IconButton/index.d.ts.map +1 -1
- package/build/jetpack-compose/MultiChoiceSegmentedButtonRow/index.d.ts +17 -0
- package/build/jetpack-compose/MultiChoiceSegmentedButtonRow/index.d.ts.map +1 -0
- package/build/jetpack-compose/Progress/index.d.ts +78 -35
- package/build/jetpack-compose/Progress/index.d.ts.map +1 -1
- package/build/jetpack-compose/RadioButton/index.d.ts +2 -2
- package/build/jetpack-compose/RadioButton/index.d.ts.map +1 -1
- package/build/jetpack-compose/SegmentedButton/index.d.ts +74 -0
- package/build/jetpack-compose/SegmentedButton/index.d.ts.map +1 -0
- package/build/jetpack-compose/SingleChoiceSegmentedButtonRow/index.d.ts +17 -0
- package/build/jetpack-compose/SingleChoiceSegmentedButtonRow/index.d.ts.map +1 -0
- package/build/jetpack-compose/Slider/index.d.ts +34 -10
- package/build/jetpack-compose/Slider/index.d.ts.map +1 -1
- package/build/jetpack-compose/Spacer/index.d.ts +2 -2
- package/build/jetpack-compose/Switch/index.d.ts +25 -47
- package/build/jetpack-compose/Switch/index.d.ts.map +1 -1
- package/build/jetpack-compose/ToggleButton/index.d.ts +60 -32
- package/build/jetpack-compose/ToggleButton/index.d.ts.map +1 -1
- package/build/jetpack-compose/index.d.ts +5 -4
- package/build/jetpack-compose/index.d.ts.map +1 -1
- package/build/jetpack-compose/modifiers/animation.d.ts +44 -0
- package/build/jetpack-compose/modifiers/animation.d.ts.map +1 -0
- package/build/jetpack-compose/modifiers/index.d.ts +68 -4
- package/build/jetpack-compose/modifiers/index.d.ts.map +1 -1
- package/build/swift-ui/AccessoryWidgetBackground/index.d.ts +4 -0
- package/build/swift-ui/AccessoryWidgetBackground/index.d.ts.map +1 -0
- package/build/swift-ui/ConfirmationDialog/index.d.ts.map +1 -1
- package/build/swift-ui/ContextMenu/index.d.ts.map +1 -1
- package/build/swift-ui/ControlGroup/index.d.ts +29 -0
- package/build/swift-ui/ControlGroup/index.d.ts.map +1 -0
- package/build/swift-ui/Gauge/index.d.ts.map +1 -1
- package/build/swift-ui/Image/index.d.ts +7 -1
- package/build/swift-ui/Image/index.d.ts.map +1 -1
- package/build/swift-ui/Label/index.d.ts.map +1 -1
- package/build/swift-ui/LabeledContent/index.d.ts.map +1 -1
- package/build/swift-ui/Menu/index.d.ts.map +1 -1
- package/build/swift-ui/Picker/index.d.ts.map +1 -1
- package/build/swift-ui/Popover/index.d.ts.map +1 -1
- package/build/swift-ui/ProgressView/index.d.ts +1 -5
- package/build/swift-ui/ProgressView/index.d.ts.map +1 -1
- package/build/swift-ui/Section/index.d.ts.map +1 -1
- package/build/swift-ui/Slider/index.d.ts.map +1 -1
- package/build/swift-ui/SlotView.d.ts +5 -0
- package/build/swift-ui/SlotView.d.ts.map +1 -0
- package/build/swift-ui/Stepper/index.d.ts +3 -3
- package/build/swift-ui/Stepper/index.d.ts.map +1 -1
- package/build/swift-ui/Text/index.d.ts +33 -1
- package/build/swift-ui/Text/index.d.ts.map +1 -1
- package/build/swift-ui/index.d.ts +2 -0
- package/build/swift-ui/index.d.ts.map +1 -1
- package/build/swift-ui/modifiers/index.d.ts +54 -1
- package/build/swift-ui/modifiers/index.d.ts.map +1 -1
- package/build/swift-ui/modifiers/shapes/index.d.ts +2 -2
- package/build/swift-ui/types.d.ts +7 -0
- package/build/swift-ui/types.d.ts.map +1 -1
- package/expo-module.config.json +1 -1
- package/ios/AccessoryWidgetBackgroundView.swift +27 -0
- package/ios/BottomSheetView.swift +1 -6
- package/ios/ClosedRangeDateRecord.swift +10 -0
- package/ios/ColorPickerView.swift +9 -8
- package/ios/ConfirmationDialog/ConfirmationDialog.swift +7 -15
- package/ios/ConfirmationDialog/ConfirmationDialogProps.swift +0 -5
- package/ios/ContextMenu/ContextMenu.swift +27 -22
- package/ios/ContextMenu/ContextMenuRecords.swift +0 -6
- package/ios/ControlGroupView.swift +33 -0
- package/ios/DatePickerView.swift +7 -5
- package/ios/DisclosureGroupView.swift +5 -7
- package/ios/ExpoUIModule.swift +10 -32
- package/ios/GaugeView.swift +4 -26
- package/ios/HostView.swift +1 -2
- package/ios/ImageView.swift +22 -11
- package/ios/Label.swift +2 -17
- package/ios/LabeledContentView.swift +3 -27
- package/ios/ListView.swift +6 -14
- package/ios/Menu/MenuRecords.swift +0 -2
- package/ios/Menu/MenuView.swift +2 -5
- package/ios/Modifiers/DefaultScrollAnchorForRoleModifier.swift +32 -0
- package/ios/Modifiers/DefaultScrollAnchorModifier.swift +16 -0
- package/ios/Modifiers/ResizableModifier.swift +24 -0
- package/ios/Modifiers/Rotation3DEffectModifier.swift +20 -0
- package/ios/Modifiers/View+ModifierArray.swift +29 -0
- package/ios/Modifiers/ViewModifierRegistry.swift +37 -3
- package/ios/Modifiers/WidgetModifiers.swift +46 -0
- package/ios/Picker/PickerView.swift +8 -16
- package/ios/Popover/PopoverProps.swift +0 -4
- package/ios/Popover/PopoverView.swift +5 -11
- package/ios/ProgressView.swift +0 -5
- package/ios/RNHostView.swift +91 -10
- package/ios/SectionView.swift +9 -17
- package/ios/SecureFieldView.swift +0 -1
- package/ios/ShareLink/ShareLinkView.swift +1 -1
- package/ios/SliderView.swift +16 -31
- package/ios/SlotView.swift +38 -0
- package/ios/StepperView.swift +12 -16
- package/ios/TextFieldView.swift +0 -1
- package/ios/TextView.swift +37 -1
- package/ios/Toggle/ToggleView.swift +5 -7
- package/ios/UIBaseView.swift +34 -3
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3-sources.jar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.aar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.1/expo.modules.ui-55.0.1.module → 55.0.3/expo.modules.ui-55.0.3.module} +22 -22
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{55.0.1/expo.modules.ui-55.0.1.pom → 55.0.3/expo.modules.ui-55.0.3.pom} +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.3/expo.modules.ui-55.0.3.pom.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml +4 -4
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.md5 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha1 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha256 +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/maven-metadata.xml.sha512 +1 -1
- package/package.json +5 -2
- package/src/jetpack-compose/AnimatedVisibility/index.tsx +206 -0
- package/src/jetpack-compose/AnimatedVisibility/symbols.ts +8 -0
- package/src/jetpack-compose/Button/index.tsx +69 -92
- package/src/jetpack-compose/Card/index.tsx +105 -29
- package/src/jetpack-compose/Checkbox/index.tsx +126 -0
- package/src/jetpack-compose/Chip/index.tsx +391 -51
- package/src/jetpack-compose/DatePicker/index.tsx +215 -6
- package/src/jetpack-compose/DropdownMenu/DropdownMenuItem.tsx +126 -0
- package/src/jetpack-compose/DropdownMenu/index.tsx +107 -0
- package/src/jetpack-compose/FloatingActionButton/index.tsx +207 -0
- package/src/jetpack-compose/HorizontalFloatingToolbar/index.tsx +4 -2
- package/src/jetpack-compose/IconButton/index.tsx +49 -56
- package/src/jetpack-compose/MultiChoiceSegmentedButtonRow/index.tsx +34 -0
- package/src/jetpack-compose/Progress/index.tsx +120 -62
- package/src/jetpack-compose/RadioButton/index.tsx +8 -9
- package/src/jetpack-compose/SegmentedButton/index.tsx +109 -0
- package/src/jetpack-compose/SingleChoiceSegmentedButtonRow/index.tsx +34 -0
- package/src/jetpack-compose/Slider/index.tsx +76 -29
- package/src/jetpack-compose/Spacer/index.tsx +2 -2
- package/src/jetpack-compose/Switch/index.tsx +32 -84
- package/src/jetpack-compose/ToggleButton/index.tsx +67 -43
- package/src/jetpack-compose/index.ts +5 -4
- package/src/jetpack-compose/modifiers/animation.ts +37 -0
- package/src/jetpack-compose/modifiers/index.ts +86 -6
- package/src/swift-ui/AccessoryWidgetBackground/index.tsx +12 -0
- package/src/swift-ui/ConfirmationDialog/index.tsx +4 -12
- package/src/swift-ui/ContextMenu/index.tsx +6 -20
- package/src/swift-ui/ControlGroup/index.tsx +59 -0
- package/src/swift-ui/Gauge/index.tsx +5 -20
- package/src/swift-ui/Image/index.tsx +7 -1
- package/src/swift-ui/Label/index.tsx +2 -5
- package/src/swift-ui/LabeledContent/index.tsx +3 -12
- package/src/swift-ui/Menu/index.tsx +2 -6
- package/src/swift-ui/Picker/index.tsx +4 -11
- package/src/swift-ui/Popover/index.tsx +3 -12
- package/src/swift-ui/ProgressView/index.tsx +1 -3
- package/src/swift-ui/Section/index.tsx +4 -9
- package/src/swift-ui/Slider/index.tsx +4 -12
- package/src/swift-ui/SlotView.tsx +8 -0
- package/src/swift-ui/Stepper/index.tsx +7 -7
- package/src/swift-ui/Text/index.tsx +66 -2
- package/src/swift-ui/index.tsx +2 -0
- package/src/swift-ui/modifiers/index.ts +87 -1
- package/src/swift-ui/types.ts +5 -0
- package/android/src/main/java/expo/modules/ui/FilterChipView.kt +0 -59
- package/android/src/main/java/expo/modules/ui/PickerView.kt +0 -161
- package/android/src/main/java/expo/modules/ui/TextButtonView.kt +0 -33
- package/android/src/main/java/expo/modules/ui/menu/ContextMenu.kt +0 -183
- package/android/src/main/java/expo/modules/ui/menu/ContextMenuRecords.kt +0 -64
- package/build/jetpack-compose/Button/types.d.ts +0 -5
- package/build/jetpack-compose/Button/types.d.ts.map +0 -1
- package/build/jetpack-compose/ContextMenu/Submenu.d.ts +0 -17
- package/build/jetpack-compose/ContextMenu/Submenu.d.ts.map +0 -1
- package/build/jetpack-compose/ContextMenu/index.d.ts +0 -65
- package/build/jetpack-compose/ContextMenu/index.d.ts.map +0 -1
- package/build/jetpack-compose/ContextMenu/utils.d.ts +0 -24
- package/build/jetpack-compose/ContextMenu/utils.d.ts.map +0 -1
- package/build/jetpack-compose/FilterChip/index.d.ts +0 -49
- package/build/jetpack-compose/FilterChip/index.d.ts.map +0 -1
- package/build/jetpack-compose/Picker/index.d.ts +0 -62
- package/build/jetpack-compose/Picker/index.d.ts.map +0 -1
- package/build/jetpack-compose/TextButton/index.d.ts +0 -29
- package/build/jetpack-compose/TextButton/index.d.ts.map +0 -1
- package/ios/ConfirmationDialog/ConfirmationDialogComponents.swift +0 -26
- package/ios/ContextMenu/ContextMenuComponents.swift +0 -37
- package/ios/Menu/MenuComponents.swift +0 -12
- package/ios/Picker/PickerComponents.swift +0 -24
- package/ios/Popover/PopoverComponents.swift +0 -18
- package/ios/SectionComponents.swift +0 -34
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1-sources.jar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1-sources.jar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.aar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/55.0.1/expo.modules.ui-55.0.1.pom.sha512 +0 -1
- package/src/jetpack-compose/Button/types.ts +0 -57
- package/src/jetpack-compose/ContextMenu/Submenu.tsx +0 -21
- package/src/jetpack-compose/ContextMenu/index.tsx +0 -149
- package/src/jetpack-compose/ContextMenu/utils.ts +0 -144
- package/src/jetpack-compose/FilterChip/index.tsx +0 -89
- package/src/jetpack-compose/Picker/index.tsx +0 -90
- package/src/jetpack-compose/TextButton/index.tsx +0 -55
|
@@ -1,139 +1,116 @@
|
|
|
1
1
|
import { requireNativeView } from 'expo';
|
|
2
2
|
import { type ColorValue } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { getTextFromChildren } from '../../utils';
|
|
7
|
-
import { parseJSXShape, ShapeJSXElement, ShapeRecordProps } from '../Shape';
|
|
4
|
+
import type { ModifierConfig, ViewEvent } from '../../types';
|
|
5
|
+
import { ShapeJSXElement, ShapeRecordProps, parseJSXShape } from '../Shape';
|
|
8
6
|
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
9
7
|
|
|
10
8
|
/**
|
|
11
|
-
*
|
|
12
|
-
* - `outlined` - A button with an outline.
|
|
13
|
-
* - `elevated` - A filled button with a shadow.
|
|
9
|
+
* Colors for button elements.
|
|
14
10
|
*/
|
|
15
|
-
export type
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Colors for button's core elements.
|
|
19
|
-
*/
|
|
20
|
-
export type ButtonElementColors = {
|
|
11
|
+
export type ButtonColors = {
|
|
21
12
|
containerColor?: ColorValue;
|
|
22
13
|
contentColor?: ColorValue;
|
|
23
14
|
disabledContainerColor?: ColorValue;
|
|
24
15
|
disabledContentColor?: ColorValue;
|
|
25
16
|
};
|
|
26
17
|
|
|
18
|
+
/**
|
|
19
|
+
* Content padding for the button's inner content.
|
|
20
|
+
* All values are in density-independent pixels (dp).
|
|
21
|
+
*/
|
|
22
|
+
export type ButtonContentPadding = {
|
|
23
|
+
start?: number;
|
|
24
|
+
top?: number;
|
|
25
|
+
end?: number;
|
|
26
|
+
bottom?: number;
|
|
27
|
+
};
|
|
28
|
+
|
|
27
29
|
export type ButtonProps = {
|
|
28
30
|
/**
|
|
29
|
-
*
|
|
30
|
-
*/
|
|
31
|
-
onPress?: () => void;
|
|
32
|
-
/**
|
|
33
|
-
* A string describing the leading icon to display in the button.
|
|
34
|
-
* Uses Material Icons on Android.
|
|
35
|
-
*/
|
|
36
|
-
leadingIcon?: MaterialIcon;
|
|
37
|
-
/**
|
|
38
|
-
* A string describing the trailing icon to display in the button.
|
|
39
|
-
* Uses Material Icons on Android.
|
|
40
|
-
*/
|
|
41
|
-
trailingIcon?: MaterialIcon;
|
|
42
|
-
/**
|
|
43
|
-
* A string describing the system image to display in the button.
|
|
44
|
-
* Uses Material Icons on Android.
|
|
45
|
-
* @deprecated Use `leadingIcon` instead.
|
|
31
|
+
* Callback that is called when the button is clicked.
|
|
46
32
|
*/
|
|
47
|
-
|
|
33
|
+
onClick?: () => void;
|
|
48
34
|
/**
|
|
49
|
-
*
|
|
35
|
+
* Whether the button is enabled for user interaction.
|
|
36
|
+
* @default true
|
|
50
37
|
*/
|
|
51
|
-
|
|
38
|
+
enabled?: boolean;
|
|
52
39
|
/**
|
|
53
|
-
*
|
|
40
|
+
* Colors for button elements.
|
|
54
41
|
*/
|
|
55
|
-
|
|
42
|
+
colors?: ButtonColors;
|
|
56
43
|
/**
|
|
57
|
-
*
|
|
58
|
-
*
|
|
44
|
+
* The padding between the button container and its content.
|
|
45
|
+
* Use this to adjust internal spacing, for example when adding a leading icon
|
|
59
46
|
*/
|
|
60
|
-
|
|
47
|
+
contentPadding?: ButtonContentPadding;
|
|
61
48
|
/**
|
|
62
|
-
*
|
|
49
|
+
* The shape of the button.
|
|
63
50
|
*/
|
|
64
|
-
color?: ColorValue;
|
|
65
51
|
shape?: ShapeJSXElement;
|
|
66
52
|
/**
|
|
67
|
-
*
|
|
53
|
+
* Modifiers for the component.
|
|
68
54
|
*/
|
|
69
|
-
|
|
70
|
-
|
|
55
|
+
modifiers?: ModifierConfig[];
|
|
71
56
|
/**
|
|
72
|
-
*
|
|
57
|
+
* Content to display inside the button.
|
|
73
58
|
*/
|
|
74
|
-
|
|
59
|
+
children: React.ReactNode;
|
|
75
60
|
};
|
|
76
61
|
|
|
77
|
-
|
|
78
|
-
* @hidden
|
|
79
|
-
*/
|
|
80
|
-
export type NativeButtonProps = Omit<
|
|
81
|
-
ButtonProps,
|
|
82
|
-
'role' | 'onPress' | 'leadingIcon' | 'trailingIcon' | 'systemImage' | 'shape'
|
|
83
|
-
> & {
|
|
84
|
-
text: string;
|
|
85
|
-
leadingIcon?: string;
|
|
86
|
-
trailingIcon?: string;
|
|
62
|
+
type NativeButtonProps = Omit<ButtonProps, 'onClick' | 'shape' | 'children'> & {
|
|
87
63
|
shape?: ShapeRecordProps;
|
|
64
|
+
children?: React.ReactNode;
|
|
88
65
|
} & ViewEvent<'onButtonPressed', void>;
|
|
89
66
|
|
|
90
|
-
// We have to work around the `role` and `onPress` props being reserved by React Native.
|
|
91
|
-
const ButtonNativeView: React.ComponentType<NativeButtonProps> = requireNativeView(
|
|
92
|
-
'ExpoUI',
|
|
93
|
-
'Button'
|
|
94
|
-
);
|
|
95
|
-
|
|
96
67
|
/**
|
|
97
68
|
* @hidden
|
|
98
69
|
*/
|
|
99
|
-
export function transformButtonProps(props: ButtonProps): NativeButtonProps {
|
|
100
|
-
const {
|
|
101
|
-
children,
|
|
102
|
-
onPress,
|
|
103
|
-
leadingIcon,
|
|
104
|
-
trailingIcon,
|
|
105
|
-
systemImage,
|
|
106
|
-
shape,
|
|
107
|
-
modifiers,
|
|
108
|
-
...restProps
|
|
109
|
-
} = props;
|
|
110
|
-
|
|
111
|
-
// Handle backward compatibility: systemImage maps to leadingIcon
|
|
112
|
-
const finalLeadingIcon = leadingIcon ?? systemImage;
|
|
113
|
-
|
|
70
|
+
export function transformButtonProps(props: Omit<ButtonProps, 'children'>): NativeButtonProps {
|
|
71
|
+
const { onClick, shape, modifiers, ...restProps } = props;
|
|
114
72
|
return {
|
|
115
73
|
modifiers,
|
|
116
74
|
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
117
75
|
...restProps,
|
|
118
|
-
|
|
119
|
-
children: getTextFromChildren(children) !== undefined ? undefined : children,
|
|
120
|
-
leadingIcon: finalLeadingIcon,
|
|
76
|
+
enabled: props.enabled ?? true,
|
|
121
77
|
shape: parseJSXShape(shape),
|
|
122
|
-
|
|
123
|
-
onButtonPressed: onPress,
|
|
124
|
-
elementColors: props.elementColors
|
|
125
|
-
? props.elementColors
|
|
126
|
-
: props.color
|
|
127
|
-
? {
|
|
128
|
-
containerColor: props.color,
|
|
129
|
-
}
|
|
130
|
-
: undefined,
|
|
78
|
+
onButtonPressed: onClick ? () => onClick() : undefined,
|
|
131
79
|
};
|
|
132
80
|
}
|
|
133
81
|
|
|
82
|
+
function createButtonComponent(name: string) {
|
|
83
|
+
const NativeView: React.ComponentType<NativeButtonProps> = requireNativeView('ExpoUI', name);
|
|
84
|
+
|
|
85
|
+
function Component(props: ButtonProps) {
|
|
86
|
+
const { children, ...restProps } = props;
|
|
87
|
+
return <NativeView {...transformButtonProps(restProps)}>{children}</NativeView>;
|
|
88
|
+
}
|
|
89
|
+
Component.displayName = name;
|
|
90
|
+
return Component;
|
|
91
|
+
}
|
|
92
|
+
|
|
134
93
|
/**
|
|
135
|
-
*
|
|
94
|
+
* A filled button component.
|
|
136
95
|
*/
|
|
137
|
-
export
|
|
138
|
-
|
|
139
|
-
|
|
96
|
+
export const Button = createButtonComponent('Button');
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* A filled tonal button component.
|
|
100
|
+
*/
|
|
101
|
+
export const FilledTonalButton = createButtonComponent('FilledTonalButton');
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* An outlined button component.
|
|
105
|
+
*/
|
|
106
|
+
export const OutlinedButton = createButtonComponent('OutlinedButton');
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* An elevated button component.
|
|
110
|
+
*/
|
|
111
|
+
export const ElevatedButton = createButtonComponent('ElevatedButton');
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* A text button component.
|
|
115
|
+
*/
|
|
116
|
+
export const TextButton = createButtonComponent('TextButton');
|
|
@@ -1,62 +1,138 @@
|
|
|
1
1
|
import { requireNativeView } from 'expo';
|
|
2
2
|
import { type ColorValue } from 'react-native';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { type ModifierConfig } from '../../types';
|
|
5
5
|
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Colors for card's core elements.
|
|
9
9
|
*/
|
|
10
|
-
export type
|
|
10
|
+
export type CardColors = {
|
|
11
11
|
containerColor?: ColorValue;
|
|
12
12
|
contentColor?: ColorValue;
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
+
/**
|
|
16
|
+
* Border configuration for cards.
|
|
17
|
+
*/
|
|
18
|
+
export type CardBorder = {
|
|
19
|
+
/**
|
|
20
|
+
* Border width in dp.
|
|
21
|
+
* @default 1
|
|
22
|
+
*/
|
|
23
|
+
width?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Border color.
|
|
26
|
+
*/
|
|
27
|
+
color?: ColorValue;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
function transformProps<T extends { modifiers?: ModifierConfig[] }>(props: T): T {
|
|
31
|
+
const { modifiers, ...restProps } = props;
|
|
32
|
+
return {
|
|
33
|
+
modifiers,
|
|
34
|
+
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
35
|
+
...restProps,
|
|
36
|
+
} as T;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function createCardComponent<P extends { modifiers?: ModifierConfig[] }>(
|
|
40
|
+
viewName: string
|
|
41
|
+
): React.ComponentType<P> {
|
|
42
|
+
const NativeView: React.ComponentType<P> = requireNativeView('ExpoUI', viewName);
|
|
43
|
+
return function CardComponent(props: P) {
|
|
44
|
+
return <NativeView {...transformProps(props)} />;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// region Card
|
|
49
|
+
|
|
15
50
|
export type CardProps = {
|
|
16
51
|
/**
|
|
17
52
|
* The content to display inside the card.
|
|
18
53
|
*/
|
|
19
54
|
children?: React.ReactNode;
|
|
20
55
|
/**
|
|
21
|
-
*
|
|
22
|
-
* - 'default' - A filled card with no outline.
|
|
23
|
-
* - 'elevated' - A filled card with elevation/shadow.
|
|
24
|
-
* - 'outlined' - A card with an outline border.
|
|
25
|
-
* @default 'default'
|
|
56
|
+
* Colors for card's core elements.
|
|
26
57
|
*/
|
|
27
|
-
|
|
58
|
+
colors?: CardColors;
|
|
28
59
|
/**
|
|
29
|
-
*
|
|
60
|
+
* Default elevation in dp.
|
|
30
61
|
*/
|
|
31
|
-
|
|
62
|
+
elevation?: number;
|
|
63
|
+
/**
|
|
64
|
+
* Border configuration for the card.
|
|
65
|
+
*/
|
|
66
|
+
border?: CardBorder;
|
|
67
|
+
/**
|
|
68
|
+
* Modifiers for the component.
|
|
69
|
+
*/
|
|
70
|
+
modifiers?: ModifierConfig[];
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* A card component that renders a filled card surface for content.
|
|
75
|
+
*/
|
|
76
|
+
export const Card = createCardComponent<CardProps>('CardView');
|
|
77
|
+
|
|
78
|
+
// endregion
|
|
79
|
+
|
|
80
|
+
// region ElevatedCard
|
|
81
|
+
|
|
82
|
+
export type ElevatedCardProps = {
|
|
83
|
+
/**
|
|
84
|
+
* The content to display inside the card.
|
|
85
|
+
*/
|
|
86
|
+
children?: React.ReactNode;
|
|
32
87
|
/**
|
|
33
88
|
* Colors for card's core elements.
|
|
34
89
|
*/
|
|
35
|
-
|
|
90
|
+
colors?: CardColors;
|
|
91
|
+
/**
|
|
92
|
+
* Default elevation in dp. Material 3 default is 1dp.
|
|
93
|
+
*/
|
|
94
|
+
elevation?: number;
|
|
36
95
|
/**
|
|
37
96
|
* Modifiers for the component.
|
|
38
97
|
*/
|
|
39
|
-
modifiers?:
|
|
98
|
+
modifiers?: ModifierConfig[];
|
|
40
99
|
};
|
|
41
100
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
);
|
|
101
|
+
/**
|
|
102
|
+
* An elevated card component that provides a raised surface for content.
|
|
103
|
+
*/
|
|
104
|
+
export const ElevatedCard = createCardComponent<ElevatedCardProps>('ElevatedCardView');
|
|
47
105
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
106
|
+
// endregion
|
|
107
|
+
|
|
108
|
+
// region OutlinedCard
|
|
109
|
+
|
|
110
|
+
export type OutlinedCardProps = {
|
|
111
|
+
/**
|
|
112
|
+
* The content to display inside the card.
|
|
113
|
+
*/
|
|
114
|
+
children?: React.ReactNode;
|
|
115
|
+
/**
|
|
116
|
+
* Colors for card's core elements.
|
|
117
|
+
*/
|
|
118
|
+
colors?: CardColors;
|
|
119
|
+
/**
|
|
120
|
+
* Default elevation in dp.
|
|
121
|
+
*/
|
|
122
|
+
elevation?: number;
|
|
123
|
+
/**
|
|
124
|
+
* Border configuration for the outlined card.
|
|
125
|
+
*/
|
|
126
|
+
border?: CardBorder;
|
|
127
|
+
/**
|
|
128
|
+
* Modifiers for the component.
|
|
129
|
+
*/
|
|
130
|
+
modifiers?: ModifierConfig[];
|
|
131
|
+
};
|
|
56
132
|
|
|
57
133
|
/**
|
|
58
|
-
*
|
|
134
|
+
* An outlined card component that provides a bordered surface for content.
|
|
59
135
|
*/
|
|
60
|
-
export
|
|
61
|
-
|
|
62
|
-
|
|
136
|
+
export const OutlinedCard = createCardComponent<OutlinedCardProps>('OutlinedCardView');
|
|
137
|
+
|
|
138
|
+
// endregion
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { requireNativeView } from 'expo';
|
|
2
|
+
import { NativeSyntheticEvent, type ColorValue } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import { type ModifierConfig, ViewEvent } from '../../types';
|
|
5
|
+
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Colors for checkbox core elements.
|
|
9
|
+
*/
|
|
10
|
+
export type CheckboxColors = {
|
|
11
|
+
checkedColor?: ColorValue;
|
|
12
|
+
disabledCheckedColor?: ColorValue;
|
|
13
|
+
uncheckedColor?: ColorValue;
|
|
14
|
+
disabledUncheckedColor?: ColorValue;
|
|
15
|
+
checkmarkColor?: ColorValue;
|
|
16
|
+
disabledIndeterminateColor?: ColorValue;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export type CheckboxProps = {
|
|
20
|
+
/**
|
|
21
|
+
* Indicates whether the checkbox is checked.
|
|
22
|
+
*/
|
|
23
|
+
value: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Whether the checkbox is enabled.
|
|
26
|
+
* @default true
|
|
27
|
+
*/
|
|
28
|
+
enabled?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Callback function that is called when the checked state changes.
|
|
31
|
+
*/
|
|
32
|
+
onCheckedChange?: (value: boolean) => void;
|
|
33
|
+
/**
|
|
34
|
+
* Colors for checkbox core elements.
|
|
35
|
+
*/
|
|
36
|
+
colors?: CheckboxColors;
|
|
37
|
+
/**
|
|
38
|
+
* Modifiers for the component.
|
|
39
|
+
*/
|
|
40
|
+
modifiers?: ModifierConfig[];
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
type NativeCheckboxProps = Omit<CheckboxProps, 'onCheckedChange'> & {
|
|
44
|
+
nativeClickable: boolean;
|
|
45
|
+
onCheckedChange: (event: NativeSyntheticEvent<{ value: boolean }>) => void;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const CheckboxNativeView: React.ComponentType<NativeCheckboxProps> = requireNativeView(
|
|
49
|
+
'ExpoUI',
|
|
50
|
+
'CheckboxView'
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
function transformCheckboxProps(props: CheckboxProps): NativeCheckboxProps {
|
|
54
|
+
const { modifiers, onCheckedChange, ...restProps } = props;
|
|
55
|
+
return {
|
|
56
|
+
modifiers,
|
|
57
|
+
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
58
|
+
...restProps,
|
|
59
|
+
nativeClickable: onCheckedChange != null,
|
|
60
|
+
onCheckedChange: ({ nativeEvent: { value } }) => {
|
|
61
|
+
onCheckedChange?.(value);
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* A checkbox component.
|
|
68
|
+
*/
|
|
69
|
+
export function Checkbox(props: CheckboxProps) {
|
|
70
|
+
return <CheckboxNativeView {...transformCheckboxProps(props)} />;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The toggleable state of a tri-state checkbox.
|
|
75
|
+
*/
|
|
76
|
+
export type ToggleableState = 'on' | 'off' | 'indeterminate';
|
|
77
|
+
|
|
78
|
+
export type TriStateCheckboxProps = {
|
|
79
|
+
/**
|
|
80
|
+
* The toggleable state of the checkbox: `'on'`, `'off'`, or `'indeterminate'`.
|
|
81
|
+
*/
|
|
82
|
+
state: ToggleableState;
|
|
83
|
+
/**
|
|
84
|
+
* Whether the checkbox is enabled.
|
|
85
|
+
* @default true
|
|
86
|
+
*/
|
|
87
|
+
enabled?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Callback function that is called when the checkbox is clicked.
|
|
90
|
+
*/
|
|
91
|
+
onClick?: () => void;
|
|
92
|
+
/**
|
|
93
|
+
* Colors for checkbox core elements.
|
|
94
|
+
*/
|
|
95
|
+
colors?: CheckboxColors;
|
|
96
|
+
/**
|
|
97
|
+
* Modifiers for the component.
|
|
98
|
+
*/
|
|
99
|
+
modifiers?: ModifierConfig[];
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
type NativeTriStateCheckboxProps = Omit<TriStateCheckboxProps, 'onClick'> & {
|
|
103
|
+
nativeClickable: boolean;
|
|
104
|
+
} & ViewEvent<'onNativeClick', void>;
|
|
105
|
+
|
|
106
|
+
const TriStateCheckboxNativeView: React.ComponentType<NativeTriStateCheckboxProps> =
|
|
107
|
+
requireNativeView('ExpoUI', 'TriStateCheckboxView');
|
|
108
|
+
|
|
109
|
+
function transformTriStateCheckboxProps(props: TriStateCheckboxProps): NativeTriStateCheckboxProps {
|
|
110
|
+
const { modifiers, onClick, ...restProps } = props;
|
|
111
|
+
return {
|
|
112
|
+
modifiers,
|
|
113
|
+
...(modifiers ? createViewModifierEventListener(modifiers) : undefined),
|
|
114
|
+
...restProps,
|
|
115
|
+
nativeClickable: onClick != null,
|
|
116
|
+
onNativeClick: onClick ? () => onClick() : undefined,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* A tri-state checkbox component that supports `'on'`, `'off'`, and `'indeterminate'` states.
|
|
122
|
+
* Useful for "select all" patterns where the parent checkbox reflects the state of its children.
|
|
123
|
+
*/
|
|
124
|
+
export function TriStateCheckbox(props: TriStateCheckboxProps) {
|
|
125
|
+
return <TriStateCheckboxNativeView {...transformTriStateCheckboxProps(props)} />;
|
|
126
|
+
}
|