@radix-ui/react-select 0.1.2-rc.42 → 0.1.2-rc.45
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 +13 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +71 -43
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +74 -46
- package/dist/index.module.js.map +1 -1
- package/package.json +18 -16
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { DismissableLayer } from "@radix-ui/react-dismissable-layer";
|
|
3
3
|
import { FocusScope } from "@radix-ui/react-focus-scope";
|
|
4
|
+
import { UnstablePortal } from "@radix-ui/react-portal";
|
|
4
5
|
import * as Radix from "@radix-ui/react-primitive";
|
|
5
6
|
import { Primitive } from "@radix-ui/react-primitive";
|
|
7
|
+
import { RemoveScroll } from "react-remove-scroll";
|
|
6
8
|
type Direction = 'ltr' | 'rtl';
|
|
7
9
|
export const createSelectScope: import("@radix-ui/react-context").CreateScope;
|
|
10
|
+
type RemoveScrollProps = React.ComponentProps<typeof RemoveScroll>;
|
|
8
11
|
export interface SelectProps {
|
|
9
12
|
children?: React.ReactNode;
|
|
10
13
|
value?: string;
|
|
@@ -16,6 +19,10 @@ export interface SelectProps {
|
|
|
16
19
|
dir?: Direction;
|
|
17
20
|
name?: string;
|
|
18
21
|
autoComplete?: string;
|
|
22
|
+
/**
|
|
23
|
+
* @see https://github.com/theKashey/react-remove-scroll#usage
|
|
24
|
+
*/
|
|
25
|
+
allowPinchZoom?: RemoveScrollProps['allowPinchZoom'];
|
|
19
26
|
}
|
|
20
27
|
export const Select: React.FC<SelectProps>;
|
|
21
28
|
type PrimitiveButtonProps = Radix.ComponentPropsWithoutRef<typeof Primitive.button>;
|
|
@@ -30,6 +37,11 @@ export const SelectValue: React.ForwardRefExoticComponent<SelectValueProps & Rea
|
|
|
30
37
|
export interface SelectIconProps extends PrimitiveSpanProps {
|
|
31
38
|
}
|
|
32
39
|
export const SelectIcon: React.ForwardRefExoticComponent<SelectIconProps & React.RefAttributes<HTMLSpanElement>>;
|
|
40
|
+
type PortalProps = React.ComponentPropsWithoutRef<typeof UnstablePortal>;
|
|
41
|
+
export interface SelectPortalProps extends Omit<PortalProps, 'asChild'> {
|
|
42
|
+
children?: React.ReactNode;
|
|
43
|
+
}
|
|
44
|
+
export const SelectPortal: React.FC<SelectPortalProps>;
|
|
33
45
|
export interface SelectContentProps extends SelectContentImplProps {
|
|
34
46
|
}
|
|
35
47
|
export const SelectContent: React.ForwardRefExoticComponent<SelectContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
@@ -80,6 +92,7 @@ export const Root: React.FC<SelectProps>;
|
|
|
80
92
|
export const Trigger: React.ForwardRefExoticComponent<SelectTriggerProps & React.RefAttributes<HTMLButtonElement>>;
|
|
81
93
|
export const Value: React.ForwardRefExoticComponent<SelectValueProps & React.RefAttributes<HTMLSpanElement>>;
|
|
82
94
|
export const Icon: React.ForwardRefExoticComponent<SelectIconProps & React.RefAttributes<HTMLSpanElement>>;
|
|
95
|
+
export const Portal: React.FC<SelectPortalProps>;
|
|
83
96
|
export const Content: React.ForwardRefExoticComponent<SelectContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
84
97
|
export const Viewport: React.ForwardRefExoticComponent<SelectViewportProps & React.RefAttributes<HTMLDivElement>>;
|
|
85
98
|
export const Group: React.ForwardRefExoticComponent<SelectGroupProps & React.RefAttributes<HTMLDivElement>>;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":"
|
|
1
|
+
{"mappings":";;;;;;;AA2BA,iBAAiB,KAAK,GAAG,KAAK,CAAC;AAkB/B,OAAA,wFAEE,CAAC;AA8BH,yBAAyB,MAAM,cAAc,CAAC,mBAAmB,CAAC,CAAC;AACnE;IACE,QAAQ,CAAC,EAAE,MAAM,SAAS,CAAC;IAC3B,KAAK,CAAC,EAA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AAC;AAC9B,OAAA,MAAM,+FAAmB,CAAC;AAC1B,OAAA,MAAM,6FAAiB,CAAC;AACxB,OAAA,MAAM,mCAAqB,CAAC;AAC5B,OAAA,MAAM,kGAAuB,CAAC;AAC9B,OAAA,MAAM,oGAAyB,CAAC;AAChC,OAAA,MAAM,8FAAmB,CAAC;AAC1B,OAAA,MAAM,8FAAmB,CAAC;AAC1B,OAAA,MAAM,4FAAiB,CAAC;AACxB,OAAA,MAAM,qGAAyB,CAAC;AAChC,OAAA,MAAM,+GAAmC,CAAC;AAC1C,OAAA,MAAM,gHAAqC,CAAC;AAC5C,OAAA,MAAM,oHAAyC,CAAC;AAChD,OAAA,MAAM,sGAA2B,CAAC","sources":["packages/react/select/src/packages/react/select/src/Select.tsx","packages/react/select/src/packages/react/select/src/index.ts","packages/react/select/src/index.ts"],"sourcesContent":[null,null,"export * from './Select';\n"],"names":[],"version":3,"file":"index.d.ts.map"}
|
package/dist/index.js
CHANGED
|
@@ -6,13 +6,15 @@ var $cg2C9$radixuiprimitive = require("@radix-ui/primitive");
|
|
|
6
6
|
var $cg2C9$radixuireactcollection = require("@radix-ui/react-collection");
|
|
7
7
|
var $cg2C9$radixuireactcomposerefs = require("@radix-ui/react-compose-refs");
|
|
8
8
|
var $cg2C9$radixuireactcontext = require("@radix-ui/react-context");
|
|
9
|
+
var $cg2C9$radixuireactdirection = require("@radix-ui/react-direction");
|
|
9
10
|
var $cg2C9$radixuireactdismissablelayer = require("@radix-ui/react-dismissable-layer");
|
|
11
|
+
var $cg2C9$radixuireactfocusguards = require("@radix-ui/react-focus-guards");
|
|
10
12
|
var $cg2C9$radixuireactfocusscope = require("@radix-ui/react-focus-scope");
|
|
11
13
|
var $cg2C9$radixuireactid = require("@radix-ui/react-id");
|
|
12
14
|
var $cg2C9$radixuireactlabel = require("@radix-ui/react-label");
|
|
13
15
|
var $cg2C9$radixuireactportal = require("@radix-ui/react-portal");
|
|
14
16
|
var $cg2C9$radixuireactprimitive = require("@radix-ui/react-primitive");
|
|
15
|
-
var $cg2C9$
|
|
17
|
+
var $cg2C9$radixuireactslot = require("@radix-ui/react-slot");
|
|
16
18
|
var $cg2C9$radixuireactusecallbackref = require("@radix-ui/react-use-callback-ref");
|
|
17
19
|
var $cg2C9$radixuireactusecontrollablestate = require("@radix-ui/react-use-controllable-state");
|
|
18
20
|
var $cg2C9$radixuireactuselayouteffect = require("@radix-ui/react-use-layout-effect");
|
|
@@ -50,6 +52,7 @@ $parcel$export($1345bda09ffc1bc6$exports, "Select", () => $1345bda09ffc1bc6$expo
|
|
|
50
52
|
$parcel$export($1345bda09ffc1bc6$exports, "SelectTrigger", () => $1345bda09ffc1bc6$export$3ac1e88a1c0b9f1);
|
|
51
53
|
$parcel$export($1345bda09ffc1bc6$exports, "SelectValue", () => $1345bda09ffc1bc6$export$e288731fd71264f0);
|
|
52
54
|
$parcel$export($1345bda09ffc1bc6$exports, "SelectIcon", () => $1345bda09ffc1bc6$export$99b400cabb58c515);
|
|
55
|
+
$parcel$export($1345bda09ffc1bc6$exports, "SelectPortal", () => $1345bda09ffc1bc6$export$b2af6c9944296213);
|
|
53
56
|
$parcel$export($1345bda09ffc1bc6$exports, "SelectContent", () => $1345bda09ffc1bc6$export$c973a4b3cb86a03d);
|
|
54
57
|
$parcel$export($1345bda09ffc1bc6$exports, "SelectViewport", () => $1345bda09ffc1bc6$export$9ed6e7b40248d36d);
|
|
55
58
|
$parcel$export($1345bda09ffc1bc6$exports, "SelectGroup", () => $1345bda09ffc1bc6$export$ee25a334c55de1f4);
|
|
@@ -64,6 +67,7 @@ $parcel$export($1345bda09ffc1bc6$exports, "Root", () => $1345bda09ffc1bc6$export
|
|
|
64
67
|
$parcel$export($1345bda09ffc1bc6$exports, "Trigger", () => $1345bda09ffc1bc6$export$41fb9f06171c75f4);
|
|
65
68
|
$parcel$export($1345bda09ffc1bc6$exports, "Value", () => $1345bda09ffc1bc6$export$4c8d1a57a761ef94);
|
|
66
69
|
$parcel$export($1345bda09ffc1bc6$exports, "Icon", () => $1345bda09ffc1bc6$export$f04a61298a47a40f);
|
|
70
|
+
$parcel$export($1345bda09ffc1bc6$exports, "Portal", () => $1345bda09ffc1bc6$export$602eac185826482c);
|
|
67
71
|
$parcel$export($1345bda09ffc1bc6$exports, "Content", () => $1345bda09ffc1bc6$export$7c6e2c02157bb7d2);
|
|
68
72
|
$parcel$export($1345bda09ffc1bc6$exports, "Viewport", () => $1345bda09ffc1bc6$export$d5c6c08dc2d3ca7);
|
|
69
73
|
$parcel$export($1345bda09ffc1bc6$exports, "Group", () => $1345bda09ffc1bc6$export$eb2fcfdbd7ba97d4);
|
|
@@ -93,6 +97,8 @@ $parcel$export($1345bda09ffc1bc6$exports, "Separator", () => $1345bda09ffc1bc6$e
|
|
|
93
97
|
|
|
94
98
|
|
|
95
99
|
|
|
100
|
+
|
|
101
|
+
|
|
96
102
|
|
|
97
103
|
|
|
98
104
|
|
|
@@ -114,8 +120,9 @@ const [$1345bda09ffc1bc6$var$createSelectContext, $1345bda09ffc1bc6$export$28672
|
|
|
114
120
|
$1345bda09ffc1bc6$var$createCollectionScope
|
|
115
121
|
]);
|
|
116
122
|
const [$1345bda09ffc1bc6$var$SelectProvider, $1345bda09ffc1bc6$var$useSelectContext] = $1345bda09ffc1bc6$var$createSelectContext($1345bda09ffc1bc6$var$SELECT_NAME);
|
|
123
|
+
const [$1345bda09ffc1bc6$var$SelectNativeOptionsProvider, $1345bda09ffc1bc6$var$useSelectNativeOptionsContext] = $1345bda09ffc1bc6$var$createSelectContext($1345bda09ffc1bc6$var$SELECT_NAME);
|
|
117
124
|
const $1345bda09ffc1bc6$export$ef9b1a59e592288f = (props)=>{
|
|
118
|
-
const { __scopeSelect: __scopeSelect , children: children , open: openProp , defaultOpen: defaultOpen , onOpenChange: onOpenChange , value: valueProp , defaultValue: defaultValue , onValueChange: onValueChange , dir: dir , name: name , autoComplete: autoComplete } = props;
|
|
125
|
+
const { __scopeSelect: __scopeSelect , children: children , open: openProp , defaultOpen: defaultOpen , onOpenChange: onOpenChange , value: valueProp , defaultValue: defaultValue , onValueChange: onValueChange , dir: dir , name: name , autoComplete: autoComplete , allowPinchZoom: allowPinchZoom } = props;
|
|
119
126
|
const [trigger, setTrigger] = $cg2C9$react.useState(null);
|
|
120
127
|
const [valueNode, setValueNode] = $cg2C9$react.useState(null);
|
|
121
128
|
const [valueNodeHasChildren, setValueNodeHasChildren] = $cg2C9$react.useState(false);
|
|
@@ -130,7 +137,15 @@ const $1345bda09ffc1bc6$export$ef9b1a59e592288f = (props)=>{
|
|
|
130
137
|
defaultProp: defaultValue,
|
|
131
138
|
onChange: onValueChange
|
|
132
139
|
});
|
|
133
|
-
const triggerPointerDownPosRef = $cg2C9$react.useRef(null);
|
|
140
|
+
const triggerPointerDownPosRef = $cg2C9$react.useRef(null); // We set this to true by default so that events bubble to forms without JS (SSR)
|
|
141
|
+
const isFormControl = trigger ? Boolean(trigger.closest('form')) : true;
|
|
142
|
+
const [nativeOptionsSet, setNativeOptionsSet] = $cg2C9$react.useState(new Set()); // The native `select` only associates the correct default value if the corresponding
|
|
143
|
+
// `option` is rendered as a child **at the same time** as itself.
|
|
144
|
+
// Because it might take a few renders for our items to gather the information to build
|
|
145
|
+
// the native `option`(s), we generate a key on the `select` to make sure React re-builds it
|
|
146
|
+
// each time the options change.
|
|
147
|
+
const nativeSelectKey = Array.from(nativeOptionsSet).map((option)=>option.props.value
|
|
148
|
+
).join(';');
|
|
134
149
|
return /*#__PURE__*/ $cg2C9$react.createElement($1345bda09ffc1bc6$var$SelectProvider, {
|
|
135
150
|
scope: __scopeSelect,
|
|
136
151
|
trigger: trigger,
|
|
@@ -145,12 +160,33 @@ const $1345bda09ffc1bc6$export$ef9b1a59e592288f = (props)=>{
|
|
|
145
160
|
open: open,
|
|
146
161
|
onOpenChange: setOpen,
|
|
147
162
|
dir: direction,
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
triggerPointerDownPosRef: triggerPointerDownPosRef
|
|
163
|
+
triggerPointerDownPosRef: triggerPointerDownPosRef,
|
|
164
|
+
allowPinchZoom: allowPinchZoom
|
|
151
165
|
}, /*#__PURE__*/ $cg2C9$react.createElement($1345bda09ffc1bc6$var$Collection.Provider, {
|
|
152
166
|
scope: __scopeSelect
|
|
153
|
-
},
|
|
167
|
+
}, /*#__PURE__*/ $cg2C9$react.createElement($1345bda09ffc1bc6$var$SelectNativeOptionsProvider, {
|
|
168
|
+
scope: props.__scopeSelect,
|
|
169
|
+
onNativeOptionAdd: $cg2C9$react.useCallback((option)=>{
|
|
170
|
+
setNativeOptionsSet((prev)=>new Set(prev).add(option)
|
|
171
|
+
);
|
|
172
|
+
}, []),
|
|
173
|
+
onNativeOptionRemove: $cg2C9$react.useCallback((option)=>{
|
|
174
|
+
setNativeOptionsSet((prev)=>{
|
|
175
|
+
const optionsSet = new Set(prev);
|
|
176
|
+
optionsSet.delete(option);
|
|
177
|
+
return optionsSet;
|
|
178
|
+
});
|
|
179
|
+
}, [])
|
|
180
|
+
}, children)), isFormControl ? /*#__PURE__*/ $cg2C9$react.createElement($1345bda09ffc1bc6$var$BubbleSelect, {
|
|
181
|
+
key: nativeSelectKey,
|
|
182
|
+
"aria-hidden": true,
|
|
183
|
+
tabIndex: -1,
|
|
184
|
+
name: name,
|
|
185
|
+
autoComplete: autoComplete,
|
|
186
|
+
value: value // enable form autofill
|
|
187
|
+
,
|
|
188
|
+
onChange: (event)=>setValue(event.target.value)
|
|
189
|
+
}, Array.from(nativeOptionsSet)) : null);
|
|
154
190
|
};
|
|
155
191
|
/*#__PURE__*/ Object.assign($1345bda09ffc1bc6$export$ef9b1a59e592288f, {
|
|
156
192
|
displayName: $1345bda09ffc1bc6$var$SELECT_NAME
|
|
@@ -263,47 +299,27 @@ const $1345bda09ffc1bc6$export$99b400cabb58c515 = /*#__PURE__*/ $cg2C9$react.for
|
|
|
263
299
|
/*#__PURE__*/ Object.assign($1345bda09ffc1bc6$export$99b400cabb58c515, {
|
|
264
300
|
displayName: $1345bda09ffc1bc6$var$ICON_NAME
|
|
265
301
|
});
|
|
302
|
+
/* -------------------------------------------------------------------------------------------------
|
|
303
|
+
* SelectPortal
|
|
304
|
+
* -----------------------------------------------------------------------------------------------*/ const $1345bda09ffc1bc6$var$PORTAL_NAME = 'SelectPortal';
|
|
305
|
+
const $1345bda09ffc1bc6$export$b2af6c9944296213 = (props)=>{
|
|
306
|
+
return /*#__PURE__*/ $cg2C9$react.createElement($cg2C9$radixuireactportal.UnstablePortal, ($parcel$interopDefault($cg2C9$babelruntimehelpersextends))({
|
|
307
|
+
asChild: true
|
|
308
|
+
}, props));
|
|
309
|
+
};
|
|
310
|
+
/*#__PURE__*/ Object.assign($1345bda09ffc1bc6$export$b2af6c9944296213, {
|
|
311
|
+
displayName: $1345bda09ffc1bc6$var$PORTAL_NAME
|
|
312
|
+
});
|
|
266
313
|
/* -------------------------------------------------------------------------------------------------
|
|
267
314
|
* SelectContent
|
|
268
315
|
* -----------------------------------------------------------------------------------------------*/ const $1345bda09ffc1bc6$var$CONTENT_NAME = 'SelectContent';
|
|
269
|
-
const [$1345bda09ffc1bc6$var$SelectNativeOptionsProvider, $1345bda09ffc1bc6$var$useSelectNativeOptionsContext] = $1345bda09ffc1bc6$var$createSelectContext($1345bda09ffc1bc6$var$CONTENT_NAME);
|
|
270
316
|
const $1345bda09ffc1bc6$export$c973a4b3cb86a03d = /*#__PURE__*/ $cg2C9$react.forwardRef((props, forwardedRef)=>{
|
|
271
317
|
const context = $1345bda09ffc1bc6$var$useSelectContext($1345bda09ffc1bc6$var$CONTENT_NAME, props.__scopeSelect);
|
|
272
|
-
const [fragment, setFragment] = $cg2C9$react.useState(); //
|
|
273
|
-
const isFormControl = context.trigger ? Boolean(context.trigger.closest('form')) : true;
|
|
274
|
-
const [nativeOptionsSet, setNativeOptionsSet] = $cg2C9$react.useState(new Set()); // The native `select` only associates the correct default value if the corresponding
|
|
275
|
-
// `option` is rendered as a child **at the same time** as itself.
|
|
276
|
-
// Because it might take a few renders for our items to gather the information to build
|
|
277
|
-
// the native `option`(s), we generate a key on the `select` to make sure React re-builds it
|
|
278
|
-
// each time the options change.
|
|
279
|
-
const nativeSelectKey = Array.from(nativeOptionsSet).map((option)=>option.props.value
|
|
280
|
-
).join(';'); // setting the fragment in `useLayoutEffect` as `DocumentFragment` doesn't exist on the server
|
|
318
|
+
const [fragment, setFragment] = $cg2C9$react.useState(); // setting the fragment in `useLayoutEffect` as `DocumentFragment` doesn't exist on the server
|
|
281
319
|
$cg2C9$radixuireactuselayouteffect.useLayoutEffect(()=>{
|
|
282
320
|
setFragment(new DocumentFragment());
|
|
283
321
|
}, []);
|
|
284
|
-
return /*#__PURE__*/ $cg2C9$react.createElement($1345bda09ffc1bc6$var$
|
|
285
|
-
scope: props.__scopeSelect,
|
|
286
|
-
onNativeOptionAdd: $cg2C9$react.useCallback((option)=>{
|
|
287
|
-
setNativeOptionsSet((prev)=>new Set(prev).add(option)
|
|
288
|
-
);
|
|
289
|
-
}, []),
|
|
290
|
-
onNativeOptionRemove: $cg2C9$react.useCallback((option)=>{
|
|
291
|
-
setNativeOptionsSet((prev)=>{
|
|
292
|
-
const optionsSet = new Set(prev);
|
|
293
|
-
optionsSet.delete(option);
|
|
294
|
-
return optionsSet;
|
|
295
|
-
});
|
|
296
|
-
}, [])
|
|
297
|
-
}, isFormControl ? /*#__PURE__*/ $cg2C9$react.createElement($1345bda09ffc1bc6$var$BubbleSelect, {
|
|
298
|
-
key: nativeSelectKey,
|
|
299
|
-
"aria-hidden": true,
|
|
300
|
-
tabIndex: -1,
|
|
301
|
-
name: context.name,
|
|
302
|
-
autoComplete: context.autoComplete,
|
|
303
|
-
value: context.value // enable form autofill
|
|
304
|
-
,
|
|
305
|
-
onChange: (event)=>context.onValueChange(event.target.value)
|
|
306
|
-
}, Array.from(nativeOptionsSet)) : null, context.open ? /*#__PURE__*/ $cg2C9$react.createElement($1345bda09ffc1bc6$var$SelectContentImpl, ($parcel$interopDefault($cg2C9$babelruntimehelpersextends))({}, props, {
|
|
322
|
+
return /*#__PURE__*/ $cg2C9$react.createElement($cg2C9$react.Fragment, null, context.open ? /*#__PURE__*/ $cg2C9$react.createElement($1345bda09ffc1bc6$var$SelectContentImpl, ($parcel$interopDefault($cg2C9$babelruntimehelpersextends))({}, props, {
|
|
307
323
|
ref: forwardedRef
|
|
308
324
|
})) : fragment ? /*#__PURE__*/ $cg2C9$reactdom.createPortal(/*#__PURE__*/ $cg2C9$react.createElement($1345bda09ffc1bc6$var$SelectContentProvider, {
|
|
309
325
|
scope: props.__scopeSelect
|
|
@@ -335,6 +351,14 @@ const $1345bda09ffc1bc6$var$SelectContentImpl = /*#__PURE__*/ $cg2C9$react.forwa
|
|
|
335
351
|
if (content) return $cg2C9$ariahidden.hideOthers(content);
|
|
336
352
|
}, [
|
|
337
353
|
content
|
|
354
|
+
]); // Make sure the whole tree has focus guards as our `Select` may be
|
|
355
|
+
// the last element in the DOM (because of the `Portal`)
|
|
356
|
+
$cg2C9$radixuireactfocusguards.useFocusGuards();
|
|
357
|
+
const [contentZIndex, setContentZIndex] = $cg2C9$react.useState();
|
|
358
|
+
$cg2C9$radixuireactuselayouteffect.useLayoutEffect(()=>{
|
|
359
|
+
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
360
|
+
}, [
|
|
361
|
+
content
|
|
338
362
|
]);
|
|
339
363
|
const focusFirst = $cg2C9$react.useCallback((candidates)=>{
|
|
340
364
|
const [firstItem, ...restItems] = getItems().map((item)=>item.ref.current
|
|
@@ -582,13 +606,16 @@ const $1345bda09ffc1bc6$var$SelectContentImpl = /*#__PURE__*/ $cg2C9$react.forwa
|
|
|
582
606
|
isPositioned: isPositioned,
|
|
583
607
|
shouldExpandOnScrollRef: shouldExpandOnScrollRef,
|
|
584
608
|
searchRef: searchRef
|
|
585
|
-
}, /*#__PURE__*/ $cg2C9$react.createElement($cg2C9$
|
|
609
|
+
}, /*#__PURE__*/ $cg2C9$react.createElement($cg2C9$reactremovescroll.RemoveScroll, {
|
|
610
|
+
as: $cg2C9$radixuireactslot.Slot,
|
|
611
|
+
allowPinchZoom: context.allowPinchZoom
|
|
612
|
+
}, /*#__PURE__*/ $cg2C9$react.createElement("div", {
|
|
586
613
|
ref: setContentWrapper,
|
|
587
614
|
style: {
|
|
588
615
|
display: 'flex',
|
|
589
616
|
flexDirection: 'column',
|
|
590
617
|
position: 'fixed',
|
|
591
|
-
zIndex:
|
|
618
|
+
zIndex: contentZIndex
|
|
592
619
|
}
|
|
593
620
|
}, /*#__PURE__*/ $cg2C9$react.createElement($cg2C9$radixuireactfocusscope.FocusScope, {
|
|
594
621
|
asChild: true // we make sure we're not trapping once it's been closed
|
|
@@ -663,7 +690,7 @@ const $1345bda09ffc1bc6$var$SelectContentImpl = /*#__PURE__*/ $cg2C9$react.forwa
|
|
|
663
690
|
event.preventDefault();
|
|
664
691
|
}
|
|
665
692
|
})
|
|
666
|
-
}))))))
|
|
693
|
+
}))))));
|
|
667
694
|
});
|
|
668
695
|
/* -------------------------------------------------------------------------------------------------
|
|
669
696
|
* SelectViewport
|
|
@@ -1144,6 +1171,7 @@ const $1345bda09ffc1bc6$export$be92b6f5f03c0fe9 = $1345bda09ffc1bc6$export$ef9b1
|
|
|
1144
1171
|
const $1345bda09ffc1bc6$export$41fb9f06171c75f4 = $1345bda09ffc1bc6$export$3ac1e88a1c0b9f1;
|
|
1145
1172
|
const $1345bda09ffc1bc6$export$4c8d1a57a761ef94 = $1345bda09ffc1bc6$export$e288731fd71264f0;
|
|
1146
1173
|
const $1345bda09ffc1bc6$export$f04a61298a47a40f = $1345bda09ffc1bc6$export$99b400cabb58c515;
|
|
1174
|
+
const $1345bda09ffc1bc6$export$602eac185826482c = $1345bda09ffc1bc6$export$b2af6c9944296213;
|
|
1147
1175
|
const $1345bda09ffc1bc6$export$7c6e2c02157bb7d2 = $1345bda09ffc1bc6$export$c973a4b3cb86a03d;
|
|
1148
1176
|
const $1345bda09ffc1bc6$export$d5c6c08dc2d3ca7 = $1345bda09ffc1bc6$export$9ed6e7b40248d36d;
|
|
1149
1177
|
const $1345bda09ffc1bc6$export$eb2fcfdbd7ba97d4 = $1345bda09ffc1bc6$export$ee25a334c55de1f4;
|