@radix-ui/react-select 0.1.2-rc.43 → 0.1.2-rc.46
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 +67 -43
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +69 -45
- package/dist/index.module.js.map +1 -1
- package/package.json +18 -17
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 { Portal as _Portal1 } 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 _Portal1>;
|
|
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,EA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CAAC;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
|
@@ -8,6 +8,7 @@ var $cg2C9$radixuireactcomposerefs = require("@radix-ui/react-compose-refs");
|
|
|
8
8
|
var $cg2C9$radixuireactcontext = require("@radix-ui/react-context");
|
|
9
9
|
var $cg2C9$radixuireactdirection = require("@radix-ui/react-direction");
|
|
10
10
|
var $cg2C9$radixuireactdismissablelayer = require("@radix-ui/react-dismissable-layer");
|
|
11
|
+
var $cg2C9$radixuireactfocusguards = require("@radix-ui/react-focus-guards");
|
|
11
12
|
var $cg2C9$radixuireactfocusscope = require("@radix-ui/react-focus-scope");
|
|
12
13
|
var $cg2C9$radixuireactid = require("@radix-ui/react-id");
|
|
13
14
|
var $cg2C9$radixuireactlabel = require("@radix-ui/react-label");
|
|
@@ -51,6 +52,7 @@ $parcel$export($1345bda09ffc1bc6$exports, "Select", () => $1345bda09ffc1bc6$expo
|
|
|
51
52
|
$parcel$export($1345bda09ffc1bc6$exports, "SelectTrigger", () => $1345bda09ffc1bc6$export$3ac1e88a1c0b9f1);
|
|
52
53
|
$parcel$export($1345bda09ffc1bc6$exports, "SelectValue", () => $1345bda09ffc1bc6$export$e288731fd71264f0);
|
|
53
54
|
$parcel$export($1345bda09ffc1bc6$exports, "SelectIcon", () => $1345bda09ffc1bc6$export$99b400cabb58c515);
|
|
55
|
+
$parcel$export($1345bda09ffc1bc6$exports, "SelectPortal", () => $1345bda09ffc1bc6$export$b2af6c9944296213);
|
|
54
56
|
$parcel$export($1345bda09ffc1bc6$exports, "SelectContent", () => $1345bda09ffc1bc6$export$c973a4b3cb86a03d);
|
|
55
57
|
$parcel$export($1345bda09ffc1bc6$exports, "SelectViewport", () => $1345bda09ffc1bc6$export$9ed6e7b40248d36d);
|
|
56
58
|
$parcel$export($1345bda09ffc1bc6$exports, "SelectGroup", () => $1345bda09ffc1bc6$export$ee25a334c55de1f4);
|
|
@@ -65,6 +67,7 @@ $parcel$export($1345bda09ffc1bc6$exports, "Root", () => $1345bda09ffc1bc6$export
|
|
|
65
67
|
$parcel$export($1345bda09ffc1bc6$exports, "Trigger", () => $1345bda09ffc1bc6$export$41fb9f06171c75f4);
|
|
66
68
|
$parcel$export($1345bda09ffc1bc6$exports, "Value", () => $1345bda09ffc1bc6$export$4c8d1a57a761ef94);
|
|
67
69
|
$parcel$export($1345bda09ffc1bc6$exports, "Icon", () => $1345bda09ffc1bc6$export$f04a61298a47a40f);
|
|
70
|
+
$parcel$export($1345bda09ffc1bc6$exports, "Portal", () => $1345bda09ffc1bc6$export$602eac185826482c);
|
|
68
71
|
$parcel$export($1345bda09ffc1bc6$exports, "Content", () => $1345bda09ffc1bc6$export$7c6e2c02157bb7d2);
|
|
69
72
|
$parcel$export($1345bda09ffc1bc6$exports, "Viewport", () => $1345bda09ffc1bc6$export$d5c6c08dc2d3ca7);
|
|
70
73
|
$parcel$export($1345bda09ffc1bc6$exports, "Group", () => $1345bda09ffc1bc6$export$eb2fcfdbd7ba97d4);
|
|
@@ -96,6 +99,7 @@ $parcel$export($1345bda09ffc1bc6$exports, "Separator", () => $1345bda09ffc1bc6$e
|
|
|
96
99
|
|
|
97
100
|
|
|
98
101
|
|
|
102
|
+
|
|
99
103
|
|
|
100
104
|
|
|
101
105
|
const $1345bda09ffc1bc6$var$OPEN_KEYS = [
|
|
@@ -116,8 +120,9 @@ const [$1345bda09ffc1bc6$var$createSelectContext, $1345bda09ffc1bc6$export$28672
|
|
|
116
120
|
$1345bda09ffc1bc6$var$createCollectionScope
|
|
117
121
|
]);
|
|
118
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);
|
|
119
124
|
const $1345bda09ffc1bc6$export$ef9b1a59e592288f = (props)=>{
|
|
120
|
-
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;
|
|
121
126
|
const [trigger, setTrigger] = $cg2C9$react.useState(null);
|
|
122
127
|
const [valueNode, setValueNode] = $cg2C9$react.useState(null);
|
|
123
128
|
const [valueNodeHasChildren, setValueNodeHasChildren] = $cg2C9$react.useState(false);
|
|
@@ -132,7 +137,15 @@ const $1345bda09ffc1bc6$export$ef9b1a59e592288f = (props)=>{
|
|
|
132
137
|
defaultProp: defaultValue,
|
|
133
138
|
onChange: onValueChange
|
|
134
139
|
});
|
|
135
|
-
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(';');
|
|
136
149
|
return /*#__PURE__*/ $cg2C9$react.createElement($1345bda09ffc1bc6$var$SelectProvider, {
|
|
137
150
|
scope: __scopeSelect,
|
|
138
151
|
trigger: trigger,
|
|
@@ -147,12 +160,33 @@ const $1345bda09ffc1bc6$export$ef9b1a59e592288f = (props)=>{
|
|
|
147
160
|
open: open,
|
|
148
161
|
onOpenChange: setOpen,
|
|
149
162
|
dir: direction,
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
triggerPointerDownPosRef: triggerPointerDownPosRef
|
|
163
|
+
triggerPointerDownPosRef: triggerPointerDownPosRef,
|
|
164
|
+
allowPinchZoom: allowPinchZoom
|
|
153
165
|
}, /*#__PURE__*/ $cg2C9$react.createElement($1345bda09ffc1bc6$var$Collection.Provider, {
|
|
154
166
|
scope: __scopeSelect
|
|
155
|
-
},
|
|
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);
|
|
156
190
|
};
|
|
157
191
|
/*#__PURE__*/ Object.assign($1345bda09ffc1bc6$export$ef9b1a59e592288f, {
|
|
158
192
|
displayName: $1345bda09ffc1bc6$var$SELECT_NAME
|
|
@@ -265,47 +299,27 @@ const $1345bda09ffc1bc6$export$99b400cabb58c515 = /*#__PURE__*/ $cg2C9$react.for
|
|
|
265
299
|
/*#__PURE__*/ Object.assign($1345bda09ffc1bc6$export$99b400cabb58c515, {
|
|
266
300
|
displayName: $1345bda09ffc1bc6$var$ICON_NAME
|
|
267
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.Portal, ($parcel$interopDefault($cg2C9$babelruntimehelpersextends))({
|
|
307
|
+
asChild: true
|
|
308
|
+
}, props));
|
|
309
|
+
};
|
|
310
|
+
/*#__PURE__*/ Object.assign($1345bda09ffc1bc6$export$b2af6c9944296213, {
|
|
311
|
+
displayName: $1345bda09ffc1bc6$var$PORTAL_NAME
|
|
312
|
+
});
|
|
268
313
|
/* -------------------------------------------------------------------------------------------------
|
|
269
314
|
* SelectContent
|
|
270
315
|
* -----------------------------------------------------------------------------------------------*/ const $1345bda09ffc1bc6$var$CONTENT_NAME = 'SelectContent';
|
|
271
|
-
const [$1345bda09ffc1bc6$var$SelectNativeOptionsProvider, $1345bda09ffc1bc6$var$useSelectNativeOptionsContext] = $1345bda09ffc1bc6$var$createSelectContext($1345bda09ffc1bc6$var$CONTENT_NAME);
|
|
272
316
|
const $1345bda09ffc1bc6$export$c973a4b3cb86a03d = /*#__PURE__*/ $cg2C9$react.forwardRef((props, forwardedRef)=>{
|
|
273
317
|
const context = $1345bda09ffc1bc6$var$useSelectContext($1345bda09ffc1bc6$var$CONTENT_NAME, props.__scopeSelect);
|
|
274
|
-
const [fragment, setFragment] = $cg2C9$react.useState(); //
|
|
275
|
-
const isFormControl = context.trigger ? Boolean(context.trigger.closest('form')) : true;
|
|
276
|
-
const [nativeOptionsSet, setNativeOptionsSet] = $cg2C9$react.useState(new Set()); // The native `select` only associates the correct default value if the corresponding
|
|
277
|
-
// `option` is rendered as a child **at the same time** as itself.
|
|
278
|
-
// Because it might take a few renders for our items to gather the information to build
|
|
279
|
-
// the native `option`(s), we generate a key on the `select` to make sure React re-builds it
|
|
280
|
-
// each time the options change.
|
|
281
|
-
const nativeSelectKey = Array.from(nativeOptionsSet).map((option)=>option.props.value
|
|
282
|
-
).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
|
|
283
319
|
$cg2C9$radixuireactuselayouteffect.useLayoutEffect(()=>{
|
|
284
320
|
setFragment(new DocumentFragment());
|
|
285
321
|
}, []);
|
|
286
|
-
return /*#__PURE__*/ $cg2C9$react.createElement($1345bda09ffc1bc6$var$
|
|
287
|
-
scope: props.__scopeSelect,
|
|
288
|
-
onNativeOptionAdd: $cg2C9$react.useCallback((option)=>{
|
|
289
|
-
setNativeOptionsSet((prev)=>new Set(prev).add(option)
|
|
290
|
-
);
|
|
291
|
-
}, []),
|
|
292
|
-
onNativeOptionRemove: $cg2C9$react.useCallback((option)=>{
|
|
293
|
-
setNativeOptionsSet((prev)=>{
|
|
294
|
-
const optionsSet = new Set(prev);
|
|
295
|
-
optionsSet.delete(option);
|
|
296
|
-
return optionsSet;
|
|
297
|
-
});
|
|
298
|
-
}, [])
|
|
299
|
-
}, isFormControl ? /*#__PURE__*/ $cg2C9$react.createElement($1345bda09ffc1bc6$var$BubbleSelect, {
|
|
300
|
-
key: nativeSelectKey,
|
|
301
|
-
"aria-hidden": true,
|
|
302
|
-
tabIndex: -1,
|
|
303
|
-
name: context.name,
|
|
304
|
-
autoComplete: context.autoComplete,
|
|
305
|
-
value: context.value // enable form autofill
|
|
306
|
-
,
|
|
307
|
-
onChange: (event)=>context.onValueChange(event.target.value)
|
|
308
|
-
}, 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, {
|
|
309
323
|
ref: forwardedRef
|
|
310
324
|
})) : fragment ? /*#__PURE__*/ $cg2C9$reactdom.createPortal(/*#__PURE__*/ $cg2C9$react.createElement($1345bda09ffc1bc6$var$SelectContentProvider, {
|
|
311
325
|
scope: props.__scopeSelect
|
|
@@ -337,6 +351,14 @@ const $1345bda09ffc1bc6$var$SelectContentImpl = /*#__PURE__*/ $cg2C9$react.forwa
|
|
|
337
351
|
if (content) return $cg2C9$ariahidden.hideOthers(content);
|
|
338
352
|
}, [
|
|
339
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
|
|
340
362
|
]);
|
|
341
363
|
const focusFirst = $cg2C9$react.useCallback((candidates)=>{
|
|
342
364
|
const [firstItem, ...restItems] = getItems().map((item)=>item.ref.current
|
|
@@ -584,15 +606,16 @@ const $1345bda09ffc1bc6$var$SelectContentImpl = /*#__PURE__*/ $cg2C9$react.forwa
|
|
|
584
606
|
isPositioned: isPositioned,
|
|
585
607
|
shouldExpandOnScrollRef: shouldExpandOnScrollRef,
|
|
586
608
|
searchRef: searchRef
|
|
587
|
-
}, /*#__PURE__*/ $cg2C9$react.createElement($cg2C9$
|
|
588
|
-
as: $cg2C9$radixuireactslot.Slot
|
|
609
|
+
}, /*#__PURE__*/ $cg2C9$react.createElement($cg2C9$reactremovescroll.RemoveScroll, {
|
|
610
|
+
as: $cg2C9$radixuireactslot.Slot,
|
|
611
|
+
allowPinchZoom: context.allowPinchZoom
|
|
589
612
|
}, /*#__PURE__*/ $cg2C9$react.createElement("div", {
|
|
590
613
|
ref: setContentWrapper,
|
|
591
614
|
style: {
|
|
592
615
|
display: 'flex',
|
|
593
616
|
flexDirection: 'column',
|
|
594
617
|
position: 'fixed',
|
|
595
|
-
zIndex:
|
|
618
|
+
zIndex: contentZIndex
|
|
596
619
|
}
|
|
597
620
|
}, /*#__PURE__*/ $cg2C9$react.createElement($cg2C9$radixuireactfocusscope.FocusScope, {
|
|
598
621
|
asChild: true // we make sure we're not trapping once it's been closed
|
|
@@ -667,7 +690,7 @@ const $1345bda09ffc1bc6$var$SelectContentImpl = /*#__PURE__*/ $cg2C9$react.forwa
|
|
|
667
690
|
event.preventDefault();
|
|
668
691
|
}
|
|
669
692
|
})
|
|
670
|
-
}))))))
|
|
693
|
+
}))))));
|
|
671
694
|
});
|
|
672
695
|
/* -------------------------------------------------------------------------------------------------
|
|
673
696
|
* SelectViewport
|
|
@@ -1148,6 +1171,7 @@ const $1345bda09ffc1bc6$export$be92b6f5f03c0fe9 = $1345bda09ffc1bc6$export$ef9b1
|
|
|
1148
1171
|
const $1345bda09ffc1bc6$export$41fb9f06171c75f4 = $1345bda09ffc1bc6$export$3ac1e88a1c0b9f1;
|
|
1149
1172
|
const $1345bda09ffc1bc6$export$4c8d1a57a761ef94 = $1345bda09ffc1bc6$export$e288731fd71264f0;
|
|
1150
1173
|
const $1345bda09ffc1bc6$export$f04a61298a47a40f = $1345bda09ffc1bc6$export$99b400cabb58c515;
|
|
1174
|
+
const $1345bda09ffc1bc6$export$602eac185826482c = $1345bda09ffc1bc6$export$b2af6c9944296213;
|
|
1151
1175
|
const $1345bda09ffc1bc6$export$7c6e2c02157bb7d2 = $1345bda09ffc1bc6$export$c973a4b3cb86a03d;
|
|
1152
1176
|
const $1345bda09ffc1bc6$export$d5c6c08dc2d3ca7 = $1345bda09ffc1bc6$export$9ed6e7b40248d36d;
|
|
1153
1177
|
const $1345bda09ffc1bc6$export$eb2fcfdbd7ba97d4 = $1345bda09ffc1bc6$export$ee25a334c55de1f4;
|