@expo/ui 58.0.27 → 58.0.29
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 +23 -0
- package/android/build.gradle +2 -2
- package/android/src/main/java/expo/modules/ui/ExpoUIModule.kt +9 -0
- package/android/src/main/java/expo/modules/ui/ModifierRegistry.kt +4 -0
- package/android/src/main/java/expo/modules/ui/RangeSliderView.kt +126 -0
- package/android/src/main/java/expo/modules/ui/ScrollDismissesKeyboard.kt +46 -0
- package/android/src/main/java/expo/modules/ui/SliderView.kt +31 -7
- package/android/src/main/java/expo/modules/ui/VerticalSliderView.kt +1 -8
- package/android/src/main/java/expo/modules/ui/menu/DropdownMenuPopup.kt +4 -0
- package/android/src/main/java/expo/modules/ui/menu/DropdownMenuRecords.kt +21 -0
- package/assets/check.xml +10 -0
- package/build/community/bottom-sheet/BottomSheet.ios.js +1 -0
- package/build/community/bottom-sheet/BottomSheet.ios.js.map +1 -1
- package/build/community/menu/MenuView.android.d.ts +1 -1
- package/build/community/menu/MenuView.android.js +188 -95
- package/build/community/menu/MenuView.android.js.map +1 -1
- package/build/jetpack-compose/DropdownMenu/index.d.ts +7 -0
- package/build/jetpack-compose/DropdownMenu/index.js.map +1 -1
- package/build/jetpack-compose/RangeSlider/index.d.ts +78 -0
- package/build/jetpack-compose/RangeSlider/index.js +51 -0
- package/build/jetpack-compose/RangeSlider/index.js.map +1 -0
- package/build/jetpack-compose/Slider/index.d.ts +15 -0
- package/build/jetpack-compose/Slider/index.js.map +1 -1
- package/build/jetpack-compose/index.d.ts +1 -0
- package/build/jetpack-compose/index.js +1 -0
- package/build/jetpack-compose/index.js.map +1 -1
- package/build/jetpack-compose/modifiers/index.d.ts +12 -0
- package/build/jetpack-compose/modifiers/index.js +11 -0
- package/build/jetpack-compose/modifiers/index.js.map +1 -1
- package/build/swift-ui/modifiers/index.d.ts +18 -3
- package/build/swift-ui/modifiers/index.js +18 -2
- package/build/swift-ui/modifiers/index.js.map +1 -1
- package/build/swift-ui/modifiers/symbolEffect.d.ts +49 -6
- package/build/swift-ui/modifiers/symbolEffect.js +1 -28
- package/build/swift-ui/modifiers/symbolEffect.js.map +1 -1
- package/build/swift-ui/modifiers/symbolEffectOptions.d.ts +22 -0
- package/build/swift-ui/modifiers/symbolEffectOptions.js +30 -0
- package/build/swift-ui/modifiers/symbolEffectOptions.js.map +1 -0
- package/build/universal/Picker/Picker.android.d.ts +1 -1
- package/build/universal/Picker/Picker.android.js +8 -3
- package/build/universal/Picker/Picker.android.js.map +1 -1
- package/build/universal/Picker/Picker.d.ts +1 -1
- package/build/universal/Picker/Picker.ios.d.ts +1 -1
- package/build/universal/Picker/Picker.ios.js +5 -2
- package/build/universal/Picker/Picker.ios.js.map +1 -1
- package/build/universal/Picker/Picker.js +2 -1
- package/build/universal/Picker/Picker.js.map +1 -1
- package/build/universal/Picker/types.d.ts +4 -0
- package/build/universal/Picker/types.js.map +1 -1
- package/ios/HostView.swift +0 -1
- package/ios/Modifiers/ContentTransitionModifier.swift +49 -0
- package/ios/RNHostView.swift +55 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.27/expo.modules.ui-58.0.27-sources.jar → 58.0.29/expo.modules.ui-58.0.29-sources.jar} +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.29/expo.modules.ui-58.0.29-sources.jar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.29/expo.modules.ui-58.0.29-sources.jar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.29/expo.modules.ui-58.0.29-sources.jar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.29/expo.modules.ui-58.0.29-sources.jar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.29/expo.modules.ui-58.0.29.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.29/expo.modules.ui-58.0.29.aar.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.29/expo.modules.ui-58.0.29.aar.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.29/expo.modules.ui-58.0.29.aar.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.29/expo.modules.ui-58.0.29.aar.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.27/expo.modules.ui-58.0.27.module → 58.0.29/expo.modules.ui-58.0.29.module} +22 -22
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.29/expo.modules.ui-58.0.29.module.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.29/expo.modules.ui-58.0.29.module.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.29/expo.modules.ui-58.0.29.module.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.29/expo.modules.ui-58.0.29.module.sha512 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/{58.0.27/expo.modules.ui-58.0.27.pom → 58.0.29/expo.modules.ui-58.0.29.pom} +1 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.29/expo.modules.ui-58.0.29.pom.md5 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.29/expo.modules.ui-58.0.29.pom.sha1 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.29/expo.modules.ui-58.0.29.pom.sha256 +1 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.29/expo.modules.ui-58.0.29.pom.sha512 +1 -0
- package/package.json +1 -1
- package/src/community/bottom-sheet/BottomSheet.ios.tsx +5 -2
- package/src/community/menu/MenuView.android.tsx +193 -107
- package/src/jetpack-compose/DropdownMenu/index.tsx +9 -0
- package/src/jetpack-compose/RangeSlider/index.tsx +125 -0
- package/src/jetpack-compose/Slider/index.tsx +15 -0
- package/src/jetpack-compose/index.ts +1 -0
- package/src/jetpack-compose/modifiers/index.ts +13 -0
- package/src/swift-ui/modifiers/index.ts +28 -4
- package/src/swift-ui/modifiers/symbolEffect.ts +53 -27
- package/src/swift-ui/modifiers/symbolEffectOptions.ts +22 -0
- package/src/universal/Picker/Picker.android.tsx +9 -2
- package/src/universal/Picker/Picker.ios.tsx +5 -0
- package/src/universal/Picker/Picker.tsx +2 -0
- package/src/universal/Picker/types.ts +5 -0
- package/ios/Modifiers/HostViewContentMarginsMitigation.swift +0 -98
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.27/expo.modules.ui-58.0.27-sources.jar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.27/expo.modules.ui-58.0.27-sources.jar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.27/expo.modules.ui-58.0.27-sources.jar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.27/expo.modules.ui-58.0.27-sources.jar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.27/expo.modules.ui-58.0.27.aar +0 -0
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.27/expo.modules.ui-58.0.27.aar.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.27/expo.modules.ui-58.0.27.aar.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.27/expo.modules.ui-58.0.27.aar.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.27/expo.modules.ui-58.0.27.aar.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.27/expo.modules.ui-58.0.27.module.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.27/expo.modules.ui-58.0.27.module.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.27/expo.modules.ui-58.0.27.module.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.27/expo.modules.ui-58.0.27.module.sha512 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.27/expo.modules.ui-58.0.27.pom.md5 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.27/expo.modules.ui-58.0.27.pom.sha1 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.27/expo.modules.ui-58.0.27.pom.sha256 +0 -1
- package/local-maven-repo/expo/modules/ui/expo.modules.ui/58.0.27/expo.modules.ui-58.0.27.pom.sha512 +0 -1
|
@@ -1,18 +1,25 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { Pressable, View } from 'react-native';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { Box } from '../../jetpack-compose/Box';
|
|
5
|
+
import { DropdownMenuGroup, DropdownMenuPopup, SelectableDropdownMenuItem } from '../../jetpack-compose/DropdownMenu';
|
|
6
6
|
import { DropdownMenuItem } from '../../jetpack-compose/DropdownMenu/DropdownMenuItem';
|
|
7
7
|
import { Host } from '../../jetpack-compose/Host';
|
|
8
8
|
import { Icon } from '../../jetpack-compose/Icon';
|
|
9
9
|
import { RNHostView } from '../../jetpack-compose/RNHostView';
|
|
10
|
+
import { Spacer } from '../../jetpack-compose/Spacer';
|
|
10
11
|
import { Text as ComposeText } from '../../jetpack-compose/Text';
|
|
11
12
|
import { useMaterialColors } from '../../jetpack-compose/colors';
|
|
13
|
+
import { height, verticalScroll } from '../../jetpack-compose/modifiers';
|
|
12
14
|
// Clipped popups drop the status bar offset, so edge-to-edge menus near the bottom detach from the anchor.
|
|
13
15
|
const POPUP_PROPERTIES = {
|
|
14
16
|
clippingEnabled: false
|
|
15
17
|
};
|
|
18
|
+
const CHECK_ICON = require('../../../assets/check.xml');
|
|
19
|
+
// Compose's `MenuDefaults.GroupSpacing`.
|
|
20
|
+
const MENU_GROUP_SPACING = 2;
|
|
21
|
+
// Compose's `MenuDefaults.LeadingIconSize`.
|
|
22
|
+
const MENU_ITEM_ICON_SIZE = 20;
|
|
16
23
|
function actionId(action) {
|
|
17
24
|
return action.id ?? action.title;
|
|
18
25
|
}
|
|
@@ -40,95 +47,179 @@ function buildElementColors(action, destructiveColor) {
|
|
|
40
47
|
disabledLeadingIconColor: leadingIconColor
|
|
41
48
|
};
|
|
42
49
|
}
|
|
43
|
-
function
|
|
44
|
-
const
|
|
45
|
-
if (
|
|
46
|
-
return
|
|
50
|
+
function buildSelectableColors(action, destructiveColor) {
|
|
51
|
+
const colors = buildElementColors(action, destructiveColor);
|
|
52
|
+
if (colors == null) {
|
|
53
|
+
return undefined;
|
|
47
54
|
}
|
|
48
|
-
|
|
55
|
+
// A selected item keeps the destructive or custom colors instead of the selected-state colors.
|
|
56
|
+
return {
|
|
57
|
+
...colors,
|
|
58
|
+
selectedTextColor: colors.textColor,
|
|
59
|
+
selectedLeadingIconColor: colors.leadingIconColor
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Splits actions into the groups of a Material 3 Expressive menu. A `displayInline` action
|
|
64
|
+
* becomes a group of its own. Other actions that follow each other share a group.
|
|
65
|
+
*/ function groupActions(actions, keyPrefix = '') {
|
|
66
|
+
const groups = [];
|
|
67
|
+
let run = [];
|
|
68
|
+
// The key of a run of actions comes from the inline action before it, not from its first action.
|
|
69
|
+
// So the group does not remount, and an open submenu in it does not close, when an action hides.
|
|
70
|
+
let runKey = `${keyPrefix}^`;
|
|
71
|
+
for (const action of actions){
|
|
72
|
+
if (action.attributes?.hidden) {
|
|
73
|
+
continue;
|
|
74
|
+
}
|
|
75
|
+
if (action.displayInline && action.subactions && action.subactions.length > 0) {
|
|
76
|
+
if (run.length > 0) {
|
|
77
|
+
groups.push({
|
|
78
|
+
key: runKey,
|
|
79
|
+
actions: run
|
|
80
|
+
});
|
|
81
|
+
run = [];
|
|
82
|
+
}
|
|
83
|
+
const sectionKey = `${keyPrefix}${actionId(action)}`;
|
|
84
|
+
groups.push(...groupActions(action.subactions, `${sectionKey}/`));
|
|
85
|
+
runKey = `${sectionKey}$`;
|
|
86
|
+
} else {
|
|
87
|
+
run.push(action);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
if (run.length > 0) {
|
|
91
|
+
groups.push({
|
|
92
|
+
key: runKey,
|
|
93
|
+
actions: run
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
return groups;
|
|
97
|
+
}
|
|
98
|
+
function MenuGroups({ actions, ...handlers }) {
|
|
99
|
+
const groups = groupActions(actions);
|
|
100
|
+
return groups.map((group, groupIndex)=>/*#__PURE__*/ _jsxs(React.Fragment, {
|
|
101
|
+
children: [
|
|
102
|
+
groupIndex > 0 && /*#__PURE__*/ _jsx(Spacer, {
|
|
103
|
+
modifiers: [
|
|
104
|
+
height(MENU_GROUP_SPACING)
|
|
105
|
+
]
|
|
106
|
+
}),
|
|
107
|
+
/*#__PURE__*/ _jsx(DropdownMenuGroup, {
|
|
108
|
+
shapes: {
|
|
109
|
+
index: groupIndex,
|
|
110
|
+
count: groups.length
|
|
111
|
+
},
|
|
112
|
+
children: group.actions.map((action, index)=>/*#__PURE__*/ _jsx(MenuActionItem, {
|
|
113
|
+
action: action,
|
|
114
|
+
shape: {
|
|
115
|
+
index,
|
|
116
|
+
count: group.actions.length
|
|
117
|
+
},
|
|
118
|
+
...handlers
|
|
119
|
+
}, actionId(action)))
|
|
120
|
+
})
|
|
121
|
+
]
|
|
122
|
+
}, group.key));
|
|
123
|
+
}
|
|
124
|
+
function MenuActionItem({ action, shape, onPressAction, dismissAll, destructiveColor }) {
|
|
125
|
+
const [submenuExpanded, setSubmenuExpanded] = React.useState(false);
|
|
126
|
+
const { subactions, state, attributes, title, image, imageColor } = action;
|
|
49
127
|
// `image` is non-string only when caller passes an ImageSourcePropType
|
|
50
128
|
// (number from `require()` or `{ uri }`). The string form is iOS-only (SF Symbol).
|
|
51
129
|
const leadingIconSource = typeof image === 'string' || image == null ? null : image;
|
|
52
130
|
const elementColors = buildElementColors(action, destructiveColor);
|
|
131
|
+
const leadingIcon = leadingIconSource && /*#__PURE__*/ _jsx(Icon, {
|
|
132
|
+
source: leadingIconSource,
|
|
133
|
+
size: MENU_ITEM_ICON_SIZE,
|
|
134
|
+
tint: imageColor
|
|
135
|
+
});
|
|
53
136
|
if (subactions && subactions.length > 0) {
|
|
54
|
-
|
|
55
|
-
return /*#__PURE__*/ _jsxs(_Fragment, {
|
|
56
|
-
children: [
|
|
57
|
-
/*#__PURE__*/ _jsx(HorizontalDivider, {}),
|
|
58
|
-
subactions.map((sub)=>/*#__PURE__*/ _jsx(MenuActionItem, {
|
|
59
|
-
action: sub,
|
|
60
|
-
onPressAction: onPressAction,
|
|
61
|
-
dismissAll: dismissAll,
|
|
62
|
-
destructiveColor: destructiveColor
|
|
63
|
-
}, actionId(sub))),
|
|
64
|
-
/*#__PURE__*/ _jsx(HorizontalDivider, {})
|
|
65
|
-
]
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
return /*#__PURE__*/ _jsxs(DropdownMenu, {
|
|
69
|
-
expanded: submenuExpanded,
|
|
70
|
-
onDismissRequest: ()=>setSubmenuExpanded(false),
|
|
71
|
-
properties: POPUP_PROPERTIES,
|
|
137
|
+
return /*#__PURE__*/ _jsxs(Box, {
|
|
72
138
|
children: [
|
|
73
|
-
/*#__PURE__*/
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
})
|
|
83
|
-
}),
|
|
84
|
-
leadingIconSource && /*#__PURE__*/ _jsx(DropdownMenuItem.LeadingIcon, {
|
|
85
|
-
children: /*#__PURE__*/ _jsx(Icon, {
|
|
86
|
-
source: leadingIconSource,
|
|
87
|
-
size: 24,
|
|
88
|
-
tint: imageColor
|
|
89
|
-
})
|
|
139
|
+
/*#__PURE__*/ _jsxs(DropdownMenuItem, {
|
|
140
|
+
enabled: !attributes?.disabled,
|
|
141
|
+
shape: shape,
|
|
142
|
+
elementColors: elementColors,
|
|
143
|
+
onClick: ()=>setSubmenuExpanded(true),
|
|
144
|
+
children: [
|
|
145
|
+
/*#__PURE__*/ _jsx(DropdownMenuItem.Text, {
|
|
146
|
+
children: /*#__PURE__*/ _jsx(ComposeText, {
|
|
147
|
+
children: title
|
|
90
148
|
})
|
|
91
|
-
|
|
149
|
+
}),
|
|
150
|
+
leadingIcon && /*#__PURE__*/ _jsx(DropdownMenuItem.LeadingIcon, {
|
|
151
|
+
children: leadingIcon
|
|
152
|
+
})
|
|
153
|
+
]
|
|
154
|
+
}),
|
|
155
|
+
/*#__PURE__*/ _jsx(DropdownMenuPopup, {
|
|
156
|
+
expanded: submenuExpanded,
|
|
157
|
+
onDismissRequest: ()=>setSubmenuExpanded(false),
|
|
158
|
+
anchorPosition: "end",
|
|
159
|
+
properties: POPUP_PROPERTIES,
|
|
160
|
+
// Unlike `DropdownMenu`, `DropdownMenuPopup` does not scroll a menu taller than the window.
|
|
161
|
+
modifiers: [
|
|
162
|
+
verticalScroll()
|
|
163
|
+
],
|
|
164
|
+
children: /*#__PURE__*/ _jsx(MenuGroups, {
|
|
165
|
+
actions: subactions,
|
|
166
|
+
onPressAction: onPressAction,
|
|
167
|
+
dismissAll: ()=>{
|
|
168
|
+
setSubmenuExpanded(false);
|
|
169
|
+
dismissAll();
|
|
170
|
+
},
|
|
171
|
+
destructiveColor: destructiveColor
|
|
172
|
+
})
|
|
173
|
+
})
|
|
174
|
+
]
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
const onClick = ()=>{
|
|
178
|
+
onPressAction?.(makeEvent(action));
|
|
179
|
+
dismissAll();
|
|
180
|
+
};
|
|
181
|
+
// An action with a `state` is a choice. Compose gives a selected choice a highlighted container
|
|
182
|
+
// and `SelectedLeadingIcon`, which replaces the leading icon while the item is selected, and
|
|
183
|
+
// exposes the selected state to screen readers.
|
|
184
|
+
if (state != null) {
|
|
185
|
+
const colors = buildSelectableColors(action, destructiveColor);
|
|
186
|
+
return /*#__PURE__*/ _jsxs(SelectableDropdownMenuItem, {
|
|
187
|
+
selected: state === 'on',
|
|
188
|
+
enabled: !attributes?.disabled,
|
|
189
|
+
shapes: shape,
|
|
190
|
+
colors: colors,
|
|
191
|
+
onClick: onClick,
|
|
192
|
+
children: [
|
|
193
|
+
/*#__PURE__*/ _jsx(SelectableDropdownMenuItem.Text, {
|
|
194
|
+
children: /*#__PURE__*/ _jsx(ComposeText, {
|
|
195
|
+
children: title
|
|
92
196
|
})
|
|
93
197
|
}),
|
|
94
|
-
/*#__PURE__*/ _jsx(
|
|
95
|
-
children:
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
destructiveColor: destructiveColor
|
|
103
|
-
}, actionId(sub)))
|
|
198
|
+
leadingIcon && /*#__PURE__*/ _jsx(SelectableDropdownMenuItem.LeadingIcon, {
|
|
199
|
+
children: leadingIcon
|
|
200
|
+
}),
|
|
201
|
+
/*#__PURE__*/ _jsx(SelectableDropdownMenuItem.SelectedLeadingIcon, {
|
|
202
|
+
children: /*#__PURE__*/ _jsx(Icon, {
|
|
203
|
+
source: CHECK_ICON,
|
|
204
|
+
size: MENU_ITEM_ICON_SIZE
|
|
205
|
+
})
|
|
104
206
|
})
|
|
105
207
|
]
|
|
106
208
|
});
|
|
107
209
|
}
|
|
108
210
|
return /*#__PURE__*/ _jsxs(DropdownMenuItem, {
|
|
109
211
|
enabled: !attributes?.disabled,
|
|
212
|
+
shape: shape,
|
|
110
213
|
elementColors: elementColors,
|
|
111
|
-
onClick:
|
|
112
|
-
onPressAction?.(makeEvent(action));
|
|
113
|
-
dismissAll();
|
|
114
|
-
},
|
|
214
|
+
onClick: onClick,
|
|
115
215
|
children: [
|
|
116
216
|
/*#__PURE__*/ _jsx(DropdownMenuItem.Text, {
|
|
117
217
|
children: /*#__PURE__*/ _jsx(ComposeText, {
|
|
118
218
|
children: title
|
|
119
219
|
})
|
|
120
220
|
}),
|
|
121
|
-
|
|
122
|
-
children:
|
|
123
|
-
source: leadingIconSource,
|
|
124
|
-
size: 24,
|
|
125
|
-
tint: imageColor
|
|
126
|
-
})
|
|
127
|
-
}),
|
|
128
|
-
state === 'on' && /*#__PURE__*/ _jsx(DropdownMenuItem.TrailingIcon, {
|
|
129
|
-
children: /*#__PURE__*/ _jsx(ComposeText, {
|
|
130
|
-
children: "✓"
|
|
131
|
-
})
|
|
221
|
+
leadingIcon && /*#__PURE__*/ _jsx(DropdownMenuItem.LeadingIcon, {
|
|
222
|
+
children: leadingIcon
|
|
132
223
|
})
|
|
133
224
|
]
|
|
134
225
|
});
|
|
@@ -136,7 +227,7 @@ function MenuActionItem({ action, onPressAction, dismissAll, destructiveColor })
|
|
|
136
227
|
/**
|
|
137
228
|
* A drop-in replacement for `@react-native-menu/menu` on Android.
|
|
138
229
|
* Wraps the trigger in a `Pressable` (whose `onPress`/`onLongPress` opens the menu) and
|
|
139
|
-
* renders the actions tree as a controlled Material `
|
|
230
|
+
* renders the actions tree as a controlled Material 3 Expressive `DropdownMenuPopup`.
|
|
140
231
|
*
|
|
141
232
|
* Note: when `action.image` is a string, it is treated as an iOS SF Symbol and ignored
|
|
142
233
|
* on Android — pass an `ImageSourcePropType` (e.g. `require('./icon.xml')`) to render
|
|
@@ -177,34 +268,36 @@ function MenuActionItem({ action, onPressAction, dismissAll, destructiveColor })
|
|
|
177
268
|
children: /*#__PURE__*/ _jsx(Host, {
|
|
178
269
|
colorScheme: colorScheme,
|
|
179
270
|
matchContents: true,
|
|
180
|
-
children: /*#__PURE__*/ _jsxs(
|
|
181
|
-
expanded: expanded,
|
|
182
|
-
onDismissRequest: dismissAll,
|
|
183
|
-
properties: POPUP_PROPERTIES,
|
|
271
|
+
children: /*#__PURE__*/ _jsxs(Box, {
|
|
184
272
|
children: [
|
|
185
|
-
/*#__PURE__*/ _jsx(
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
children: children
|
|
198
|
-
})
|
|
273
|
+
/*#__PURE__*/ _jsx(RNHostView, {
|
|
274
|
+
matchContents: true,
|
|
275
|
+
children: /*#__PURE__*/ _jsx(Pressable, {
|
|
276
|
+
onPress: shouldOpenOnLongPress ? undefined : open,
|
|
277
|
+
onLongPress: shouldOpenOnLongPress ? open : undefined,
|
|
278
|
+
// Mirror upstream `@react-native-menu/menu`, which intercepts touches
|
|
279
|
+
// natively on a bare `ReactViewGroup`: no click sound, no focus
|
|
280
|
+
// highlight, no extra a11y node — children declare their own role.
|
|
281
|
+
android_disableSound: true,
|
|
282
|
+
focusable: false,
|
|
283
|
+
accessible: false,
|
|
284
|
+
children: children
|
|
199
285
|
})
|
|
200
286
|
}),
|
|
201
|
-
/*#__PURE__*/ _jsx(
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
287
|
+
/*#__PURE__*/ _jsx(DropdownMenuPopup, {
|
|
288
|
+
expanded: expanded,
|
|
289
|
+
onDismissRequest: dismissAll,
|
|
290
|
+
properties: POPUP_PROPERTIES,
|
|
291
|
+
// Unlike `DropdownMenu`, `DropdownMenuPopup` does not scroll a menu taller than the window.
|
|
292
|
+
modifiers: [
|
|
293
|
+
verticalScroll()
|
|
294
|
+
],
|
|
295
|
+
children: /*#__PURE__*/ _jsx(MenuGroups, {
|
|
296
|
+
actions: actions,
|
|
297
|
+
onPressAction: onPressAction,
|
|
298
|
+
dismissAll: dismissAll,
|
|
299
|
+
destructiveColor: destructiveColor
|
|
300
|
+
})
|
|
208
301
|
})
|
|
209
302
|
]
|
|
210
303
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["community/menu/MenuView.android.tsx"],"sourcesContent":[null],"names":["React","Pressable","View","
|
|
1
|
+
{"version":3,"sources":["community/menu/MenuView.android.tsx"],"sourcesContent":[null],"names":["React","Pressable","View","Box","DropdownMenuGroup","DropdownMenuPopup","SelectableDropdownMenuItem","DropdownMenuItem","Host","Icon","RNHostView","Spacer","Text","ComposeText","useMaterialColors","height","verticalScroll","POPUP_PROPERTIES","clippingEnabled","CHECK_ICON","require","MENU_GROUP_SPACING","MENU_ITEM_ICON_SIZE","actionId","action","id","title","makeEvent","nativeEvent","event","buildElementColors","destructiveColor","isDestructive","attributes","destructive","textColor","titleColor","undefined","leadingIconColor","disabledTextColor","disabledLeadingIconColor","buildSelectableColors","colors","selectedTextColor","selectedLeadingIconColor","groupActions","actions","keyPrefix","groups","run","runKey","hidden","displayInline","subactions","length","push","key","sectionKey","MenuGroups","handlers","map","group","groupIndex","Fragment","modifiers","shapes","index","count","MenuActionItem","shape","onPressAction","dismissAll","submenuExpanded","setSubmenuExpanded","useState","state","image","imageColor","leadingIconSource","elementColors","leadingIcon","source","size","tint","enabled","disabled","onClick","LeadingIcon","expanded","onDismissRequest","anchorPosition","properties","selected","SelectedLeadingIcon","MenuView","props","ref","colorScheme","onOpenMenu","onCloseMenu","shouldOpenOnLongPress","style","children","testID","setExpanded","expandedRef","useRef","open","useCallback","current","useImperativeHandle","show","error","matchContents","onPress","onLongPress","android_disableSound","focusable","accessible"],"mappings":";AAAA,YAAYA,WAAW,QAAQ;AAC/B,SAASC,SAAS,EAAEC,IAAI,QAAQ,eAAe;AAE/C,SAASC,GAAG,QAAQ,4BAA4B;AAChD,SACEC,iBAAiB,EACjBC,iBAAiB,EACjBC,0BAA0B,QAGrB,qCAAqC;AAC5C,SACEC,gBAAgB,QAEX,sDAAsD;AAC7D,SAASC,IAAI,QAAQ,6BAA6B;AAClD,SAASC,IA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;QACtBL,YAAY;QACZL;IACF,GAAG;QAACA;KAAY;IAEhBnG,MAAM8G,mBAAmB,CAACd,KAAK,IAAO,CAAA;YAAEe,MAAMJ;QAAK,CAAA,GAAI;QAACA;KAAK;IAE7D,MAAM5E,mBAAmBjB,oBAAoBkG,KAAK;IAElD,qBACE,KAAC9G;QAAKmG,OAAOA;QAAOE,QAAQA;kBAC1B,cAAA,KAAC/F;YAAKyF,aAAaA;YAAagB,aAAa;sBAC3C,cAAA,MAAC9G;;kCACC,KAACO;wBAAWuG,aAAa;kCACvB,cAAA,KAAChH;4BACCiH,SAASd,wBAAwB/D,YAAYsE;4BAC7CQ,aAAaf,wBAAwBO,OAAOtE;4BAC5C,sEAAsE;4BACtE,gEAAgE;4BAChE,mEAAmE;4BACnE+E,oBAAoB;4BACpBC,WAAW;4BACXC,YAAY;sCACXhB;;;kCAGL,KAACjG;wBACCmF,UAAUA;wBACVC,kBAAkBlB;wBAClBoB,YAAY1E;wBACZ,4FAA4F;wBAC5F+C,WAAW;4BAAChD;yBAAiB;kCAC7B,cAAA,KAAC0C;4BACCZ,SAASA;4BACTwB,eAAeA;4BACfC,YAAYA;4BACZxC,kBAAkBA;;;;;;;AAOhC"}
|
|
@@ -84,6 +84,13 @@ export interface DropdownMenuPopupProps {
|
|
|
84
84
|
* Must be provided when `expanded` is `true` to allow the menu to close.
|
|
85
85
|
*/
|
|
86
86
|
onDismissRequest?: () => void;
|
|
87
|
+
/**
|
|
88
|
+
* The side of the anchor where the menu opens, through Compose's `MenuAnchorPosition`. When
|
|
89
|
+
* there is not sufficient space on that side, Compose moves the menu to a different side. Use
|
|
90
|
+
* `'end'` for a submenu that opens next to its item.
|
|
91
|
+
* @default 'below'
|
|
92
|
+
*/
|
|
93
|
+
anchorPosition?: 'below' | 'above' | 'start' | 'end' | 'left' | 'right';
|
|
87
94
|
/**
|
|
88
95
|
* Properties for the popup window of the menu.
|
|
89
96
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["jetpack-compose/DropdownMenu/index.tsx"],"sourcesContent":[null],"names":["requireNativeView","PresentedContent","createViewModifierEventListener","MenuNativeView","MenuPopupNativeView","MenuGroupNativeView","SlotNativeView","Items","props","slotName","children","tag","Trigger","Preview","DropdownMenu","modifiers","restProps","style","undefined","DropdownMenuPopup","DropdownMenuGroup","DropdownMenuItem","SelectableDropdownMenuItem"],"mappings":";AAAA,SAASA,iBAAiB,QAAQ,OAAO;AAIzC,SAASC,gBAAgB,QAAQ,gCAAgC;AAEjE,SAASC,+BAA+B,QAAQ,qBAAqB;AAErE,MAAMC,iBAAuDH,kBAC3D,UACA;AAGF,MAAMI,sBAAiEJ,kBACrE,UACA;AAGF,MAAMK,sBAAmEL,kBACvE,UACA;AAGF,2DAA2D;AAC3D,MAAMM,iBAGDN,kBAAkB,UAAU;
|
|
1
|
+
{"version":3,"sources":["jetpack-compose/DropdownMenu/index.tsx"],"sourcesContent":[null],"names":["requireNativeView","PresentedContent","createViewModifierEventListener","MenuNativeView","MenuPopupNativeView","MenuGroupNativeView","SlotNativeView","Items","props","slotName","children","tag","Trigger","Preview","DropdownMenu","modifiers","restProps","style","undefined","DropdownMenuPopup","DropdownMenuGroup","DropdownMenuItem","SelectableDropdownMenuItem"],"mappings":";AAAA,SAASA,iBAAiB,QAAQ,OAAO;AAIzC,SAASC,gBAAgB,QAAQ,gCAAgC;AAEjE,SAASC,+BAA+B,QAAQ,qBAAqB;AAErE,MAAMC,iBAAuDH,kBAC3D,UACA;AAGF,MAAMI,sBAAiEJ,kBACrE,UACA;AAGF,MAAMK,sBAAmEL,kBACvE,UACA;AAGF,2DAA2D;AAC3D,MAAMM,iBAGDN,kBAAkB,UAAU;AAgLjC;;;CAGC,GACD,OAAO,SAASO,MAAMC,KAA8B;IAClD,oGAAoG;IACpG,qBACE,KAACF;QAAeG,UAAS;kBACvB,cAAA,KAACR;sBAAkBO,MAAME,QAAQ;;;AAGvC;AACAH,MAAMI,GAAG,GAAG;AAEZ;;CAEC,GACD,OAAO,SAASC,QAAQJ,KAA8B;IACpD,qBAAO;kBAAGA,MAAME,QAAQ;;AAC1B;AACAE,QAAQD,GAAG,GAAG;AAEd;;CAEC,GACD,OAAO,SAASE,QAAQL,KAA8B;IACpD,qBAAO;AACT;AAEA,SAASM,aAAaN,KAAwB;IAC5C,MAAM,EAAEO,SAAS,EAAE,GAAGC,WAAW,GAAGR;IACpC,qBACE,KAACL;QACCc,OAAOT,MAAMS,KAAK;QAClBF,WAAWA;QACV,GAAIA,YAAYb,gCAAgCa,aAAaG,SAAS;QACtE,GAAGF,SAAS;kBACZR,MAAME,QAAQ;;AAGrB;AAEAI,aAAaF,OAAO,GAAGA;AACvBE,aAAaD,OAAO,GAAGA;AACvBC,aAAaP,KAAK,GAAGA;AAErB,SAASO,YAAY,GAAG;AAExB;;;;;;CAMC,GACD,OAAO,SAASK,kBAAkBX,KAA6B;IAC7D,MAAM,EAAEO,SAAS,EAAEL,QAAQ,EAAE,GAAGM,WAAW,GAAGR;IAC9C,qBACE,KAACJ;QACCW,WAAWA;QACV,GAAIA,YAAYb,gCAAgCa,aAAaG,SAAS;QACtE,GAAGF,SAAS;kBAEb,cAAA,KAACf;sBAAkBS;;;AAGzB;AAEA;;;;;CAKC,GACD,OAAO,SAASU,kBAAkBZ,KAA6B;IAC7D,MAAM,EAAEO,SAAS,EAAE,GAAGC,WAAW,GAAGR;IACpC,qBACE,KAACH;QACCU,WAAWA;QACV,GAAIA,YAAYb,gCAAgCa,aAAaG,SAAS;QACtE,GAAGF,SAAS;;AAGnB;AAEA,SAASK,gBAAgB,QAAQ,qBAAqB;AAEtD,SAASC,0BAA0B,QAAQ,+BAA+B"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { ModifierConfig } from '../../types';
|
|
2
|
+
import type { SliderColors } from '../Slider';
|
|
3
|
+
export type { SliderColors };
|
|
4
|
+
/**
|
|
5
|
+
* An inclusive numeric range for `RangeSlider`.
|
|
6
|
+
*/
|
|
7
|
+
export type RangeSliderRange = {
|
|
8
|
+
/** The start of the range. */
|
|
9
|
+
start: number;
|
|
10
|
+
/** The end of the range, included in the selection. */
|
|
11
|
+
endInclusive: number;
|
|
12
|
+
};
|
|
13
|
+
export interface RangeSliderProps {
|
|
14
|
+
/**
|
|
15
|
+
* The selected start value. Changing this prop updates the native selection when the user is not dragging.
|
|
16
|
+
* @default 0
|
|
17
|
+
*/
|
|
18
|
+
startValue?: number;
|
|
19
|
+
/**
|
|
20
|
+
* The selected end value. Changing this prop updates the native selection when the user is not dragging.
|
|
21
|
+
* @default 1
|
|
22
|
+
*/
|
|
23
|
+
endValue?: number;
|
|
24
|
+
/**
|
|
25
|
+
* The bounds of the entire track. The slider clamps values outside these bounds.
|
|
26
|
+
* @default \{ start: 0, endInclusive: 1 \}
|
|
27
|
+
*/
|
|
28
|
+
trackRange?: RangeSliderRange;
|
|
29
|
+
/**
|
|
30
|
+
* The number of selectable positions between the track bounds.
|
|
31
|
+
* Must be a nonnegative integer. `0` means continuous selection.
|
|
32
|
+
* @default 0
|
|
33
|
+
*/
|
|
34
|
+
steps?: number;
|
|
35
|
+
/**
|
|
36
|
+
* Whether the slider responds to user interaction.
|
|
37
|
+
* @default true
|
|
38
|
+
*/
|
|
39
|
+
enabled?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Colors for the thumbs, track, and tick marks. Omitted colors use the Material theme.
|
|
42
|
+
*/
|
|
43
|
+
colors?: SliderColors;
|
|
44
|
+
/**
|
|
45
|
+
* Called with both endpoints when the user changes the selection.
|
|
46
|
+
*/
|
|
47
|
+
onValueChange?: (range: RangeSliderRange) => void;
|
|
48
|
+
/**
|
|
49
|
+
* Called when the user finishes changing the selection.
|
|
50
|
+
* It has no value argument. `onValueChange` reports the selection.
|
|
51
|
+
*/
|
|
52
|
+
onValueChangeFinished?: () => void;
|
|
53
|
+
/**
|
|
54
|
+
* Modifiers for the component.
|
|
55
|
+
*/
|
|
56
|
+
modifiers?: ModifierConfig[];
|
|
57
|
+
/**
|
|
58
|
+
* Custom content wrapped in `RangeSlider.StartThumb`, `RangeSlider.EndThumb`, or `RangeSlider.Track`.
|
|
59
|
+
*/
|
|
60
|
+
children?: React.ReactNode;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* A Material 3 slider for selecting two values on a bounded track.
|
|
64
|
+
* It works only inside a `Host` component.
|
|
65
|
+
* @platform android
|
|
66
|
+
*/
|
|
67
|
+
export declare function RangeSlider(props: RangeSliderProps): import("react").JSX.Element;
|
|
68
|
+
export declare namespace RangeSlider {
|
|
69
|
+
var StartThumb: (props: {
|
|
70
|
+
children: React.ReactNode;
|
|
71
|
+
}) => import("react").JSX.Element;
|
|
72
|
+
var EndThumb: (props: {
|
|
73
|
+
children: React.ReactNode;
|
|
74
|
+
}) => import("react").JSX.Element;
|
|
75
|
+
var Track: (props: {
|
|
76
|
+
children: React.ReactNode;
|
|
77
|
+
}) => import("react").JSX.Element;
|
|
78
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { requireNativeView } from 'expo';
|
|
3
|
+
import { createViewModifierEventListener } from '../modifiers/utils';
|
|
4
|
+
const RangeSliderNativeView = requireNativeView('ExpoUI', 'RangeSliderView');
|
|
5
|
+
const SlotNativeView = requireNativeView('ExpoUI', 'SlotView');
|
|
6
|
+
/**
|
|
7
|
+
* Custom content for the start thumb of a `RangeSlider`.
|
|
8
|
+
* @platform android
|
|
9
|
+
*/ function StartThumb(props) {
|
|
10
|
+
return /*#__PURE__*/ _jsx(SlotNativeView, {
|
|
11
|
+
slotName: "startThumb",
|
|
12
|
+
children: props.children
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Custom content for the end thumb of a `RangeSlider`.
|
|
17
|
+
* @platform android
|
|
18
|
+
*/ function EndThumb(props) {
|
|
19
|
+
return /*#__PURE__*/ _jsx(SlotNativeView, {
|
|
20
|
+
slotName: "endThumb",
|
|
21
|
+
children: props.children
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Custom content for the track of a `RangeSlider`.
|
|
26
|
+
* @platform android
|
|
27
|
+
*/ function Track(props) {
|
|
28
|
+
return /*#__PURE__*/ _jsx(SlotNativeView, {
|
|
29
|
+
slotName: "track",
|
|
30
|
+
children: props.children
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* A Material 3 slider for selecting two values on a bounded track.
|
|
35
|
+
* It works only inside a `Host` component.
|
|
36
|
+
* @platform android
|
|
37
|
+
*/ export function RangeSlider(props) {
|
|
38
|
+
const { modifiers, onValueChange, onValueChangeFinished, ...restProps } = props;
|
|
39
|
+
return /*#__PURE__*/ _jsx(RangeSliderNativeView, {
|
|
40
|
+
...restProps,
|
|
41
|
+
modifiers: modifiers,
|
|
42
|
+
...modifiers ? createViewModifierEventListener(modifiers) : undefined,
|
|
43
|
+
onValueChange: onValueChange ? ({ nativeEvent })=>onValueChange(nativeEvent) : undefined,
|
|
44
|
+
onValueChangeFinished: onValueChangeFinished ? ()=>onValueChangeFinished() : undefined
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
RangeSlider.StartThumb = StartThumb;
|
|
48
|
+
RangeSlider.EndThumb = EndThumb;
|
|
49
|
+
RangeSlider.Track = Track;
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["jetpack-compose/RangeSlider/index.tsx"],"sourcesContent":[null],"names":["requireNativeView","createViewModifierEventListener","RangeSliderNativeView","SlotNativeView","StartThumb","props","slotName","children","EndThumb","Track","RangeSlider","modifiers","onValueChange","onValueChangeFinished","restProps","undefined","nativeEvent"],"mappings":";AAAA,SAASA,iBAAiB,QAAQ,OAAO;AAIzC,SAASC,+BAA+B,QAAQ,qBAAqB;AAoErE,MAAMC,wBAAqEF,kBACzE,UACA;AAGF,MAAMG,iBACJH,kBAAkB,UAAU;AAE9B;;;CAGC,GACD,SAASI,WAAWC,KAAoC;IACtD,qBAAO,KAACF;QAAeG,UAAS;kBAAcD,MAAME,QAAQ;;AAC9D;AAEA;;;CAGC,GACD,SAASC,SAASH,KAAoC;IACpD,qBAAO,KAACF;QAAeG,UAAS;kBAAYD,MAAME,QAAQ;;AAC5D;AAEA;;;CAGC,GACD,SAASE,MAAMJ,KAAoC;IACjD,qBAAO,KAACF;QAAeG,UAAS;kBAASD,MAAME,QAAQ;;AACzD;AAEA;;;;CAIC,GACD,OAAO,SAASG,YAAYL,KAAuB;IACjD,MAAM,EAAEM,SAAS,EAAEC,aAAa,EAAEC,qBAAqB,EAAE,GAAGC,WAAW,GAAGT;IAC1E,qBACE,KAACH;QACE,GAAGY,SAAS;QACbH,WAAWA;QACV,GAAIA,YAAYV,gCAAgCU,aAAaI,SAAS;QACvEH,eAAeA,gBAAgB,CAAC,EAAEI,WAAW,EAAE,GAAKJ,cAAcI,eAAeD;QACjFF,uBAAuBA,wBAAwB,IAAMA,0BAA0BE;;AAGrF;AAEAL,YAAYN,UAAU,GAAGA;AACzBM,YAAYF,QAAQ,GAAGA;AACvBE,YAAYD,KAAK,GAAGA"}
|
|
@@ -5,11 +5,26 @@ import type { ModifierConfig } from '../../types';
|
|
|
5
5
|
* @platform android
|
|
6
6
|
*/
|
|
7
7
|
export type SliderColors = {
|
|
8
|
+
/** The thumb color when enabled. */
|
|
8
9
|
thumbColor?: ColorValue;
|
|
10
|
+
/** The active track color when enabled. */
|
|
9
11
|
activeTrackColor?: ColorValue;
|
|
12
|
+
/** The inactive track color when enabled. */
|
|
10
13
|
inactiveTrackColor?: ColorValue;
|
|
14
|
+
/** The active tick color when enabled. */
|
|
11
15
|
activeTickColor?: ColorValue;
|
|
16
|
+
/** The inactive tick color when enabled. */
|
|
12
17
|
inactiveTickColor?: ColorValue;
|
|
18
|
+
/** The thumb color when disabled. */
|
|
19
|
+
disabledThumbColor?: ColorValue;
|
|
20
|
+
/** The active track color when disabled. */
|
|
21
|
+
disabledActiveTrackColor?: ColorValue;
|
|
22
|
+
/** The inactive track color when disabled. */
|
|
23
|
+
disabledInactiveTrackColor?: ColorValue;
|
|
24
|
+
/** The active tick color when disabled. */
|
|
25
|
+
disabledActiveTickColor?: ColorValue;
|
|
26
|
+
/** The inactive tick color when disabled. */
|
|
27
|
+
disabledInactiveTickColor?: ColorValue;
|
|
13
28
|
};
|
|
14
29
|
export interface SliderProps {
|
|
15
30
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["jetpack-compose/Slider/index.tsx"],"sourcesContent":[null],"names":["requireNativeView","createViewModifierEventListener","SlotNativeView","SliderNativeView","VerticalSliderNativeView","transformSliderProps","props","modifiers","onValueChange","onValueChangeFinished","restProps","undefined","min","max","steps","value","enabled","nativeEvent","Thumb","slotName","children","Track","SliderComponent","VerticalSlider","reverseDirection","sliderProps","Slider"],"mappings":";AAAA,SAASA,iBAAiB,QAAQ,OAAO;AAIzC,SAASC,+BAA+B,QAAQ,qBAAqB;AAOrE,MAAMC,iBAA2DF,kBAC/D,UACA;
|
|
1
|
+
{"version":3,"sources":["jetpack-compose/Slider/index.tsx"],"sourcesContent":[null],"names":["requireNativeView","createViewModifierEventListener","SlotNativeView","SliderNativeView","VerticalSliderNativeView","transformSliderProps","props","modifiers","onValueChange","onValueChangeFinished","restProps","undefined","min","max","steps","value","enabled","nativeEvent","Thumb","slotName","children","Track","SliderComponent","VerticalSlider","reverseDirection","sliderProps","Slider"],"mappings":";AAAA,SAASA,iBAAiB,QAAQ,OAAO;AAIzC,SAASC,+BAA+B,QAAQ,qBAAqB;AAOrE,MAAMC,iBAA2DF,kBAC/D,UACA;AAsGF,MAAMG,mBAA2DH,kBAC/D,UACA;AAGF,MAAMI,2BAEFJ,kBAAkB,UAAU;AAEhC,SAASK,qBACPC,KAAoC;IAEpC,MAAM,EAAEC,SAAS,EAAEC,aAAa,EAAEC,qBAAqB,EAAE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ton';
|
|
24
24
|
export * from './Progress';
|
|
25
|
+
export * from './RangeSlider';
|
|
25
26
|
export * from './Slider';
|
|
26
27
|
export * from './Spacer';
|
|
27
28
|
export * from './SplitButtonLayout';
|
|
@@ -22,6 +22,7 @@ export * from './RNHostView';
|
|
|
22
22
|
export * from './DatePicker';
|
|
23
23
|
export * from './SegmentedButton';
|
|
24
24
|
export * from './Progress';
|
|
25
|
+
export * from './RangeSlider';
|
|
25
26
|
export * from './Slider';
|
|
26
27
|
export * from './Spacer';
|
|
27
28
|
export * from './SplitButtonLayout';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["jetpack-compose/index.ts"],"sourcesContent":[null],"names":["BasicAlertDialog","TextField","OutlinedTextField","BasicTextField","HorizontalPager","Text","useNativeState","useWorkletCallback"],"mappings":"AAAA,OAAO,wCAAwC;AAE/C,cAAc,gBAAgB;AAC9B,cAAc,UAAU;AACxB,cAAc,cAAc;AAC5B,SAASA,gBAAgB,QAAoC,qBAAqB;AAClF,cAAc,SAAS;AACvB,cAAc,aAAa;AAC3B,cAAc,SAAS;AACvB,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,cAAc,eAAe;AAC7B,cAAc,iBAAiB;AAC/B,cAAc,2BAA2B;AACzC,cAAc,YAAY;AAC1B,cAAc,SAAS;AACvB,cAAc,eAAe;AAC7B,cAAc,YAAY;AAC1B,cAAc,aAAa;AAC3B,cAAc,eAAe;AAC7B,cAAc,eAAe;AAC7B,cAAc,oBAAoB;AAClC,cAAc,aAAa;AAC3B,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,sBAAsB;AACpC,cAAc,WAAW;AACzB,cAAc,eAAe;AAC7B,SACEC,SAAS,EACTC,iBAAiB,EACjBC,cAAc,QAcT,cAAc;AACrB,cAAc,iBAAiB;AAC/B,cAAc,UAAU;AACxB,cAAc,qBAAqB;AACnC,cAAc,kBAAkB;AAChC,cAAc,aAAa;AAC3B,SACEC,eAAe,QAGV,oBAAoB;AAC3B,cAAc,cAAc;AAC5B,cAAc,aAAa;AAC3B,cAAc,oBAAoB;AAClC,cAAc,8BAA8B;AAC5C,cAAc,cAAc;AAC5B,cAAc,yBAAyB;AACvC,cAAc,qBAAqB;AACnC,cAAc,gBAAgB;AAC9B,cAAc,YAAY;AAC1B,SAAyBC,IAAI,QAAQ,SAAS;AAC9C,cAAc,YAAY;AAC1B,cAAc,qBAAqB;AAEnC,cAAc,uBAAuB;AACrC,cAAc,QAAQ;AACtB,cAAc,QAAQ;AACtB,cAAc,WAAW;AACzB,cAAc,6BAA6B;AAC3C,cAAc,YAAY;AAC1B,SAASC,cAAc,EAAEC,kBAAkB,QAA8B,WAAW"}
|
|
1
|
+
{"version":3,"sources":["jetpack-compose/index.ts"],"sourcesContent":[null],"names":["BasicAlertDialog","TextField","OutlinedTextField","BasicTextField","HorizontalPager","Text","useNativeState","useWorkletCallback"],"mappings":"AAAA,OAAO,wCAAwC;AAE/C,cAAc,gBAAgB;AAC9B,cAAc,UAAU;AACxB,cAAc,cAAc;AAC5B,SAASA,gBAAgB,QAAoC,qBAAqB;AAClF,cAAc,SAAS;AACvB,cAAc,aAAa;AAC3B,cAAc,SAAS;AACvB,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,SAAS;AACvB,cAAc,UAAU;AACxB,cAAc,eAAe;AAC7B,cAAc,iBAAiB;AAC/B,cAAc,2BAA2B;AACzC,cAAc,YAAY;AAC1B,cAAc,SAAS;AACvB,cAAc,eAAe;AAC7B,cAAc,YAAY;AAC1B,cAAc,aAAa;AAC3B,cAAc,eAAe;AAC7B,cAAc,eAAe;AAC7B,cAAc,oBAAoB;AAClC,cAAc,aAAa;AAC3B,cAAc,gBAAgB;AAC9B,cAAc,WAAW;AACzB,cAAc,WAAW;AACzB,cAAc,sBAAsB;AACpC,cAAc,WAAW;AACzB,cAAc,eAAe;AAC7B,SACEC,SAAS,EACTC,iBAAiB,EACjBC,cAAc,QAcT,cAAc;AACrB,cAAc,iBAAiB;AAC/B,cAAc,UAAU;AACxB,cAAc,qBAAqB;AACnC,cAAc,kBAAkB;AAChC,cAAc,aAAa;AAC3B,SACEC,eAAe,QAGV,oBAAoB;AAC3B,cAAc,cAAc;AAC5B,cAAc,aAAa;AAC3B,cAAc,oBAAoB;AAClC,cAAc,8BAA8B;AAC5C,cAAc,cAAc;AAC5B,cAAc,yBAAyB;AACvC,cAAc,qBAAqB;AACnC,cAAc,gBAAgB;AAC9B,cAAc,YAAY;AAC1B,SAAyBC,IAAI,QAAQ,SAAS;AAC9C,cAAc,YAAY;AAC1B,cAAc,qBAAqB;AAEnC,cAAc,uBAAuB;AACrC,cAAc,QAAQ;AACtB,cAAc,QAAQ;AACtB,cAAc,WAAW;AACzB,cAAc,6BAA6B;AAC3C,cAAc,YAAY;AAC1B,SAASC,cAAc,EAAEC,kBAAkB,QAA8B,WAAW"}
|
|
@@ -459,5 +459,17 @@ export declare const verticalScroll: () => import("./createModifier").ModifierCo
|
|
|
459
459
|
* Use on a Row to create a non-lazy scrollable container.
|
|
460
460
|
*/
|
|
461
461
|
export declare const horizontalScroll: () => import("./createModifier").ModifierConfig;
|
|
462
|
+
/**
|
|
463
|
+
* Hides the keyboard and clears focus when the user starts to drag the scrollable content.
|
|
464
|
+
*
|
|
465
|
+
* When used with `verticalScroll()` or `horizontalScroll()` modifier, it must be placed
|
|
466
|
+
* before them in the modifier list.
|
|
467
|
+
*
|
|
468
|
+
* @example
|
|
469
|
+
* ```tsx
|
|
470
|
+
* modifiers={[scrollDismissesKeyboard(), verticalScroll()]}
|
|
471
|
+
* ```
|
|
472
|
+
*/
|
|
473
|
+
export declare const scrollDismissesKeyboard: () => import("./createModifier").ModifierConfig;
|
|
462
474
|
export { createModifier, createModifierWithEventListener } from './createModifier';
|
|
463
475
|
export { createViewModifierEventListener } from './utils';
|