@tamagui/select 1.88.7 → 1.88.8
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 +10 -5
- package/dist/cjs/Select.js.map +1 -1
- package/dist/cjs/Select.native.js +10 -5
- package/dist/cjs/Select.native.js.map +1 -1
- package/dist/cjs/SelectItem.js +10 -7
- package/dist/cjs/SelectItem.js.map +2 -2
- package/dist/cjs/SelectItem.native.js +11 -8
- package/dist/cjs/SelectItem.native.js.map +2 -2
- package/dist/cjs/SelectViewport.js +12 -14
- package/dist/cjs/SelectViewport.js.map +1 -1
- package/dist/esm/Select.js +10 -4
- package/dist/esm/Select.js.map +1 -1
- package/dist/esm/Select.native.js +10 -5
- package/dist/esm/Select.native.js.map +1 -1
- package/dist/esm/SelectItem.js +10 -7
- package/dist/esm/SelectItem.js.map +2 -2
- package/dist/esm/SelectItem.native.js +11 -8
- package/dist/esm/SelectItem.native.js.map +2 -2
- package/dist/esm/SelectViewport.js +10 -13
- package/dist/esm/SelectViewport.js.map +1 -1
- package/dist/jsx/Select.js +10 -4
- package/dist/jsx/Select.js.map +1 -1
- package/dist/jsx/Select.native.js +10 -5
- package/dist/jsx/Select.native.js.map +1 -1
- package/dist/jsx/SelectItem.js +10 -7
- package/dist/jsx/SelectItem.js.map +2 -2
- package/dist/jsx/SelectItem.native.js +11 -8
- package/dist/jsx/SelectItem.native.js.map +2 -2
- package/dist/jsx/SelectViewport.js +10 -13
- package/dist/jsx/SelectViewport.js.map +1 -1
- package/package.json +23 -22
- package/src/Select.tsx +21 -11
- package/src/SelectItem.tsx +8 -8
- package/src/SelectViewport.tsx +15 -15
- package/types/Select.d.ts +1 -1
- package/types/Select.d.ts.map +1 -1
- package/types/SelectItemText.d.ts +1 -1
- package/types/SelectViewport.d.ts.map +1 -1
package/src/SelectItem.tsx
CHANGED
|
@@ -70,15 +70,14 @@ export const SelectItem = ListItemFrame.styleable<SelectItemExtraProps>(
|
|
|
70
70
|
} = context
|
|
71
71
|
|
|
72
72
|
const [isSelected, setSelected] = React.useState(initialValue === value)
|
|
73
|
-
const [isActive, setActive] = React.useState(false)
|
|
74
73
|
|
|
75
74
|
React.useEffect(() => {
|
|
76
75
|
return activeIndexSubscribe((i) => {
|
|
77
76
|
const isActive = index === i
|
|
78
|
-
setActive(isActive)
|
|
79
77
|
|
|
80
78
|
if (isActive) {
|
|
81
79
|
onActiveChange(value, index)
|
|
80
|
+
listRef?.current[index]?.focus()
|
|
82
81
|
}
|
|
83
82
|
})
|
|
84
83
|
}, [index])
|
|
@@ -161,12 +160,6 @@ export const SelectItem = ListItemFrame.styleable<SelectItemExtraProps>(
|
|
|
161
160
|
}
|
|
162
161
|
}, [handleSelect])
|
|
163
162
|
|
|
164
|
-
useIsomorphicLayoutEffect(() => {
|
|
165
|
-
if (isActive) {
|
|
166
|
-
listRef?.current[index]?.focus()
|
|
167
|
-
}
|
|
168
|
-
}, [isActive])
|
|
169
|
-
|
|
170
163
|
return (
|
|
171
164
|
<SelectItemContextProvider
|
|
172
165
|
scope={__scopeSelect}
|
|
@@ -194,6 +187,13 @@ export const SelectItem = ListItemFrame.styleable<SelectItemExtraProps>(
|
|
|
194
187
|
cursor: 'default',
|
|
195
188
|
size,
|
|
196
189
|
outlineOffset: -1,
|
|
190
|
+
|
|
191
|
+
focusStyle: {
|
|
192
|
+
outlineColor: '$outlineColor',
|
|
193
|
+
outlineWidth: 2,
|
|
194
|
+
outlineStyle: 'solid',
|
|
195
|
+
outlineOffset: -2,
|
|
196
|
+
},
|
|
197
197
|
})}
|
|
198
198
|
{...listItemProps}
|
|
199
199
|
{...selectItemProps}
|
package/src/SelectViewport.tsx
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { FloatingFocusManager } from '@floating-ui/react'
|
|
2
2
|
import { AnimatePresence } from '@tamagui/animate-presence'
|
|
3
3
|
import { composeRefs } from '@tamagui/compose-refs'
|
|
4
|
-
import { isWeb } from '@tamagui/constants'
|
|
5
|
-
import {
|
|
6
|
-
import { styled } from '@tamagui/core'
|
|
4
|
+
import { isWeb, useIsomorphicLayoutEffect } from '@tamagui/constants'
|
|
5
|
+
import { View, styled } from '@tamagui/core'
|
|
7
6
|
import { PortalItem } from '@tamagui/portal'
|
|
8
7
|
import { ThemeableStack } from '@tamagui/stacks'
|
|
9
8
|
|
|
@@ -62,11 +61,6 @@ export const SelectViewport = SelectViewportFrame.styleable<SelectViewportExtraP
|
|
|
62
61
|
}
|
|
63
62
|
}, [breakpointActive])
|
|
64
63
|
|
|
65
|
-
const composedRefs = composeRefs(
|
|
66
|
-
forwardedRef,
|
|
67
|
-
context.floatingContext?.refs.setFloating
|
|
68
|
-
)
|
|
69
|
-
|
|
70
64
|
if (itemContext.shouldRenderWebNative) {
|
|
71
65
|
return <>{children}</>
|
|
72
66
|
}
|
|
@@ -99,6 +93,12 @@ export const SelectViewport = SelectViewportFrame.styleable<SelectViewportExtraP
|
|
|
99
93
|
className,
|
|
100
94
|
...floatingProps
|
|
101
95
|
} = itemContext.interactions.getFloatingProps()
|
|
96
|
+
|
|
97
|
+
const composedRefs = composeRefs(
|
|
98
|
+
forwardedRef,
|
|
99
|
+
context.floatingContext?.refs.setFloating
|
|
100
|
+
)
|
|
101
|
+
|
|
102
102
|
const { scrollbarWidth, listStyleType, overflow, ...restStyle } = style
|
|
103
103
|
|
|
104
104
|
return (
|
|
@@ -110,9 +110,9 @@ export const SelectViewport = SelectViewportFrame.styleable<SelectViewportExtraP
|
|
|
110
110
|
}}
|
|
111
111
|
/>
|
|
112
112
|
)}
|
|
113
|
-
<
|
|
114
|
-
|
|
115
|
-
{context.
|
|
113
|
+
<AnimatePresence>
|
|
114
|
+
{context.open ? (
|
|
115
|
+
<FloatingFocusManager context={context.floatingContext!} modal={false}>
|
|
116
116
|
<SelectViewportFrame
|
|
117
117
|
disableClassName
|
|
118
118
|
key="select-viewport"
|
|
@@ -120,18 +120,18 @@ export const SelectViewport = SelectViewportFrame.styleable<SelectViewportExtraP
|
|
|
120
120
|
// @ts-ignore
|
|
121
121
|
role="presentation"
|
|
122
122
|
{...viewportProps}
|
|
123
|
-
ref={composedRefs}
|
|
124
123
|
{...floatingProps}
|
|
125
124
|
{...restStyle}
|
|
126
125
|
{...(!props.unstyled && {
|
|
127
126
|
overflow: disableScroll ? undefined : overflow ?? 'scroll',
|
|
128
127
|
})}
|
|
128
|
+
ref={composedRefs}
|
|
129
129
|
>
|
|
130
130
|
{children}
|
|
131
131
|
</SelectViewportFrame>
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
</
|
|
132
|
+
</FloatingFocusManager>
|
|
133
|
+
) : null}
|
|
134
|
+
</AnimatePresence>
|
|
135
135
|
|
|
136
136
|
{/* keep in dom to allow for portal to the trigger... very hacky! we should fix */}
|
|
137
137
|
{!context.open && <div style={{ display: 'none' }}>{props.children}</div>}
|
package/types/Select.d.ts
CHANGED
|
@@ -85,7 +85,7 @@ export declare const Select: ((props: ScopedProps<SelectProps>) => JSX.Element)
|
|
|
85
85
|
elevation?: number | import("@tamagui/core").SizeTokens | undefined;
|
|
86
86
|
fullscreen?: boolean | undefined;
|
|
87
87
|
}>> & React.RefAttributes<TamaguiElement>>;
|
|
88
|
-
ItemText: import("@tamagui/core").TamaguiComponent<import("@tamagui/core").TamaDefer, import("@tamagui/core").TamaguiTextElement, import("@tamagui/core").TextNonStyleProps & void, Omit<import("@tamagui/core").TextStylePropsBase, never>, {
|
|
88
|
+
ItemText: import("@tamagui/core").TamaguiComponent<import("@tamagui/core").TamaDefer, import("@tamagui/core").TamaguiTextElement, import("@tamagui/core").TextNonStyleProps & (void | Object), Omit<import("@tamagui/core").TextStylePropsBase, never>, {
|
|
89
89
|
size?: FontSizeTokens | undefined;
|
|
90
90
|
unstyled?: boolean | undefined;
|
|
91
91
|
}, {}>;
|
package/types/Select.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../src/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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgLjC,CAAA"}
|
|
@@ -5,7 +5,7 @@ export declare const SelectItemTextFrame: import("@tamagui/core").TamaguiCompone
|
|
|
5
5
|
unstyled?: boolean | undefined;
|
|
6
6
|
}, {}>;
|
|
7
7
|
export type SelectItemTextProps = GetProps<typeof SelectItemTextFrame>;
|
|
8
|
-
export declare const SelectItemText: import("@tamagui/core").TamaguiComponent<import("@tamagui/core").TamaDefer, TamaguiTextElement, import("@tamagui/core").TextNonStyleProps & void, Omit<import("@tamagui/core").TextStylePropsBase, never>, {
|
|
8
|
+
export declare const SelectItemText: import("@tamagui/core").TamaguiComponent<import("@tamagui/core").TamaDefer, TamaguiTextElement, import("@tamagui/core").TextNonStyleProps & (void | Object), Omit<import("@tamagui/core").TextStylePropsBase, never>, {
|
|
9
9
|
size?: import("@tamagui/core").FontSizeTokens | undefined;
|
|
10
10
|
unstyled?: boolean | undefined;
|
|
11
11
|
}, {}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectViewport.d.ts","sourceRoot":"","sources":["../src/SelectViewport.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SelectViewport.d.ts","sourceRoot":"","sources":["../src/SelectViewport.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAe,wBAAwB,EAAuB,MAAM,SAAS,CAAA;AAOpF,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;MA2B9B,CAAA;AAEF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;MA0F1B,CAAA"}
|