@tamagui/select 1.0.1-beta.76 → 1.0.1-beta.79
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/cjs/Select.js +6 -5
- package/dist/cjs/Select.js.map +2 -2
- package/dist/esm/Select.js +6 -5
- package/dist/esm/Select.js.map +2 -2
- package/dist/jsx/BubbleSelect.js +1 -0
- package/dist/jsx/BubbleSelect.js.map +7 -0
- package/dist/jsx/Select.js +12 -8
- package/dist/jsx/Select.js.map +7 -0
- package/dist/jsx/index.js +1 -0
- package/dist/jsx/index.js.map +7 -0
- package/package.json +10 -10
- package/src/Select.tsx +9 -13
- package/types/Select.d.ts +63 -63
- package/types/Select.d.ts.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/select",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.79",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"*.css"
|
|
6
6
|
],
|
|
@@ -26,14 +26,14 @@
|
|
|
26
26
|
"@floating-ui/react-native": "^0.7.0",
|
|
27
27
|
"@radix-ui/react-use-callback-ref": "^0.1.0",
|
|
28
28
|
"@radix-ui/react-use-previous": "^0.1.1",
|
|
29
|
-
"@tamagui/compose-refs": "^1.0.1-beta.
|
|
30
|
-
"@tamagui/core": "^1.0.1-beta.
|
|
31
|
-
"@tamagui/create-context": "^1.0.1-beta.
|
|
32
|
-
"@tamagui/list-item": "^1.0.1-beta.
|
|
33
|
-
"@tamagui/separator": "^1.0.1-beta.
|
|
34
|
-
"@tamagui/stacks": "^1.0.1-beta.
|
|
35
|
-
"@tamagui/text": "^1.0.1-beta.
|
|
36
|
-
"@tamagui/use-controllable-state": "^1.0.1-beta.
|
|
29
|
+
"@tamagui/compose-refs": "^1.0.1-beta.79",
|
|
30
|
+
"@tamagui/core": "^1.0.1-beta.79",
|
|
31
|
+
"@tamagui/create-context": "^1.0.1-beta.79",
|
|
32
|
+
"@tamagui/list-item": "^1.0.1-beta.79",
|
|
33
|
+
"@tamagui/separator": "^1.0.1-beta.79",
|
|
34
|
+
"@tamagui/stacks": "^1.0.1-beta.79",
|
|
35
|
+
"@tamagui/text": "^1.0.1-beta.79",
|
|
36
|
+
"@tamagui/use-controllable-state": "^1.0.1-beta.79"
|
|
37
37
|
},
|
|
38
38
|
"peerDependencies": {
|
|
39
39
|
"react": "*",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"react-native": "*"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@tamagui/build": "^1.0.1-beta.
|
|
44
|
+
"@tamagui/build": "^1.0.1-beta.79",
|
|
45
45
|
"@types/react-native": "^0.67.3",
|
|
46
46
|
"react": "*",
|
|
47
47
|
"react-dom": "*",
|
package/src/Select.tsx
CHANGED
|
@@ -18,17 +18,11 @@ import {
|
|
|
18
18
|
useRole,
|
|
19
19
|
useTypeahead,
|
|
20
20
|
} from '@floating-ui/react-dom-interactions'
|
|
21
|
-
import { useCallbackRef } from '@radix-ui/react-use-callback-ref'
|
|
22
21
|
import { usePrevious } from '@radix-ui/react-use-previous'
|
|
23
22
|
import { useComposedRefs } from '@tamagui/compose-refs'
|
|
24
23
|
import {
|
|
25
24
|
GetProps,
|
|
26
25
|
SizeTokens,
|
|
27
|
-
Text,
|
|
28
|
-
VariantSpreadExtras,
|
|
29
|
-
VariantSpreadFunction,
|
|
30
|
-
composeEventHandlers,
|
|
31
|
-
getVariableValue,
|
|
32
26
|
styled,
|
|
33
27
|
useIsomorphicLayoutEffect,
|
|
34
28
|
withStaticProperties,
|
|
@@ -39,10 +33,9 @@ import {
|
|
|
39
33
|
import { useId } from '@tamagui/core'
|
|
40
34
|
import { createContextScope } from '@tamagui/create-context'
|
|
41
35
|
import type { Scope } from '@tamagui/create-context'
|
|
42
|
-
import { clamp } from '@tamagui/helpers'
|
|
43
36
|
import { ListItem, ListItemProps } from '@tamagui/list-item'
|
|
44
37
|
// import { useLabelContext } from '@tamagui/react-label'
|
|
45
|
-
import { Portal } from '@tamagui/portal'
|
|
38
|
+
// import { Portal } from '@tamagui/portal'
|
|
46
39
|
import { Separator } from '@tamagui/separator'
|
|
47
40
|
import { ThemeableStack, XStack, YStack, YStackProps } from '@tamagui/stacks'
|
|
48
41
|
import { Paragraph } from '@tamagui/text'
|
|
@@ -67,7 +60,7 @@ if (isFirefox) {
|
|
|
67
60
|
document.body.classList.add('firefox')
|
|
68
61
|
}
|
|
69
62
|
function getVisualOffsetTop() {
|
|
70
|
-
return !/^((?!chrome|android).)*safari/i.test(userAgent) ? visualViewport
|
|
63
|
+
return !/^((?!chrome|android).)*safari/i.test(userAgent) ? visualViewport?.offsetTop ?? 0 : 0
|
|
71
64
|
}
|
|
72
65
|
|
|
73
66
|
/* -------------------------------------------------------------------------------------------------
|
|
@@ -991,13 +984,14 @@ export const Select = withStaticProperties(
|
|
|
991
984
|
const rect = floating.getBoundingClientRect()
|
|
992
985
|
const rectTop = rect.top
|
|
993
986
|
const rectBottom = rect.bottom
|
|
994
|
-
const
|
|
987
|
+
const viewportHeight = visualViewport?.height ?? 0
|
|
988
|
+
const visualMaxHeight = viewportHeight - WINDOW_PADDING * 2
|
|
995
989
|
|
|
996
990
|
if (
|
|
997
991
|
amount < 0 &&
|
|
998
992
|
selectedIndexRef.current != null &&
|
|
999
993
|
Math.round(rectBottom) <
|
|
1000
|
-
Math.round(
|
|
994
|
+
Math.round(viewportHeight + getVisualOffsetTop() - WINDOW_PADDING)
|
|
1001
995
|
) {
|
|
1002
996
|
floating.style.maxHeight = `${Math.min(visualMaxHeight, currentMaxHeight - amount)}px`
|
|
1003
997
|
}
|
|
@@ -1044,7 +1038,8 @@ export const Select = withStaticProperties(
|
|
|
1044
1038
|
|
|
1045
1039
|
if (
|
|
1046
1040
|
Math.abs(
|
|
1047
|
-
(currentTarget?.offsetHeight ?? 0) -
|
|
1041
|
+
(currentTarget?.offsetHeight ?? 0) -
|
|
1042
|
+
((visualViewport?.height ?? 0) - WINDOW_PADDING * 2)
|
|
1048
1043
|
) > 1 &&
|
|
1049
1044
|
!pinching
|
|
1050
1045
|
) {
|
|
@@ -1177,7 +1172,8 @@ export const Select = withStaticProperties(
|
|
|
1177
1172
|
floating.scrollTop = middlewareData.size?.y
|
|
1178
1173
|
|
|
1179
1174
|
const closeToBottom =
|
|
1180
|
-
visualViewport
|
|
1175
|
+
(visualViewport?.height ?? 0) + getVisualOffsetTop() - referenceRect.bottom <
|
|
1176
|
+
FALLBACK_THRESHOLD
|
|
1181
1177
|
const closeToTop = referenceRect.top < FALLBACK_THRESHOLD
|
|
1182
1178
|
|
|
1183
1179
|
if (floating.offsetHeight < MIN_HEIGHT || closeToTop || closeToBottom) {
|