@vellira-ui/react-native 2.188.1 → 2.188.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/README.md +3 -3
- package/dist/components/Select/Content/SelectContent.styles.d.ts +3 -0
- package/dist/components/Select/Presentation/SelectPresentation.styles.d.ts +1 -2
- package/dist/components/Select/Presentation/useSelectPresentationViewport.d.ts +6 -0
- package/dist/index.js +35 -6
- package/package.json +5 -6
package/README.md
CHANGED
|
@@ -9,11 +9,11 @@ interaction behavior inside the React Native layer.
|
|
|
9
9
|
|
|
10
10
|
## Installation
|
|
11
11
|
|
|
12
|
-
Requires `react >=19`, `react-native >=0.86`,
|
|
13
|
-
|
|
12
|
+
Requires `react >=19`, `react-native >=0.86`, and `react-native-svg >=13`.
|
|
13
|
+
Picker is not required by Vellira's native Select.
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
|
-
pnpm add @vellira-ui/react-native
|
|
16
|
+
pnpm add @vellira-ui/react-native react-native-svg
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
## Usage
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { NativeTheme } from '../../../theme';
|
|
2
|
+
export declare const SELECT_LIST_MAX_HEIGHT = 420;
|
|
2
3
|
export declare const createContentStyles: (theme: NativeTheme) => {
|
|
3
4
|
toolbar: {
|
|
4
5
|
minHeight: number;
|
|
@@ -37,6 +38,8 @@ export declare const createContentStyles: (theme: NativeTheme) => {
|
|
|
37
38
|
lineHeight: number;
|
|
38
39
|
};
|
|
39
40
|
list: {
|
|
41
|
+
flexGrow: number;
|
|
42
|
+
flexShrink: number;
|
|
40
43
|
maxHeight: number;
|
|
41
44
|
};
|
|
42
45
|
listContent: {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type NativeTheme } from '../../../theme';
|
|
2
|
+
export declare const SELECT_PRESENTATION_VIEWPORT_RATIO = 0.74;
|
|
2
3
|
export declare const createPresentationStyles: (theme: NativeTheme) => {
|
|
3
4
|
modalRoot: {
|
|
4
5
|
flex: number;
|
|
@@ -74,7 +75,6 @@ export declare const createPresentationStyles: (theme: NativeTheme) => {
|
|
|
74
75
|
borderRadius: number;
|
|
75
76
|
};
|
|
76
77
|
sheet: {
|
|
77
|
-
maxHeight: "74%";
|
|
78
78
|
borderTopLeftRadius: number;
|
|
79
79
|
borderTopRightRadius: number;
|
|
80
80
|
borderBottomWidth: number;
|
|
@@ -82,7 +82,6 @@ export declare const createPresentationStyles: (theme: NativeTheme) => {
|
|
|
82
82
|
modalPresentation: {
|
|
83
83
|
width: "100%";
|
|
84
84
|
maxWidth: number;
|
|
85
|
-
maxHeight: "74%";
|
|
86
85
|
borderRadius: number;
|
|
87
86
|
};
|
|
88
87
|
popover: {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type LayoutChangeEvent } from 'react-native';
|
|
2
|
+
export declare const useSelectPresentationViewport: (presentation: "sheet" | "modal") => {
|
|
3
|
+
maxHeight: number;
|
|
4
|
+
onLayout: (event: LayoutChangeEvent) => void;
|
|
5
|
+
};
|
|
6
|
+
//# sourceMappingURL=useSelectPresentationViewport.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -3611,8 +3611,6 @@ RadioGroupRoot.displayName = "RadioGroup.Root";
|
|
|
3611
3611
|
//#region src/components/RadioGroup/RadioGroup.tsx
|
|
3612
3612
|
const RadioGroup = Object.assign(RadioGroupRoot, { Item: RadioGroupItem });
|
|
3613
3613
|
RadioGroup.displayName = "RadioGroup";
|
|
3614
|
-
//#endregion
|
|
3615
|
-
//#region src/components/Select/Content/SelectContent.styles.ts
|
|
3616
3614
|
const createContentStyles = (theme) => StyleSheet.create({
|
|
3617
3615
|
toolbar: {
|
|
3618
3616
|
minHeight: 52,
|
|
@@ -3650,7 +3648,11 @@ const createContentStyles = (theme) => StyleSheet.create({
|
|
|
3650
3648
|
fontSize: theme.tokens.typography.size.md,
|
|
3651
3649
|
lineHeight: theme.tokens.typography.lineHeight.md
|
|
3652
3650
|
},
|
|
3653
|
-
list: {
|
|
3651
|
+
list: {
|
|
3652
|
+
flexGrow: 0,
|
|
3653
|
+
flexShrink: 1,
|
|
3654
|
+
maxHeight: 420
|
|
3655
|
+
},
|
|
3654
3656
|
listContent: {
|
|
3655
3657
|
paddingHorizontal: theme.tokens.spacing[2],
|
|
3656
3658
|
paddingVertical: theme.tokens.spacing[2]
|
|
@@ -4129,6 +4131,7 @@ const SelectLoadingState = () => {
|
|
|
4129
4131
|
SelectLoadingState.displayName = "Select.LoadingState";
|
|
4130
4132
|
//#endregion
|
|
4131
4133
|
//#region src/components/Select/Presentation/SelectPresentation.styles.ts
|
|
4134
|
+
const SELECT_PRESENTATION_VIEWPORT_RATIO = .74;
|
|
4132
4135
|
const createPresentationStyles = (theme) => {
|
|
4133
4136
|
const canonical = theme.components.select.dropdown;
|
|
4134
4137
|
const output = resolveComponentTokenPlatformOutputs(theme, canonical);
|
|
@@ -4189,7 +4192,6 @@ const createPresentationStyles = (theme) => {
|
|
|
4189
4192
|
},
|
|
4190
4193
|
popoverSurface: { borderRadius: theme.tokens.radius.lg },
|
|
4191
4194
|
sheet: {
|
|
4192
|
-
maxHeight: "74%",
|
|
4193
4195
|
borderTopLeftRadius: theme.tokens.radius.lg,
|
|
4194
4196
|
borderTopRightRadius: theme.tokens.radius.lg,
|
|
4195
4197
|
borderBottomWidth: 0
|
|
@@ -4197,7 +4199,6 @@ const createPresentationStyles = (theme) => {
|
|
|
4197
4199
|
modalPresentation: {
|
|
4198
4200
|
width: "100%",
|
|
4199
4201
|
maxWidth: 420,
|
|
4200
|
-
maxHeight: "74%",
|
|
4201
4202
|
borderRadius: theme.tokens.radius.lg
|
|
4202
4203
|
},
|
|
4203
4204
|
popover: {
|
|
@@ -4238,9 +4239,23 @@ const SelectHandle = () => {
|
|
|
4238
4239
|
};
|
|
4239
4240
|
SelectHandle.displayName = "Select.Handle";
|
|
4240
4241
|
//#endregion
|
|
4242
|
+
//#region src/components/Select/Presentation/useSelectPresentationViewport.ts
|
|
4243
|
+
const useSelectPresentationViewport = (presentation) => {
|
|
4244
|
+
const { height } = useWindowDimensions();
|
|
4245
|
+
const maxHeight = height * SELECT_PRESENTATION_VIEWPORT_RATIO;
|
|
4246
|
+
const onLayout = (event) => {
|
|
4247
|
+
if (globalThis.__VELLIRA_SELECT_LAYOUT_PROOF__) console.warn(`[VELLIRA_SELECT_LAYOUT] ${presentation} height=${event.nativeEvent.layout.height} viewportCap=${maxHeight}`);
|
|
4248
|
+
};
|
|
4249
|
+
return {
|
|
4250
|
+
maxHeight,
|
|
4251
|
+
onLayout
|
|
4252
|
+
};
|
|
4253
|
+
};
|
|
4254
|
+
//#endregion
|
|
4241
4255
|
//#region src/components/Select/Presentation/SelectModal.tsx
|
|
4242
4256
|
const SelectModal = ({ visible, onClose, outsidePressProps, zIndex, contentStyle, children }) => {
|
|
4243
4257
|
const styles = useThemeStyles(createPresentationStyles);
|
|
4258
|
+
const { maxHeight, onLayout } = useSelectPresentationViewport("modal");
|
|
4244
4259
|
return /* @__PURE__ */ jsx(Modal$1, {
|
|
4245
4260
|
transparent: true,
|
|
4246
4261
|
visible,
|
|
@@ -4259,8 +4274,10 @@ const SelectModal = ({ visible, onClose, outsidePressProps, zIndex, contentStyle
|
|
|
4259
4274
|
style: [
|
|
4260
4275
|
styles.content,
|
|
4261
4276
|
styles.modalPresentation,
|
|
4277
|
+
{ maxHeight },
|
|
4262
4278
|
contentStyle
|
|
4263
4279
|
],
|
|
4280
|
+
onLayout,
|
|
4264
4281
|
testID: "select-modal",
|
|
4265
4282
|
children
|
|
4266
4283
|
})
|
|
@@ -4318,6 +4335,7 @@ SelectPopover.displayName = "Select.Popover";
|
|
|
4318
4335
|
//#region src/components/Select/Presentation/SelectSheet.tsx
|
|
4319
4336
|
const SelectSheet = ({ visible, onClose, outsidePressProps, zIndex, contentStyle, children }) => {
|
|
4320
4337
|
const styles = useThemeStyles(createPresentationStyles);
|
|
4338
|
+
const { maxHeight, onLayout } = useSelectPresentationViewport("sheet");
|
|
4321
4339
|
return /* @__PURE__ */ jsx(Modal$1, {
|
|
4322
4340
|
transparent: true,
|
|
4323
4341
|
visible,
|
|
@@ -4336,8 +4354,10 @@ const SelectSheet = ({ visible, onClose, outsidePressProps, zIndex, contentStyle
|
|
|
4336
4354
|
style: [
|
|
4337
4355
|
styles.content,
|
|
4338
4356
|
styles.sheet,
|
|
4357
|
+
{ maxHeight },
|
|
4339
4358
|
contentStyle
|
|
4340
4359
|
],
|
|
4360
|
+
onLayout,
|
|
4341
4361
|
testID: "select-sheet",
|
|
4342
4362
|
children: [/* @__PURE__ */ jsx(SelectHandle, {}), children]
|
|
4343
4363
|
})
|
|
@@ -4456,11 +4476,14 @@ SelectSeparatorRow.displayName = "Select.SeparatorRow";
|
|
|
4456
4476
|
const SelectContent = createSelectSlot("content", "Select.Content");
|
|
4457
4477
|
const SelectContentSurface = () => {
|
|
4458
4478
|
const styles = useThemeStyles(createContentStyles);
|
|
4479
|
+
const { theme } = useTheme();
|
|
4459
4480
|
const wasOpenRef = useRef(false);
|
|
4460
4481
|
const [openCycle, setOpenCycle] = useState(0);
|
|
4461
4482
|
const context = useSelectContext();
|
|
4462
4483
|
const { isOpen, resolvedPresentation, zIndex, position, onFloatingLayout, contentStyle, matchTriggerWidth, triggerWidth, resolvedLabel, closeContent, getOutsidePressProps, searchable, loading, filteredRows, selectedValues, selectedOptions, maxSelected, optionStyle, selectOption, selectGroup, itemHeight, selectedRowIndex, query } = context;
|
|
4463
4484
|
const initialScrollIndex = Boolean(context.virtual) && selectedRowIndex > 0 && query === "" ? selectedRowIndex : void 0;
|
|
4485
|
+
const estimatedListHeight = filteredRows.length * itemHeight + theme.tokens.spacing[2] * 2;
|
|
4486
|
+
const listViewportHeight = Math.min(420, estimatedListHeight);
|
|
4464
4487
|
useEffect(() => {
|
|
4465
4488
|
if (isOpen && !wasOpenRef.current) setOpenCycle((cycle) => cycle + 1);
|
|
4466
4489
|
wasOpenRef.current = isOpen;
|
|
@@ -4536,8 +4559,14 @@ const SelectContentSurface = () => {
|
|
|
4536
4559
|
data: filteredRows,
|
|
4537
4560
|
keyExtractor: (item) => item.key,
|
|
4538
4561
|
renderItem: renderRow,
|
|
4539
|
-
style: styles.list,
|
|
4562
|
+
style: [styles.list, { height: listViewportHeight }],
|
|
4540
4563
|
contentContainerStyle: styles.listContent,
|
|
4564
|
+
onLayout: (event) => {
|
|
4565
|
+
if (isOpen && globalThis.__VELLIRA_SELECT_LAYOUT_PROOF__) console.warn(`[VELLIRA_SELECT_LAYOUT] list rows=${filteredRows.length} requested=${listViewportHeight} actual=${event.nativeEvent.layout.height}`);
|
|
4566
|
+
},
|
|
4567
|
+
onContentSizeChange: (_width, height) => {
|
|
4568
|
+
if (isOpen && globalThis.__VELLIRA_SELECT_LAYOUT_PROOF__) console.warn(`[VELLIRA_SELECT_LAYOUT] list contentHeight=${height} rows=${filteredRows.length}`);
|
|
4569
|
+
},
|
|
4541
4570
|
keyboardShouldPersistTaps: "handled",
|
|
4542
4571
|
initialScrollIndex,
|
|
4543
4572
|
initialNumToRender: typeof context.virtual === "object" ? context.virtual.initialNumToRender : 12,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vellira-ui/react-native",
|
|
3
|
-
"version": "2.188.
|
|
3
|
+
"version": "2.188.3",
|
|
4
4
|
"description": "React Native components for Vellira Design System",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"vellira",
|
|
@@ -44,16 +44,15 @@
|
|
|
44
44
|
"LICENSE"
|
|
45
45
|
],
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"@react-native-picker/picker": ">=2",
|
|
48
47
|
"react": ">=19",
|
|
49
48
|
"react-native": ">=0.86",
|
|
50
49
|
"react-native-svg": ">=13"
|
|
51
50
|
},
|
|
52
51
|
"dependencies": {
|
|
53
|
-
"@vellira-ui/icons": "2.188.
|
|
54
|
-
"@vellira-ui/
|
|
55
|
-
"@vellira-ui/
|
|
56
|
-
"@vellira-ui/
|
|
52
|
+
"@vellira-ui/icons": "2.188.3",
|
|
53
|
+
"@vellira-ui/tokens": "2.188.3",
|
|
54
|
+
"@vellira-ui/types": "2.188.3",
|
|
55
|
+
"@vellira-ui/core": "2.188.3"
|
|
57
56
|
},
|
|
58
57
|
"devDependencies": {
|
|
59
58
|
"@storybook/react-native": "^10.7.0",
|