@vellira-ui/react-native 2.188.0 → 2.188.2
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.styles.d.ts +1 -0
- 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 +36 -6
- package/package.json +5 -5
|
@@ -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
|
@@ -1050,6 +1050,7 @@ const createStyles$23 = (theme) => {
|
|
|
1050
1050
|
borderRadius: theme.tokens.radius.lg
|
|
1051
1051
|
},
|
|
1052
1052
|
popoverMenu: {
|
|
1053
|
+
overflow: "visible",
|
|
1053
1054
|
width: "100%",
|
|
1054
1055
|
maxWidth: 360,
|
|
1055
1056
|
maxHeight: "60%",
|
|
@@ -3610,8 +3611,6 @@ RadioGroupRoot.displayName = "RadioGroup.Root";
|
|
|
3610
3611
|
//#region src/components/RadioGroup/RadioGroup.tsx
|
|
3611
3612
|
const RadioGroup = Object.assign(RadioGroupRoot, { Item: RadioGroupItem });
|
|
3612
3613
|
RadioGroup.displayName = "RadioGroup";
|
|
3613
|
-
//#endregion
|
|
3614
|
-
//#region src/components/Select/Content/SelectContent.styles.ts
|
|
3615
3614
|
const createContentStyles = (theme) => StyleSheet.create({
|
|
3616
3615
|
toolbar: {
|
|
3617
3616
|
minHeight: 52,
|
|
@@ -3649,7 +3648,11 @@ const createContentStyles = (theme) => StyleSheet.create({
|
|
|
3649
3648
|
fontSize: theme.tokens.typography.size.md,
|
|
3650
3649
|
lineHeight: theme.tokens.typography.lineHeight.md
|
|
3651
3650
|
},
|
|
3652
|
-
list: {
|
|
3651
|
+
list: {
|
|
3652
|
+
flexGrow: 0,
|
|
3653
|
+
flexShrink: 1,
|
|
3654
|
+
maxHeight: 420
|
|
3655
|
+
},
|
|
3653
3656
|
listContent: {
|
|
3654
3657
|
paddingHorizontal: theme.tokens.spacing[2],
|
|
3655
3658
|
paddingVertical: theme.tokens.spacing[2]
|
|
@@ -4128,6 +4131,7 @@ const SelectLoadingState = () => {
|
|
|
4128
4131
|
SelectLoadingState.displayName = "Select.LoadingState";
|
|
4129
4132
|
//#endregion
|
|
4130
4133
|
//#region src/components/Select/Presentation/SelectPresentation.styles.ts
|
|
4134
|
+
const SELECT_PRESENTATION_VIEWPORT_RATIO = .74;
|
|
4131
4135
|
const createPresentationStyles = (theme) => {
|
|
4132
4136
|
const canonical = theme.components.select.dropdown;
|
|
4133
4137
|
const output = resolveComponentTokenPlatformOutputs(theme, canonical);
|
|
@@ -4188,7 +4192,6 @@ const createPresentationStyles = (theme) => {
|
|
|
4188
4192
|
},
|
|
4189
4193
|
popoverSurface: { borderRadius: theme.tokens.radius.lg },
|
|
4190
4194
|
sheet: {
|
|
4191
|
-
maxHeight: "74%",
|
|
4192
4195
|
borderTopLeftRadius: theme.tokens.radius.lg,
|
|
4193
4196
|
borderTopRightRadius: theme.tokens.radius.lg,
|
|
4194
4197
|
borderBottomWidth: 0
|
|
@@ -4196,7 +4199,6 @@ const createPresentationStyles = (theme) => {
|
|
|
4196
4199
|
modalPresentation: {
|
|
4197
4200
|
width: "100%",
|
|
4198
4201
|
maxWidth: 420,
|
|
4199
|
-
maxHeight: "74%",
|
|
4200
4202
|
borderRadius: theme.tokens.radius.lg
|
|
4201
4203
|
},
|
|
4202
4204
|
popover: {
|
|
@@ -4237,9 +4239,23 @@ const SelectHandle = () => {
|
|
|
4237
4239
|
};
|
|
4238
4240
|
SelectHandle.displayName = "Select.Handle";
|
|
4239
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
|
|
4240
4255
|
//#region src/components/Select/Presentation/SelectModal.tsx
|
|
4241
4256
|
const SelectModal = ({ visible, onClose, outsidePressProps, zIndex, contentStyle, children }) => {
|
|
4242
4257
|
const styles = useThemeStyles(createPresentationStyles);
|
|
4258
|
+
const { maxHeight, onLayout } = useSelectPresentationViewport("modal");
|
|
4243
4259
|
return /* @__PURE__ */ jsx(Modal$1, {
|
|
4244
4260
|
transparent: true,
|
|
4245
4261
|
visible,
|
|
@@ -4258,8 +4274,10 @@ const SelectModal = ({ visible, onClose, outsidePressProps, zIndex, contentStyle
|
|
|
4258
4274
|
style: [
|
|
4259
4275
|
styles.content,
|
|
4260
4276
|
styles.modalPresentation,
|
|
4277
|
+
{ maxHeight },
|
|
4261
4278
|
contentStyle
|
|
4262
4279
|
],
|
|
4280
|
+
onLayout,
|
|
4263
4281
|
testID: "select-modal",
|
|
4264
4282
|
children
|
|
4265
4283
|
})
|
|
@@ -4317,6 +4335,7 @@ SelectPopover.displayName = "Select.Popover";
|
|
|
4317
4335
|
//#region src/components/Select/Presentation/SelectSheet.tsx
|
|
4318
4336
|
const SelectSheet = ({ visible, onClose, outsidePressProps, zIndex, contentStyle, children }) => {
|
|
4319
4337
|
const styles = useThemeStyles(createPresentationStyles);
|
|
4338
|
+
const { maxHeight, onLayout } = useSelectPresentationViewport("sheet");
|
|
4320
4339
|
return /* @__PURE__ */ jsx(Modal$1, {
|
|
4321
4340
|
transparent: true,
|
|
4322
4341
|
visible,
|
|
@@ -4335,8 +4354,10 @@ const SelectSheet = ({ visible, onClose, outsidePressProps, zIndex, contentStyle
|
|
|
4335
4354
|
style: [
|
|
4336
4355
|
styles.content,
|
|
4337
4356
|
styles.sheet,
|
|
4357
|
+
{ maxHeight },
|
|
4338
4358
|
contentStyle
|
|
4339
4359
|
],
|
|
4360
|
+
onLayout,
|
|
4340
4361
|
testID: "select-sheet",
|
|
4341
4362
|
children: [/* @__PURE__ */ jsx(SelectHandle, {}), children]
|
|
4342
4363
|
})
|
|
@@ -4455,11 +4476,14 @@ SelectSeparatorRow.displayName = "Select.SeparatorRow";
|
|
|
4455
4476
|
const SelectContent = createSelectSlot("content", "Select.Content");
|
|
4456
4477
|
const SelectContentSurface = () => {
|
|
4457
4478
|
const styles = useThemeStyles(createContentStyles);
|
|
4479
|
+
const { theme } = useTheme();
|
|
4458
4480
|
const wasOpenRef = useRef(false);
|
|
4459
4481
|
const [openCycle, setOpenCycle] = useState(0);
|
|
4460
4482
|
const context = useSelectContext();
|
|
4461
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;
|
|
4462
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);
|
|
4463
4487
|
useEffect(() => {
|
|
4464
4488
|
if (isOpen && !wasOpenRef.current) setOpenCycle((cycle) => cycle + 1);
|
|
4465
4489
|
wasOpenRef.current = isOpen;
|
|
@@ -4535,8 +4559,14 @@ const SelectContentSurface = () => {
|
|
|
4535
4559
|
data: filteredRows,
|
|
4536
4560
|
keyExtractor: (item) => item.key,
|
|
4537
4561
|
renderItem: renderRow,
|
|
4538
|
-
style: styles.list,
|
|
4562
|
+
style: [styles.list, { height: listViewportHeight }],
|
|
4539
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
|
+
},
|
|
4540
4570
|
keyboardShouldPersistTaps: "handled",
|
|
4541
4571
|
initialScrollIndex,
|
|
4542
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.2",
|
|
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.188.
|
|
54
|
-
"@vellira-ui/tokens": "2.188.
|
|
55
|
-
"@vellira-ui/icons": "2.188.
|
|
56
|
-
"@vellira-ui/types": "2.188.
|
|
53
|
+
"@vellira-ui/core": "2.188.2",
|
|
54
|
+
"@vellira-ui/tokens": "2.188.2",
|
|
55
|
+
"@vellira-ui/icons": "2.188.2",
|
|
56
|
+
"@vellira-ui/types": "2.188.2"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@storybook/react-native": "^10.7.0",
|