@vellira-ui/react-native 2.186.23 → 2.187.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/dist/components/Dropdown/Content/DropdownContent.d.ts +1 -1
- package/dist/components/Dropdown/Content/DropdownContent.styles.d.ts +6 -0
- package/dist/components/Dropdown/Content/types.d.ts +2 -0
- package/dist/components/Dropdown/Root/DropdownRoot.d.ts +1 -1
- package/dist/components/Dropdown/types.d.ts +2 -0
- package/dist/index.js +64 -5
- package/package.json +6 -5
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DropdownContentProps } from './types';
|
|
2
|
-
export declare function DropdownContent({ children, contentStyle, accessibilityLabel, }: DropdownContentProps): import("react").JSX.Element;
|
|
2
|
+
export declare function DropdownContent({ children, contentStyle, popoverBackground, accessibilityLabel, }: DropdownContentProps): import("react").JSX.Element;
|
|
3
3
|
export declare namespace DropdownContent {
|
|
4
4
|
var displayName: string;
|
|
5
5
|
}
|
|
@@ -74,6 +74,12 @@ export declare const createStyles: (theme: NativeTheme) => {
|
|
|
74
74
|
maxHeight: "60%";
|
|
75
75
|
borderRadius: number;
|
|
76
76
|
};
|
|
77
|
+
popoverSurface: {
|
|
78
|
+
overflow: "hidden";
|
|
79
|
+
borderRadius: number;
|
|
80
|
+
backgroundColor: string;
|
|
81
|
+
padding: number;
|
|
82
|
+
};
|
|
77
83
|
searchWrap: {
|
|
78
84
|
minHeight: number;
|
|
79
85
|
flexDirection: "row";
|
|
@@ -5,6 +5,8 @@ export interface DropdownContentProps {
|
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
/** Style applied to dropdown content. */
|
|
7
7
|
contentStyle?: StyleProp<ViewStyle>;
|
|
8
|
+
/** Optional background for anchored native popovers. */
|
|
9
|
+
popoverBackground?: ReactNode;
|
|
8
10
|
/** Accessible name for dropdown content. */
|
|
9
11
|
accessibilityLabel?: string;
|
|
10
12
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { DropdownProps } from '../types';
|
|
2
|
-
export declare function DropdownRoot({ children, label, trigger, icon, arrowIcon, showArrow, open, defaultOpen, onOpenChange, presentation, placement, offset, closeOnSelect, color, disabled, loading, loadingText, searchable, command, searchValue, defaultSearchValue, searchPlaceholder, onSearch, empty, size, style, triggerStyle, contentStyle, itemStyle, textStyle, accessibilityLabel, accessibilityHint, }: DropdownProps): import("react").JSX.Element;
|
|
2
|
+
export declare function DropdownRoot({ children, label, trigger, icon, arrowIcon, showArrow, open, defaultOpen, onOpenChange, presentation, placement, offset, closeOnSelect, color, disabled, loading, loadingText, searchable, command, searchValue, defaultSearchValue, searchPlaceholder, onSearch, empty, size, style, triggerStyle, contentStyle, popoverBackground, itemStyle, textStyle, accessibilityLabel, accessibilityHint, }: DropdownProps): import("react").JSX.Element;
|
|
3
3
|
export declare namespace DropdownRoot {
|
|
4
4
|
var displayName: string;
|
|
5
5
|
}
|
|
@@ -37,6 +37,8 @@ export interface DropdownProps extends BaseDropdownProps {
|
|
|
37
37
|
triggerStyle?: StyleProp<ViewStyle>;
|
|
38
38
|
/** Style applied to dropdown content. */
|
|
39
39
|
contentStyle?: StyleProp<ViewStyle>;
|
|
40
|
+
/** Optional native background behind popover items (e.g. an injected BlurView). */
|
|
41
|
+
popoverBackground?: ReactNode;
|
|
40
42
|
/** Style applied to each item row. */
|
|
41
43
|
itemStyle?: StyleProp<ViewStyle>;
|
|
42
44
|
/** Style applied to trigger and item text. */
|
package/dist/index.js
CHANGED
|
@@ -1055,6 +1055,12 @@ const createStyles$23 = (theme) => {
|
|
|
1055
1055
|
maxHeight: "60%",
|
|
1056
1056
|
borderRadius: theme.tokens.radius.md
|
|
1057
1057
|
},
|
|
1058
|
+
popoverSurface: {
|
|
1059
|
+
overflow: "hidden",
|
|
1060
|
+
borderRadius: theme.tokens.radius.md,
|
|
1061
|
+
backgroundColor: "transparent",
|
|
1062
|
+
padding: theme.tokens.spacing[1]
|
|
1063
|
+
},
|
|
1058
1064
|
searchWrap: {
|
|
1059
1065
|
minHeight: 40,
|
|
1060
1066
|
flexDirection: "row",
|
|
@@ -1085,13 +1091,27 @@ const createStyles$23 = (theme) => {
|
|
|
1085
1091
|
//#region src/components/Dropdown/Content/DropdownContent.tsx
|
|
1086
1092
|
const nativePointerEventsBoxNone$1 = Platform.OS === "web" ? void 0 : { pointerEvents: "box-none" };
|
|
1087
1093
|
const webPointerEventsBoxNone$1 = Platform.OS === "web" ? { pointerEvents: "box-none" } : void 0;
|
|
1088
|
-
function
|
|
1094
|
+
function resolveBorderRadius(style) {
|
|
1095
|
+
if (Array.isArray(style)) {
|
|
1096
|
+
for (let index = style.length - 1; index >= 0; index -= 1) {
|
|
1097
|
+
const radius = resolveBorderRadius(style[index]);
|
|
1098
|
+
if (radius !== void 0) return radius;
|
|
1099
|
+
}
|
|
1100
|
+
return;
|
|
1101
|
+
}
|
|
1102
|
+
if (style && typeof style === "object" && "borderRadius" in style) {
|
|
1103
|
+
const radius = style.borderRadius;
|
|
1104
|
+
return typeof radius === "number" ? radius : void 0;
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
function DropdownContent({ children, contentStyle, popoverBackground, accessibilityLabel }) {
|
|
1089
1108
|
const { open, color, presentation, positionReady, zIndex, position, searchable, searchValue, searchPlaceholder, searchAccessibilityLabel, requestClose, getOutsidePressProps, onSearchChange, onFloatingLayout } = useDropdownContext();
|
|
1090
1109
|
const { theme } = useTheme();
|
|
1091
1110
|
const styles = useThemeStyles(createStyles$23);
|
|
1092
1111
|
const colorPalette = theme.components.dropdown[color];
|
|
1093
1112
|
const isSheet = presentation === "sheet";
|
|
1094
1113
|
const isPopover = presentation === "popover";
|
|
1114
|
+
const popoverRadius = resolveBorderRadius(contentStyle) ?? theme.tokens.radius.md;
|
|
1095
1115
|
const animation = useRef(new Animated.Value(open ? 1 : 0)).current;
|
|
1096
1116
|
const [reduceMotion, setReduceMotion] = useState(false);
|
|
1097
1117
|
useEffect(() => {
|
|
@@ -1168,7 +1188,7 @@ function DropdownContent({ children, contentStyle, accessibilityLabel }) {
|
|
|
1168
1188
|
...getOutsidePressProps({ accessibilityLabel: "Close menu" }),
|
|
1169
1189
|
style: StyleSheet.absoluteFill
|
|
1170
1190
|
})
|
|
1171
|
-
}), /* @__PURE__ */
|
|
1191
|
+
}), /* @__PURE__ */ jsx(Animated.View, {
|
|
1172
1192
|
accessibilityRole: "menu",
|
|
1173
1193
|
accessibilityLabel,
|
|
1174
1194
|
style: [
|
|
@@ -1182,10 +1202,48 @@ function DropdownContent({ children, contentStyle, accessibilityLabel }) {
|
|
|
1182
1202
|
left: position.left
|
|
1183
1203
|
},
|
|
1184
1204
|
contentStyle,
|
|
1205
|
+
isPopover && popoverBackground ? {
|
|
1206
|
+
overflow: "visible",
|
|
1207
|
+
backgroundColor: "transparent",
|
|
1208
|
+
padding: 0
|
|
1209
|
+
} : void 0,
|
|
1185
1210
|
menuAnimatedStyle
|
|
1186
1211
|
],
|
|
1187
1212
|
onLayout: isPopover ? onFloatingLayout : void 0,
|
|
1188
|
-
children:
|
|
1213
|
+
children: isPopover && popoverBackground ? /* @__PURE__ */ jsxs(View, {
|
|
1214
|
+
style: [styles.popoverSurface, { borderRadius: popoverRadius }],
|
|
1215
|
+
children: [
|
|
1216
|
+
/* @__PURE__ */ jsx(View, {
|
|
1217
|
+
pointerEvents: "none",
|
|
1218
|
+
style: StyleSheet.absoluteFill,
|
|
1219
|
+
accessibilityElementsHidden: true,
|
|
1220
|
+
importantForAccessibility: "no",
|
|
1221
|
+
children: popoverBackground
|
|
1222
|
+
}),
|
|
1223
|
+
searchable && /* @__PURE__ */ jsxs(View, {
|
|
1224
|
+
style: styles.searchWrap,
|
|
1225
|
+
children: [/* @__PURE__ */ jsx(View, {
|
|
1226
|
+
style: styles.searchIcon,
|
|
1227
|
+
accessibilityElementsHidden: true,
|
|
1228
|
+
importantForAccessibility: "no",
|
|
1229
|
+
children: /* @__PURE__ */ jsx(Search, {
|
|
1230
|
+
width: 16,
|
|
1231
|
+
height: 16,
|
|
1232
|
+
color: theme.components.dropdown.separator.fg
|
|
1233
|
+
})
|
|
1234
|
+
}), /* @__PURE__ */ jsx(TextInput, {
|
|
1235
|
+
value: searchValue,
|
|
1236
|
+
onChangeText: onSearchChange,
|
|
1237
|
+
placeholder: searchPlaceholder,
|
|
1238
|
+
returnKeyType: "search",
|
|
1239
|
+
placeholderTextColor: theme.components.dropdown.separator.fg,
|
|
1240
|
+
accessibilityLabel: searchAccessibilityLabel ?? searchPlaceholder,
|
|
1241
|
+
style: styles.searchInput
|
|
1242
|
+
})]
|
|
1243
|
+
}),
|
|
1244
|
+
children
|
|
1245
|
+
]
|
|
1246
|
+
}) : /* @__PURE__ */ jsxs(Fragment, { children: [searchable && /* @__PURE__ */ jsxs(View, {
|
|
1189
1247
|
style: styles.searchWrap,
|
|
1190
1248
|
children: [/* @__PURE__ */ jsx(View, {
|
|
1191
1249
|
style: styles.searchIcon,
|
|
@@ -1205,7 +1263,7 @@ function DropdownContent({ children, contentStyle, accessibilityLabel }) {
|
|
|
1205
1263
|
accessibilityLabel: searchAccessibilityLabel ?? searchPlaceholder,
|
|
1206
1264
|
style: styles.searchInput
|
|
1207
1265
|
})]
|
|
1208
|
-
}), children]
|
|
1266
|
+
}), children] })
|
|
1209
1267
|
})]
|
|
1210
1268
|
})
|
|
1211
1269
|
});
|
|
@@ -1955,7 +2013,7 @@ function DropdownTrigger({ asChild = false, label, trigger, children, icon, arro
|
|
|
1955
2013
|
DropdownTrigger.displayName = "DropdownTrigger";
|
|
1956
2014
|
//#endregion
|
|
1957
2015
|
//#region src/components/Dropdown/Root/DropdownRoot.tsx
|
|
1958
|
-
function DropdownRoot({ children, label = "Menu", trigger, icon, arrowIcon, showArrow = true, open, defaultOpen = false, onOpenChange, presentation = "auto", placement = "bottom-start", offset = 8, closeOnSelect = true, color = "primary", disabled = false, loading = false, loadingText = "Loading actions...", searchable = false, command = false, searchValue, defaultSearchValue = "", searchPlaceholder, onSearch, empty, size = "md", style, triggerStyle, contentStyle, itemStyle, textStyle, accessibilityLabel, accessibilityHint }) {
|
|
2016
|
+
function DropdownRoot({ children, label = "Menu", trigger, icon, arrowIcon, showArrow = true, open, defaultOpen = false, onOpenChange, presentation = "auto", placement = "bottom-start", offset = 8, closeOnSelect = true, color = "primary", disabled = false, loading = false, loadingText = "Loading actions...", searchable = false, command = false, searchValue, defaultSearchValue = "", searchPlaceholder, onSearch, empty, size = "md", style, triggerStyle, contentStyle, popoverBackground, itemStyle, textStyle, accessibilityLabel, accessibilityHint }) {
|
|
1959
2017
|
const styles = useThemeStyles(createStyles$22);
|
|
1960
2018
|
const overlayId = useId();
|
|
1961
2019
|
const triggerRef = useRef(null);
|
|
@@ -2121,6 +2179,7 @@ function DropdownRoot({ children, label = "Menu", trigger, icon, arrowIcon, show
|
|
|
2121
2179
|
accessibilityHint
|
|
2122
2180
|
}), /* @__PURE__ */ jsx(DropdownContent, {
|
|
2123
2181
|
contentStyle: [contentStyle, contentStyleFromSlot],
|
|
2182
|
+
popoverBackground,
|
|
2124
2183
|
accessibilityLabel: menuAccessibilityLabel,
|
|
2125
2184
|
children: /* @__PURE__ */ jsx(FlatList, {
|
|
2126
2185
|
data,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vellira-ui/react-native",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.187.0",
|
|
4
4
|
"description": "React Native components for Vellira Design System",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vellira",
|
|
@@ -50,10 +50,10 @@
|
|
|
50
50
|
"react-native-svg": ">=13"
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@vellira-ui/core": "2.
|
|
54
|
-
"@vellira-ui/icons": "2.
|
|
55
|
-
"@vellira-ui/
|
|
56
|
-
"@vellira-ui/
|
|
53
|
+
"@vellira-ui/core": "2.187.0",
|
|
54
|
+
"@vellira-ui/icons": "2.187.0",
|
|
55
|
+
"@vellira-ui/tokens": "2.187.0",
|
|
56
|
+
"@vellira-ui/types": "2.187.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@storybook/react-native": "^10.7.0",
|
|
@@ -74,6 +74,7 @@
|
|
|
74
74
|
"scripts": {
|
|
75
75
|
"clean": "node --input-type=module -e \"import fs from 'node:fs'; fs.rmSync('dist', { recursive: true, force: true })\"",
|
|
76
76
|
"build": "pnpm run clean && tsdown && tsc -p tsconfig.build.json --emitDeclarationOnly",
|
|
77
|
+
"build:subpaths:probe": "node ../../scripts/performance/native-build-subpaths-optin.cjs",
|
|
77
78
|
"lint": "eslint 'src/**/*.{ts,tsx}'",
|
|
78
79
|
"lint:fix": "eslint 'src/**/*.{ts,tsx}' --fix",
|
|
79
80
|
"typecheck": "tsc -p tsconfig.typecheck.json --noEmit && tsc -p tsconfig.test.json --noEmit && tsc -p tsconfig.stories.json --noEmit && tsc -p tsconfig.tooling.json --noEmit",
|