@radix-ui/react-select 1.0.1-rc.1 → 1.0.1-rc.10
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/index.d.ts.map +1 -1
- package/dist/index.js +11 -7
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +11 -7
- package/dist/index.module.js.map +1 -1
- package/package.json +7 -8
package/dist/index.module.js
CHANGED
|
@@ -11,7 +11,6 @@ import {DismissableLayer as $01b9c$DismissableLayer} from "@radix-ui/react-dismi
|
|
|
11
11
|
import {useFocusGuards as $01b9c$useFocusGuards} from "@radix-ui/react-focus-guards";
|
|
12
12
|
import {FocusScope as $01b9c$FocusScope} from "@radix-ui/react-focus-scope";
|
|
13
13
|
import {useId as $01b9c$useId} from "@radix-ui/react-id";
|
|
14
|
-
import {useLabelContext as $01b9c$useLabelContext} from "@radix-ui/react-label";
|
|
15
14
|
import {Portal as $01b9c$Portal} from "@radix-ui/react-portal";
|
|
16
15
|
import {Primitive as $01b9c$Primitive} from "@radix-ui/react-primitive";
|
|
17
16
|
import {Slot as $01b9c$Slot} from "@radix-ui/react-slot";
|
|
@@ -44,7 +43,6 @@ import {RemoveScroll as $01b9c$RemoveScroll} from "react-remove-scroll";
|
|
|
44
43
|
|
|
45
44
|
|
|
46
45
|
|
|
47
|
-
|
|
48
46
|
|
|
49
47
|
|
|
50
48
|
const $cc7e05a45900e73f$var$OPEN_KEYS = [
|
|
@@ -139,12 +137,10 @@ const $cc7e05a45900e73f$export$ef9b1a59e592288f = (props)=>{
|
|
|
139
137
|
* SelectTrigger
|
|
140
138
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$TRIGGER_NAME = 'SelectTrigger';
|
|
141
139
|
const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ $01b9c$forwardRef((props, forwardedRef)=>{
|
|
142
|
-
const { __scopeSelect: __scopeSelect , disabled: disabled = false ,
|
|
140
|
+
const { __scopeSelect: __scopeSelect , disabled: disabled = false , ...triggerProps } = props;
|
|
143
141
|
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$TRIGGER_NAME, __scopeSelect);
|
|
144
142
|
const composedRefs = $01b9c$useComposedRefs(forwardedRef, context.onTriggerChange);
|
|
145
143
|
const getItems = $cc7e05a45900e73f$var$useCollection(__scopeSelect);
|
|
146
|
-
const labelId = $01b9c$useLabelContext(context.trigger);
|
|
147
|
-
const labelledBy = ariaLabelledby || labelId;
|
|
148
144
|
const [searchRef, handleTypeaheadSearch, resetTypeahead] = $cc7e05a45900e73f$var$useTypeaheadSearch((search)=>{
|
|
149
145
|
const enabledItems = getItems().filter((item)=>!item.disabled
|
|
150
146
|
);
|
|
@@ -165,14 +161,22 @@ const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ $01b9c$forwardRef
|
|
|
165
161
|
"aria-controls": context.contentId,
|
|
166
162
|
"aria-expanded": context.open,
|
|
167
163
|
"aria-autocomplete": "none",
|
|
168
|
-
"aria-labelledby": labelledBy,
|
|
169
164
|
dir: context.dir,
|
|
170
165
|
"data-state": context.open ? 'open' : 'closed',
|
|
171
166
|
disabled: disabled,
|
|
172
167
|
"data-disabled": disabled ? '' : undefined,
|
|
173
168
|
"data-placeholder": context.value === undefined ? '' : undefined
|
|
174
169
|
}, triggerProps, {
|
|
175
|
-
ref: composedRefs
|
|
170
|
+
ref: composedRefs // Enable compatibility with native label or custom `Label` "click" for Safari:
|
|
171
|
+
,
|
|
172
|
+
onClick: $01b9c$composeEventHandlers(triggerProps.onClick, (event)=>{
|
|
173
|
+
// Whilst browsers generally have no issue focusing the trigger when clicking
|
|
174
|
+
// on a label, Safari seems to struggle with the fact that there's no `onClick`.
|
|
175
|
+
// We force `focus` in this case. Note: this doesn't create any other side-effect
|
|
176
|
+
// because we are preventing default in `onPointerDown` so effectively
|
|
177
|
+
// this only runs for a label "click"
|
|
178
|
+
event.currentTarget.focus();
|
|
179
|
+
}),
|
|
176
180
|
onPointerDown: $01b9c$composeEventHandlers(triggerProps.onPointerDown, (event)=>{
|
|
177
181
|
// prevent implicit pointer capture
|
|
178
182
|
// https://www.w3.org/TR/pointerevents3/#implicit-pointer-capture
|