@arc-ui/components 11.1.0 → 11.3.0
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/Checkbox/Checkbox.cjs.js +8 -27
- package/dist/Checkbox/Checkbox.esm.js +3 -22
- package/dist/FormControl/FormControl.cjs.d.ts +1 -1
- package/dist/FormControl/FormControl.cjs.js +1 -1
- package/dist/FormControl/FormControl.esm.d.ts +1 -1
- package/dist/FormControl/FormControl.esm.js +1 -1
- package/dist/RadioGroup/RadioGroup.cjs.d.ts +2 -2
- package/dist/RadioGroup/RadioGroup.cjs.js +2 -2
- package/dist/RadioGroup/RadioGroup.esm.d.ts +2 -2
- package/dist/RadioGroup/RadioGroup.esm.js +2 -2
- package/dist/Select/Select.cjs.d.ts +2 -2
- package/dist/Select/Select.cjs.js +209 -607
- package/dist/Select/Select.esm.d.ts +2 -2
- package/dist/Select/Select.esm.js +45 -443
- package/dist/Switch/Switch.cjs.d.ts +40 -0
- package/dist/Switch/Switch.cjs.js +211 -0
- package/dist/Switch/Switch.esm.d.ts +40 -0
- package/dist/Switch/Switch.esm.js +203 -0
- package/dist/Switch/package.json +7 -0
- package/dist/TextInput/TextInput.cjs.d.ts +2 -2
- package/dist/TextInput/TextInput.cjs.js +1 -1
- package/dist/TextInput/TextInput.esm.d.ts +2 -2
- package/dist/TextInput/TextInput.esm.js +1 -1
- package/dist/VerticalSpace/VerticalSpace.cjs.d.ts +1 -18
- package/dist/VerticalSpace/VerticalSpace.cjs.js +5 -20
- package/dist/VerticalSpace/VerticalSpace.esm.d.ts +1 -18
- package/dist/VerticalSpace/VerticalSpace.esm.js +4 -19
- package/dist/_shared/cjs/BtIconTickAlt2Px-bdf06f8c.js +29 -0
- package/dist/_shared/cjs/{FormControl-e6b7d7c5.d.ts → FormControl-d4d9c665.d.ts} +4 -0
- package/dist/_shared/cjs/{FormControl-e6b7d7c5.js → FormControl-d4d9c665.js} +6 -5
- package/dist/_shared/cjs/VerticalSpace-65ad083c.d.ts +18 -0
- package/dist/_shared/cjs/VerticalSpace-65ad083c.js +25 -0
- package/dist/_shared/cjs/index-c81c9401.d.ts +1 -1
- package/dist/_shared/cjs/index.module-af7c85f2.js +400 -0
- package/dist/_shared/esm/BtIconTickAlt2Px-da97e9ae.js +23 -0
- package/dist/_shared/esm/{FormControl-84c9ace6.d.ts → FormControl-2cb96de7.d.ts} +4 -0
- package/dist/_shared/esm/{FormControl-84c9ace6.js → FormControl-2cb96de7.js} +6 -5
- package/dist/_shared/esm/VerticalSpace-6b4f5e50.d.ts +18 -0
- package/dist/_shared/esm/VerticalSpace-6b4f5e50.js +19 -0
- package/dist/_shared/esm/index-c81c9401.d.ts +1 -1
- package/dist/_shared/esm/index.module-599b86dd.js +388 -0
- package/dist/index.es.js +285 -112
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +500 -326
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/components/FormControl/FormControl.d.ts +4 -0
- package/dist/types/components/RadioGroup/RadioGroup.d.ts +1 -1
- package/dist/types/components/Select/Select.d.ts +1 -1
- package/dist/types/components/Switch/Switch.d.ts +13 -8
- package/dist/types/components/TextInput/TextInput.d.ts +1 -1
- package/dist/types/components/VerticalSpace/VerticalSpace.d.ts +1 -1
- package/dist/types/components/index.d.ts +1 -0
- package/package.json +4 -4
|
@@ -3,11 +3,13 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var index = require('../_shared/cjs/index-45bfb67b.js');
|
|
6
|
-
var React$
|
|
6
|
+
var React$1 = require('react');
|
|
7
|
+
var index_module = require('../_shared/cjs/index.module-af7c85f2.js');
|
|
7
8
|
var $7SXl2$reactdom = require('react-dom');
|
|
8
9
|
var BtIconChevronDown2Px = require('../_shared/cjs/BtIconChevronDown2Px-8fb4e2eb.js');
|
|
10
|
+
var BtIconTickAlt2Px = require('../_shared/cjs/BtIconTickAlt2Px-bdf06f8c.js');
|
|
9
11
|
var Icon = require('../_shared/cjs/Icon-719d13d4.js');
|
|
10
|
-
var FormControl = require('../_shared/cjs/FormControl-
|
|
12
|
+
var FormControl = require('../_shared/cjs/FormControl-d4d9c665.js');
|
|
11
13
|
var Surface = require('../_shared/cjs/Surface-d6b8010e.js');
|
|
12
14
|
var Base = require('../_shared/cjs/Base-e2b846fe.js');
|
|
13
15
|
require('../_shared/cjs/index-78b35bc1.js');
|
|
@@ -18,252 +20,31 @@ require('../_shared/cjs/BtIconChevronRightMid-5a38d855.js');
|
|
|
18
20
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
19
21
|
|
|
20
22
|
function _interopNamespace(e) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
23
|
+
if (e && e.__esModule) return e;
|
|
24
|
+
var n = Object.create(null);
|
|
25
|
+
if (e) {
|
|
26
|
+
Object.keys(e).forEach(function (k) {
|
|
27
|
+
if (k !== 'default') {
|
|
28
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
29
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () { return e[k]; }
|
|
32
|
+
});
|
|
33
|
+
}
|
|
30
34
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
n["default"] = e;
|
|
35
|
-
return Object.freeze(n);
|
|
35
|
+
}
|
|
36
|
+
n["default"] = e;
|
|
37
|
+
return Object.freeze(n);
|
|
36
38
|
}
|
|
37
39
|
|
|
38
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React$
|
|
39
|
-
var React__namespace = /*#__PURE__*/_interopNamespace(React$
|
|
40
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React$1);
|
|
41
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React$1);
|
|
40
42
|
var $7SXl2$reactdom__default = /*#__PURE__*/_interopDefaultLegacy($7SXl2$reactdom);
|
|
41
43
|
|
|
42
|
-
function _extends() {
|
|
43
|
-
_extends = Object.assign || function (target) {
|
|
44
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
45
|
-
var source = arguments[i];
|
|
46
|
-
|
|
47
|
-
for (var key in source) {
|
|
48
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
49
|
-
target[key] = source[key];
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return target;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
return _extends.apply(this, arguments);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
44
|
function $ae6933e535247d3d$export$7d15b64cf5a3a4c4(value, [min, max]) {
|
|
61
45
|
return Math.min(max, Math.max(min, value));
|
|
62
46
|
}
|
|
63
47
|
|
|
64
|
-
function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEventHandler, { checkForDefaultPrevented: checkForDefaultPrevented = true } = {}) {
|
|
65
|
-
return function handleEvent(event) {
|
|
66
|
-
originalEventHandler === null || originalEventHandler === void 0 || originalEventHandler(event);
|
|
67
|
-
if (checkForDefaultPrevented === false || !event.defaultPrevented) return ourEventHandler === null || ourEventHandler === void 0 ? void 0 : ourEventHandler(event);
|
|
68
|
-
};
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/* -------------------------------------------------------------------------------------------------
|
|
72
|
-
* createContextScope
|
|
73
|
-
* -----------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$export$50c7b4e9d9f19c1(scopeName, createContextScopeDeps = []) {
|
|
74
|
-
let defaultContexts = [];
|
|
75
|
-
/* -----------------------------------------------------------------------------------------------
|
|
76
|
-
* createContext
|
|
77
|
-
* ---------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$export$fd42f52fd3ae1109(rootComponentName, defaultContext) {
|
|
78
|
-
const BaseContext = /*#__PURE__*/ React$2.createContext(defaultContext);
|
|
79
|
-
const index = defaultContexts.length;
|
|
80
|
-
defaultContexts = [
|
|
81
|
-
...defaultContexts,
|
|
82
|
-
defaultContext
|
|
83
|
-
];
|
|
84
|
-
function Provider(props) {
|
|
85
|
-
const { scope: scope , children: children , ...context } = props;
|
|
86
|
-
const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext; // Only re-memoize when prop values change
|
|
87
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
88
|
-
const value = React$2.useMemo(()=>context
|
|
89
|
-
, Object.values(context));
|
|
90
|
-
return /*#__PURE__*/ React$2.createElement(Context.Provider, {
|
|
91
|
-
value: value
|
|
92
|
-
}, children);
|
|
93
|
-
}
|
|
94
|
-
function useContext(consumerName, scope) {
|
|
95
|
-
const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext;
|
|
96
|
-
const context = React$2.useContext(Context);
|
|
97
|
-
if (context) return context;
|
|
98
|
-
if (defaultContext !== undefined) return defaultContext; // if a defaultContext wasn't specified, it's a required context.
|
|
99
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
100
|
-
}
|
|
101
|
-
Provider.displayName = rootComponentName + 'Provider';
|
|
102
|
-
return [
|
|
103
|
-
Provider,
|
|
104
|
-
useContext
|
|
105
|
-
];
|
|
106
|
-
}
|
|
107
|
-
/* -----------------------------------------------------------------------------------------------
|
|
108
|
-
* createScope
|
|
109
|
-
* ---------------------------------------------------------------------------------------------*/ const createScope = ()=>{
|
|
110
|
-
const scopeContexts = defaultContexts.map((defaultContext)=>{
|
|
111
|
-
return /*#__PURE__*/ React$2.createContext(defaultContext);
|
|
112
|
-
});
|
|
113
|
-
return function useScope(scope) {
|
|
114
|
-
const contexts = (scope === null || scope === void 0 ? void 0 : scope[scopeName]) || scopeContexts;
|
|
115
|
-
return React$2.useMemo(()=>({
|
|
116
|
-
[`__scope${scopeName}`]: {
|
|
117
|
-
...scope,
|
|
118
|
-
[scopeName]: contexts
|
|
119
|
-
}
|
|
120
|
-
})
|
|
121
|
-
, [
|
|
122
|
-
scope,
|
|
123
|
-
contexts
|
|
124
|
-
]);
|
|
125
|
-
};
|
|
126
|
-
};
|
|
127
|
-
createScope.scopeName = scopeName;
|
|
128
|
-
return [
|
|
129
|
-
$c512c27ab02ef895$export$fd42f52fd3ae1109,
|
|
130
|
-
$c512c27ab02ef895$var$composeContextScopes(createScope, ...createContextScopeDeps)
|
|
131
|
-
];
|
|
132
|
-
}
|
|
133
|
-
/* -------------------------------------------------------------------------------------------------
|
|
134
|
-
* composeContextScopes
|
|
135
|
-
* -----------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$var$composeContextScopes(...scopes) {
|
|
136
|
-
const baseScope = scopes[0];
|
|
137
|
-
if (scopes.length === 1) return baseScope;
|
|
138
|
-
const createScope1 = ()=>{
|
|
139
|
-
const scopeHooks = scopes.map((createScope)=>({
|
|
140
|
-
useScope: createScope(),
|
|
141
|
-
scopeName: createScope.scopeName
|
|
142
|
-
})
|
|
143
|
-
);
|
|
144
|
-
return function useComposedScopes(overrideScopes) {
|
|
145
|
-
const nextScopes1 = scopeHooks.reduce((nextScopes, { useScope: useScope , scopeName: scopeName })=>{
|
|
146
|
-
// We are calling a hook inside a callback which React warns against to avoid inconsistent
|
|
147
|
-
// renders, however, scoping doesn't have render side effects so we ignore the rule.
|
|
148
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
149
|
-
const scopeProps = useScope(overrideScopes);
|
|
150
|
-
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
151
|
-
return {
|
|
152
|
-
...nextScopes,
|
|
153
|
-
...currentScope
|
|
154
|
-
};
|
|
155
|
-
}, {});
|
|
156
|
-
return React$2.useMemo(()=>({
|
|
157
|
-
[`__scope${baseScope.scopeName}`]: nextScopes1
|
|
158
|
-
})
|
|
159
|
-
, [
|
|
160
|
-
nextScopes1
|
|
161
|
-
]);
|
|
162
|
-
};
|
|
163
|
-
};
|
|
164
|
-
createScope1.scopeName = baseScope.scopeName;
|
|
165
|
-
return createScope1;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Set a given ref to a given value
|
|
170
|
-
* This utility takes care of different types of refs: callback refs and RefObject(s)
|
|
171
|
-
*/ function $6ed0406888f73fc4$var$setRef(ref, value) {
|
|
172
|
-
if (typeof ref === 'function') ref(value);
|
|
173
|
-
else if (ref !== null && ref !== undefined) ref.current = value;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* A utility to compose multiple refs together
|
|
177
|
-
* Accepts callback refs and RefObject(s)
|
|
178
|
-
*/ function $6ed0406888f73fc4$export$43e446d32b3d21af(...refs) {
|
|
179
|
-
return (node)=>refs.forEach((ref)=>$6ed0406888f73fc4$var$setRef(ref, node)
|
|
180
|
-
)
|
|
181
|
-
;
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* A custom hook that composes multiple refs
|
|
185
|
-
* Accepts callback refs and RefObject(s)
|
|
186
|
-
*/ function $6ed0406888f73fc4$export$c7b2cbe3552a0d05(...refs) {
|
|
187
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
188
|
-
return React$2.useCallback($6ed0406888f73fc4$export$43e446d32b3d21af(...refs), refs);
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/* -------------------------------------------------------------------------------------------------
|
|
192
|
-
* Slot
|
|
193
|
-
* -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$export$8c6ed5c666ac1360 = /*#__PURE__*/ React$2.forwardRef((props, forwardedRef)=>{
|
|
194
|
-
const { children: children , ...slotProps } = props;
|
|
195
|
-
const childrenArray = React$2.Children.toArray(children);
|
|
196
|
-
const slottable = childrenArray.find($5e63c961fc1ce211$var$isSlottable);
|
|
197
|
-
if (slottable) {
|
|
198
|
-
// the new element to render is the one passed as a child of `Slottable`
|
|
199
|
-
const newElement = slottable.props.children;
|
|
200
|
-
const newChildren = childrenArray.map((child)=>{
|
|
201
|
-
if (child === slottable) {
|
|
202
|
-
// because the new element will be the one rendered, we are only interested
|
|
203
|
-
// in grabbing its children (`newElement.props.children`)
|
|
204
|
-
if (React$2.Children.count(newElement) > 1) return React$2.Children.only(null);
|
|
205
|
-
return /*#__PURE__*/ React$2.isValidElement(newElement) ? newElement.props.children : null;
|
|
206
|
-
} else return child;
|
|
207
|
-
});
|
|
208
|
-
return /*#__PURE__*/ React$2.createElement($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, {
|
|
209
|
-
ref: forwardedRef
|
|
210
|
-
}), /*#__PURE__*/ React$2.isValidElement(newElement) ? /*#__PURE__*/ React$2.cloneElement(newElement, undefined, newChildren) : null);
|
|
211
|
-
}
|
|
212
|
-
return /*#__PURE__*/ React$2.createElement($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, {
|
|
213
|
-
ref: forwardedRef
|
|
214
|
-
}), children);
|
|
215
|
-
});
|
|
216
|
-
$5e63c961fc1ce211$export$8c6ed5c666ac1360.displayName = 'Slot';
|
|
217
|
-
/* -------------------------------------------------------------------------------------------------
|
|
218
|
-
* SlotClone
|
|
219
|
-
* -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$var$SlotClone = /*#__PURE__*/ React$2.forwardRef((props, forwardedRef)=>{
|
|
220
|
-
const { children: children , ...slotProps } = props;
|
|
221
|
-
if (/*#__PURE__*/ React$2.isValidElement(children)) return /*#__PURE__*/ React$2.cloneElement(children, {
|
|
222
|
-
...$5e63c961fc1ce211$var$mergeProps(slotProps, children.props),
|
|
223
|
-
ref: $6ed0406888f73fc4$export$43e446d32b3d21af(forwardedRef, children.ref)
|
|
224
|
-
});
|
|
225
|
-
return React$2.Children.count(children) > 1 ? React$2.Children.only(null) : null;
|
|
226
|
-
});
|
|
227
|
-
$5e63c961fc1ce211$var$SlotClone.displayName = 'SlotClone';
|
|
228
|
-
/* -------------------------------------------------------------------------------------------------
|
|
229
|
-
* Slottable
|
|
230
|
-
* -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$export$d9f1ccf0bdb05d45 = ({ children: children })=>{
|
|
231
|
-
return /*#__PURE__*/ React$2.createElement(React$2.Fragment, null, children);
|
|
232
|
-
};
|
|
233
|
-
/* ---------------------------------------------------------------------------------------------- */ function $5e63c961fc1ce211$var$isSlottable(child) {
|
|
234
|
-
return /*#__PURE__*/ React$2.isValidElement(child) && child.type === $5e63c961fc1ce211$export$d9f1ccf0bdb05d45;
|
|
235
|
-
}
|
|
236
|
-
function $5e63c961fc1ce211$var$mergeProps(slotProps, childProps) {
|
|
237
|
-
// all child props should override
|
|
238
|
-
const overrideProps = {
|
|
239
|
-
...childProps
|
|
240
|
-
};
|
|
241
|
-
for(const propName in childProps){
|
|
242
|
-
const slotPropValue = slotProps[propName];
|
|
243
|
-
const childPropValue = childProps[propName];
|
|
244
|
-
const isHandler = /^on[A-Z]/.test(propName);
|
|
245
|
-
if (isHandler) {
|
|
246
|
-
// if the handler exists on both, we compose them
|
|
247
|
-
if (slotPropValue && childPropValue) overrideProps[propName] = (...args)=>{
|
|
248
|
-
childPropValue(...args);
|
|
249
|
-
slotPropValue(...args);
|
|
250
|
-
};
|
|
251
|
-
else if (slotPropValue) overrideProps[propName] = slotPropValue;
|
|
252
|
-
} else if (propName === 'style') overrideProps[propName] = {
|
|
253
|
-
...slotPropValue,
|
|
254
|
-
...childPropValue
|
|
255
|
-
};
|
|
256
|
-
else if (propName === 'className') overrideProps[propName] = [
|
|
257
|
-
slotPropValue,
|
|
258
|
-
childPropValue
|
|
259
|
-
].filter(Boolean).join(' ');
|
|
260
|
-
}
|
|
261
|
-
return {
|
|
262
|
-
...slotProps,
|
|
263
|
-
...overrideProps
|
|
264
|
-
};
|
|
265
|
-
}
|
|
266
|
-
|
|
267
48
|
// We have resorted to returning slots directly rather than exposing primitives that can then
|
|
268
49
|
// be slotted like `<CollectionItem as={Slot}>…</CollectionItem>`.
|
|
269
50
|
// This is because we encountered issues with generic types that cannot be statically analysed
|
|
@@ -272,7 +53,7 @@ function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name) {
|
|
|
272
53
|
/* -----------------------------------------------------------------------------------------------
|
|
273
54
|
* CollectionProvider
|
|
274
55
|
* ---------------------------------------------------------------------------------------------*/ const PROVIDER_NAME = name + 'CollectionProvider';
|
|
275
|
-
const [createCollectionContext, createCollectionScope] =
|
|
56
|
+
const [createCollectionContext, createCollectionScope] = index_module.$c512c27ab02ef895$export$50c7b4e9d9f19c1(PROVIDER_NAME);
|
|
276
57
|
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(PROVIDER_NAME, {
|
|
277
58
|
collectionRef: {
|
|
278
59
|
current: null
|
|
@@ -295,8 +76,8 @@ function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name) {
|
|
|
295
76
|
const CollectionSlot = /*#__PURE__*/ React__default["default"].forwardRef((props, forwardedRef)=>{
|
|
296
77
|
const { scope: scope , children: children } = props;
|
|
297
78
|
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
298
|
-
const composedRefs =
|
|
299
|
-
return /*#__PURE__*/ React__default["default"].createElement(
|
|
79
|
+
const composedRefs = index_module.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.collectionRef);
|
|
80
|
+
return /*#__PURE__*/ React__default["default"].createElement(index_module.$5e63c961fc1ce211$export$8c6ed5c666ac1360, {
|
|
300
81
|
ref: composedRefs
|
|
301
82
|
}, children);
|
|
302
83
|
});
|
|
@@ -307,7 +88,7 @@ function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name) {
|
|
|
307
88
|
const CollectionItemSlot = /*#__PURE__*/ React__default["default"].forwardRef((props, forwardedRef)=>{
|
|
308
89
|
const { scope: scope , children: children , ...itemData } = props;
|
|
309
90
|
const ref = React__default["default"].useRef(null);
|
|
310
|
-
const composedRefs =
|
|
91
|
+
const composedRefs = index_module.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
|
|
311
92
|
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
312
93
|
React__default["default"].useEffect(()=>{
|
|
313
94
|
context.itemMap.set(ref, {
|
|
@@ -317,7 +98,7 @@ function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name) {
|
|
|
317
98
|
return ()=>void context.itemMap.delete(ref)
|
|
318
99
|
;
|
|
319
100
|
});
|
|
320
|
-
return /*#__PURE__*/ React__default["default"].createElement(
|
|
101
|
+
return /*#__PURE__*/ React__default["default"].createElement(index_module.$5e63c961fc1ce211$export$8c6ed5c666ac1360, {
|
|
321
102
|
[ITEM_DATA_ATTR]: '',
|
|
322
103
|
ref: composedRefs
|
|
323
104
|
}, children);
|
|
@@ -351,111 +132,17 @@ function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name) {
|
|
|
351
132
|
];
|
|
352
133
|
}
|
|
353
134
|
|
|
354
|
-
const $f631663db3294ace$var$DirectionContext = /*#__PURE__*/ React$
|
|
135
|
+
const $f631663db3294ace$var$DirectionContext = /*#__PURE__*/ React$1.createContext(undefined);
|
|
355
136
|
/* -----------------------------------------------------------------------------------------------*/ function $f631663db3294ace$export$b39126d51d94e6f3(localDir) {
|
|
356
|
-
const globalDir = React$
|
|
137
|
+
const globalDir = React$1.useContext($f631663db3294ace$var$DirectionContext);
|
|
357
138
|
return localDir || globalDir || 'ltr';
|
|
358
139
|
}
|
|
359
140
|
|
|
360
|
-
const $8927f6f2acc4f386$var$NODES = [
|
|
361
|
-
'a',
|
|
362
|
-
'button',
|
|
363
|
-
'div',
|
|
364
|
-
'h2',
|
|
365
|
-
'h3',
|
|
366
|
-
'img',
|
|
367
|
-
'label',
|
|
368
|
-
'li',
|
|
369
|
-
'nav',
|
|
370
|
-
'ol',
|
|
371
|
-
'p',
|
|
372
|
-
'span',
|
|
373
|
-
'svg',
|
|
374
|
-
'ul'
|
|
375
|
-
]; // Temporary while we await merge of this fix:
|
|
376
|
-
// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/55396
|
|
377
|
-
// prettier-ignore
|
|
378
|
-
/* -------------------------------------------------------------------------------------------------
|
|
379
|
-
* Primitive
|
|
380
|
-
* -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.reduce((primitive, node)=>{
|
|
381
|
-
const Node = /*#__PURE__*/ React$2.forwardRef((props, forwardedRef)=>{
|
|
382
|
-
const { asChild: asChild , ...primitiveProps } = props;
|
|
383
|
-
const Comp = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : node;
|
|
384
|
-
React$2.useEffect(()=>{
|
|
385
|
-
window[Symbol.for('radix-ui')] = true;
|
|
386
|
-
}, []);
|
|
387
|
-
return /*#__PURE__*/ React$2.createElement(Comp, _extends({}, primitiveProps, {
|
|
388
|
-
ref: forwardedRef
|
|
389
|
-
}));
|
|
390
|
-
});
|
|
391
|
-
Node.displayName = `Primitive.${node}`;
|
|
392
|
-
return {
|
|
393
|
-
...primitive,
|
|
394
|
-
[node]: Node
|
|
395
|
-
};
|
|
396
|
-
}, {});
|
|
397
|
-
/* -------------------------------------------------------------------------------------------------
|
|
398
|
-
* Utils
|
|
399
|
-
* -----------------------------------------------------------------------------------------------*/ /**
|
|
400
|
-
* Flush custom event dispatch
|
|
401
|
-
* https://github.com/radix-ui/primitives/pull/1378
|
|
402
|
-
*
|
|
403
|
-
* React batches *all* event handlers since version 18, this introduces certain considerations when using custom event types.
|
|
404
|
-
*
|
|
405
|
-
* Internally, React prioritises events in the following order:
|
|
406
|
-
* - discrete
|
|
407
|
-
* - continuous
|
|
408
|
-
* - default
|
|
409
|
-
*
|
|
410
|
-
* https://github.com/facebook/react/blob/a8a4742f1c54493df00da648a3f9d26e3db9c8b5/packages/react-dom/src/events/ReactDOMEventListener.js#L294-L350
|
|
411
|
-
*
|
|
412
|
-
* `discrete` is an important distinction as updates within these events are applied immediately.
|
|
413
|
-
* React however, is not able to infer the priority of custom event types due to how they are detected internally.
|
|
414
|
-
* Because of this, it's possible for updates from custom events to be unexpectedly batched when
|
|
415
|
-
* dispatched by another `discrete` event.
|
|
416
|
-
*
|
|
417
|
-
* In order to ensure that updates from custom events are applied predictably, we need to manually flush the batch.
|
|
418
|
-
* This utility should be used when dispatching a custom event from within another `discrete` event, this utility
|
|
419
|
-
* is not nessesary when dispatching known event types, or if dispatching a custom type inside a non-discrete event.
|
|
420
|
-
* For example:
|
|
421
|
-
*
|
|
422
|
-
* dispatching a known click 👎
|
|
423
|
-
* target.dispatchEvent(new Event(‘click’))
|
|
424
|
-
*
|
|
425
|
-
* dispatching a custom type within a non-discrete event 👎
|
|
426
|
-
* onScroll={(event) => event.target.dispatchEvent(new CustomEvent(‘customType’))}
|
|
427
|
-
*
|
|
428
|
-
* dispatching a custom type within a `discrete` event 👍
|
|
429
|
-
* onPointerDown={(event) => dispatchDiscreteCustomEvent(event.target, new CustomEvent(‘customType’))}
|
|
430
|
-
*
|
|
431
|
-
* Note: though React classifies `focus`, `focusin` and `focusout` events as `discrete`, it's not recommended to use
|
|
432
|
-
* this utility with them. This is because it's possible for those handlers to be called implicitly during render
|
|
433
|
-
* e.g. when focus is within a component as it is unmounted, or when managing focus on mount.
|
|
434
|
-
*/ function $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event) {
|
|
435
|
-
if (target) $7SXl2$reactdom.flushSync(()=>target.dispatchEvent(event)
|
|
436
|
-
);
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
/**
|
|
440
|
-
* A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a
|
|
441
|
-
* prop or avoid re-executing effects when passed as a dependency
|
|
442
|
-
*/ function $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(callback) {
|
|
443
|
-
const callbackRef = React$2.useRef(callback);
|
|
444
|
-
React$2.useEffect(()=>{
|
|
445
|
-
callbackRef.current = callback;
|
|
446
|
-
}); // https://github.com/facebook/react/issues/19240
|
|
447
|
-
return React$2.useMemo(()=>(...args)=>{
|
|
448
|
-
var _callbackRef$current;
|
|
449
|
-
return (_callbackRef$current = callbackRef.current) === null || _callbackRef$current === void 0 ? void 0 : _callbackRef$current.call(callbackRef, ...args);
|
|
450
|
-
}
|
|
451
|
-
, []);
|
|
452
|
-
}
|
|
453
|
-
|
|
454
141
|
/**
|
|
455
142
|
* Listens for when the escape key is down
|
|
456
143
|
*/ function $addc16e1bbe58fd0$export$3a72a57244d6e765(onEscapeKeyDownProp, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
|
|
457
|
-
const onEscapeKeyDown =
|
|
458
|
-
React$
|
|
144
|
+
const onEscapeKeyDown = index_module.$b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onEscapeKeyDownProp);
|
|
145
|
+
React$1.useEffect(()=>{
|
|
459
146
|
const handleKeyDown = (event)=>{
|
|
460
147
|
if (event.key === 'Escape') onEscapeKeyDown(event);
|
|
461
148
|
};
|
|
@@ -472,19 +159,19 @@ const $5cb92bef7577960e$var$CONTEXT_UPDATE = 'dismissableLayer.update';
|
|
|
472
159
|
const $5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE = 'dismissableLayer.pointerDownOutside';
|
|
473
160
|
const $5cb92bef7577960e$var$FOCUS_OUTSIDE = 'dismissableLayer.focusOutside';
|
|
474
161
|
let $5cb92bef7577960e$var$originalBodyPointerEvents;
|
|
475
|
-
const $5cb92bef7577960e$var$DismissableLayerContext = /*#__PURE__*/ React$
|
|
162
|
+
const $5cb92bef7577960e$var$DismissableLayerContext = /*#__PURE__*/ React$1.createContext({
|
|
476
163
|
layers: new Set(),
|
|
477
164
|
layersWithOutsidePointerEventsDisabled: new Set(),
|
|
478
165
|
branches: new Set()
|
|
479
166
|
});
|
|
480
|
-
const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ React$
|
|
167
|
+
const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
481
168
|
var _node$ownerDocument;
|
|
482
169
|
const { disableOutsidePointerEvents: disableOutsidePointerEvents = false , onEscapeKeyDown: onEscapeKeyDown , onPointerDownOutside: onPointerDownOutside , onFocusOutside: onFocusOutside , onInteractOutside: onInteractOutside , onDismiss: onDismiss , ...layerProps } = props;
|
|
483
|
-
const context = React$
|
|
484
|
-
const [node1, setNode] = React$
|
|
170
|
+
const context = React$1.useContext($5cb92bef7577960e$var$DismissableLayerContext);
|
|
171
|
+
const [node1, setNode] = React$1.useState(null);
|
|
485
172
|
const ownerDocument = (_node$ownerDocument = node1 === null || node1 === void 0 ? void 0 : node1.ownerDocument) !== null && _node$ownerDocument !== void 0 ? _node$ownerDocument : globalThis === null || globalThis === void 0 ? void 0 : globalThis.document;
|
|
486
|
-
const [, force] = React$
|
|
487
|
-
const composedRefs =
|
|
173
|
+
const [, force] = React$1.useState({});
|
|
174
|
+
const composedRefs = index_module.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setNode(node)
|
|
488
175
|
);
|
|
489
176
|
const layers = Array.from(context.layers);
|
|
490
177
|
const [highestLayerWithOutsidePointerEventsDisabled] = [
|
|
@@ -525,7 +212,7 @@ const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ React$2.forwardR
|
|
|
525
212
|
onDismiss();
|
|
526
213
|
}
|
|
527
214
|
}, ownerDocument);
|
|
528
|
-
React$
|
|
215
|
+
React$1.useEffect(()=>{
|
|
529
216
|
if (!node1) return;
|
|
530
217
|
if (disableOutsidePointerEvents) {
|
|
531
218
|
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
@@ -550,7 +237,7 @@ const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ React$2.forwardR
|
|
|
550
237
|
* because a change to `disableOutsidePointerEvents` would remove this layer from the stack
|
|
551
238
|
* and add it to the end again so the layering order wouldn't be _creation order_.
|
|
552
239
|
* We only want them to be removed from context stacks when unmounted.
|
|
553
|
-
*/ React$
|
|
240
|
+
*/ React$1.useEffect(()=>{
|
|
554
241
|
return ()=>{
|
|
555
242
|
if (!node1) return;
|
|
556
243
|
context.layers.delete(node1);
|
|
@@ -561,22 +248,22 @@ const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ React$2.forwardR
|
|
|
561
248
|
node1,
|
|
562
249
|
context
|
|
563
250
|
]);
|
|
564
|
-
React$
|
|
251
|
+
React$1.useEffect(()=>{
|
|
565
252
|
const handleUpdate = ()=>force({})
|
|
566
253
|
;
|
|
567
254
|
document.addEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate);
|
|
568
255
|
return ()=>document.removeEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate)
|
|
569
256
|
;
|
|
570
257
|
}, []);
|
|
571
|
-
return /*#__PURE__*/ React$
|
|
258
|
+
return /*#__PURE__*/ React$1.createElement(index_module.$8927f6f2acc4f386$export$250ffa63cdc0d034.div, index_module._extends({}, layerProps, {
|
|
572
259
|
ref: composedRefs,
|
|
573
260
|
style: {
|
|
574
261
|
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? 'auto' : 'none' : undefined,
|
|
575
262
|
...props.style
|
|
576
263
|
},
|
|
577
|
-
onFocusCapture:
|
|
578
|
-
onBlurCapture:
|
|
579
|
-
onPointerDownCapture:
|
|
264
|
+
onFocusCapture: index_module.$e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
265
|
+
onBlurCapture: index_module.$e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
266
|
+
onPointerDownCapture: index_module.$e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDownCapture, pointerDownOutside.onPointerDownCapture)
|
|
580
267
|
}));
|
|
581
268
|
});
|
|
582
269
|
/* -----------------------------------------------------------------------------------------------*/ /**
|
|
@@ -584,10 +271,10 @@ const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ React$2.forwardR
|
|
|
584
271
|
* to mimic layer dismissing behaviour present in OS.
|
|
585
272
|
* Returns props to pass to the node we want to check for outside events.
|
|
586
273
|
*/ function $5cb92bef7577960e$var$usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
|
|
587
|
-
const handlePointerDownOutside =
|
|
588
|
-
const isPointerInsideReactTreeRef = React$
|
|
589
|
-
const handleClickRef = React$
|
|
590
|
-
React$
|
|
274
|
+
const handlePointerDownOutside = index_module.$b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onPointerDownOutside);
|
|
275
|
+
const isPointerInsideReactTreeRef = React$1.useRef(false);
|
|
276
|
+
const handleClickRef = React$1.useRef(()=>{});
|
|
277
|
+
React$1.useEffect(()=>{
|
|
591
278
|
const handlePointerDown = (event)=>{
|
|
592
279
|
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
593
280
|
const eventDetail = {
|
|
@@ -652,9 +339,9 @@ const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ React$2.forwardR
|
|
|
652
339
|
* Listens for when focus happens outside a react subtree.
|
|
653
340
|
* Returns props to pass to the root (node) of the subtree we want to check.
|
|
654
341
|
*/ function $5cb92bef7577960e$var$useFocusOutside(onFocusOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
|
|
655
|
-
const handleFocusOutside =
|
|
656
|
-
const isFocusInsideReactTreeRef = React$
|
|
657
|
-
React$
|
|
342
|
+
const handleFocusOutside = index_module.$b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onFocusOutside);
|
|
343
|
+
const isFocusInsideReactTreeRef = React$1.useRef(false);
|
|
344
|
+
React$1.useEffect(()=>{
|
|
658
345
|
const handleFocus = (event)=>{
|
|
659
346
|
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
660
347
|
const eventDetail = {
|
|
@@ -692,7 +379,7 @@ function $5cb92bef7577960e$var$handleAndDispatchCustomEvent(name, handler, detai
|
|
|
692
379
|
if (handler) target.addEventListener(name, handler, {
|
|
693
380
|
once: true
|
|
694
381
|
});
|
|
695
|
-
if (discrete)
|
|
382
|
+
if (discrete) index_module.$8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event);
|
|
696
383
|
else target.dispatchEvent(event);
|
|
697
384
|
}
|
|
698
385
|
|
|
@@ -701,7 +388,7 @@ function $5cb92bef7577960e$var$handleAndDispatchCustomEvent(name, handler, detai
|
|
|
701
388
|
* Injects a pair of focus guards at the edges of the whole DOM tree
|
|
702
389
|
* to ensure `focusin` & `focusout` events can be caught consistently.
|
|
703
390
|
*/ function $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c() {
|
|
704
|
-
React$
|
|
391
|
+
React$1.useEffect(()=>{
|
|
705
392
|
var _edgeGuards$, _edgeGuards$2;
|
|
706
393
|
const edgeGuards = document.querySelectorAll('[data-radix-focus-guard]');
|
|
707
394
|
document.body.insertAdjacentElement('afterbegin', (_edgeGuards$ = edgeGuards[0]) !== null && _edgeGuards$ !== void 0 ? _edgeGuards$ : $3db38b7d1fb3fe6a$var$createFocusGuard());
|
|
@@ -728,15 +415,15 @@ const $d3863c46a17e8a28$var$EVENT_OPTIONS = {
|
|
|
728
415
|
bubbles: false,
|
|
729
416
|
cancelable: true
|
|
730
417
|
};
|
|
731
|
-
const $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ React$
|
|
418
|
+
const $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
732
419
|
const { loop: loop = false , trapped: trapped = false , onMountAutoFocus: onMountAutoFocusProp , onUnmountAutoFocus: onUnmountAutoFocusProp , ...scopeProps } = props;
|
|
733
|
-
const [container1, setContainer] = React$
|
|
734
|
-
const onMountAutoFocus =
|
|
735
|
-
const onUnmountAutoFocus =
|
|
736
|
-
const lastFocusedElementRef = React$
|
|
737
|
-
const composedRefs =
|
|
420
|
+
const [container1, setContainer] = React$1.useState(null);
|
|
421
|
+
const onMountAutoFocus = index_module.$b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onMountAutoFocusProp);
|
|
422
|
+
const onUnmountAutoFocus = index_module.$b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onUnmountAutoFocusProp);
|
|
423
|
+
const lastFocusedElementRef = React$1.useRef(null);
|
|
424
|
+
const composedRefs = index_module.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setContainer(node)
|
|
738
425
|
);
|
|
739
|
-
const focusScope = React$
|
|
426
|
+
const focusScope = React$1.useRef({
|
|
740
427
|
paused: false,
|
|
741
428
|
pause () {
|
|
742
429
|
this.paused = true;
|
|
@@ -745,7 +432,7 @@ const $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ React$2.forwardR
|
|
|
745
432
|
this.paused = false;
|
|
746
433
|
}
|
|
747
434
|
}).current; // Takes care of trapping focus if focus is moved outside programmatically for example
|
|
748
|
-
React$
|
|
435
|
+
React$1.useEffect(()=>{
|
|
749
436
|
if (trapped) {
|
|
750
437
|
function handleFocusIn(event) {
|
|
751
438
|
if (focusScope.paused || !container1) return;
|
|
@@ -773,7 +460,7 @@ const $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ React$2.forwardR
|
|
|
773
460
|
container1,
|
|
774
461
|
focusScope.paused
|
|
775
462
|
]);
|
|
776
|
-
React$
|
|
463
|
+
React$1.useEffect(()=>{
|
|
777
464
|
if (container1) {
|
|
778
465
|
$d3863c46a17e8a28$var$focusScopesStack.add(focusScope);
|
|
779
466
|
const previouslyFocusedElement = document.activeElement;
|
|
@@ -812,7 +499,7 @@ const $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ React$2.forwardR
|
|
|
812
499
|
onUnmountAutoFocus,
|
|
813
500
|
focusScope
|
|
814
501
|
]); // Takes care of looping focus (when tabbing whilst at the edges)
|
|
815
|
-
const handleKeyDown = React$
|
|
502
|
+
const handleKeyDown = React$1.useCallback((event)=>{
|
|
816
503
|
if (!loop && !trapped) return;
|
|
817
504
|
if (focusScope.paused) return;
|
|
818
505
|
const isTabKey = event.key === 'Tab' && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
@@ -842,7 +529,7 @@ const $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ React$2.forwardR
|
|
|
842
529
|
trapped,
|
|
843
530
|
focusScope.paused
|
|
844
531
|
]);
|
|
845
|
-
return /*#__PURE__*/ React$
|
|
532
|
+
return /*#__PURE__*/ React$1.createElement(index_module.$8927f6f2acc4f386$export$250ffa63cdc0d034.div, index_module._extends({
|
|
846
533
|
tabIndex: -1
|
|
847
534
|
}, scopeProps, {
|
|
848
535
|
ref: composedRefs,
|
|
@@ -966,20 +653,12 @@ function $d3863c46a17e8a28$var$removeLinks(items) {
|
|
|
966
653
|
);
|
|
967
654
|
}
|
|
968
655
|
|
|
969
|
-
/**
|
|
970
|
-
* On the server, React emits a warning when calling `useLayoutEffect`.
|
|
971
|
-
* This is because neither `useLayoutEffect` nor `useEffect` run on the server.
|
|
972
|
-
* We use this safe version which suppresses the warning by replacing it with a noop on the server.
|
|
973
|
-
*
|
|
974
|
-
* See: https://reactjs.org/docs/hooks-reference.html#uselayouteffect
|
|
975
|
-
*/ const $9f79659886946c16$export$e5c5a5f917a5871c = Boolean(globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) ? React$2.useLayoutEffect : ()=>{};
|
|
976
|
-
|
|
977
656
|
const $1746a345f3d73bb7$var$useReactId = React__namespace['useId'.toString()] || (()=>undefined
|
|
978
657
|
);
|
|
979
658
|
let $1746a345f3d73bb7$var$count = 0;
|
|
980
659
|
function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {
|
|
981
660
|
const [id, setId] = React__namespace.useState($1746a345f3d73bb7$var$useReactId()); // React versions older than 18 will have client-side ids only.
|
|
982
|
-
|
|
661
|
+
index_module.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
983
662
|
if (!deterministicId) setId((reactId)=>reactId !== null && reactId !== void 0 ? reactId : String($1746a345f3d73bb7$var$count++)
|
|
984
663
|
);
|
|
985
664
|
}, [
|
|
@@ -988,77 +667,16 @@ function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {
|
|
|
988
667
|
return deterministicId || (id ? `radix-${id}` : '');
|
|
989
668
|
}
|
|
990
669
|
|
|
991
|
-
const $f1701beae083dbae$export$602eac185826482c = /*#__PURE__*/ React$
|
|
670
|
+
const $f1701beae083dbae$export$602eac185826482c = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
992
671
|
var _globalThis$document;
|
|
993
672
|
const { container: container = globalThis === null || globalThis === void 0 ? void 0 : (_globalThis$document = globalThis.document) === null || _globalThis$document === void 0 ? void 0 : _globalThis$document.body , ...portalProps } = props;
|
|
994
|
-
return container ? /*#__PURE__*/ $7SXl2$reactdom__default["default"].createPortal(/*#__PURE__*/ React$
|
|
673
|
+
return container ? /*#__PURE__*/ $7SXl2$reactdom__default["default"].createPortal(/*#__PURE__*/ React$1.createElement(index_module.$8927f6f2acc4f386$export$250ffa63cdc0d034.div, index_module._extends({}, portalProps, {
|
|
995
674
|
ref: forwardedRef
|
|
996
675
|
})), container) : null;
|
|
997
676
|
});
|
|
998
677
|
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
defaultProp: defaultProp,
|
|
1002
|
-
onChange: onChange
|
|
1003
|
-
});
|
|
1004
|
-
const isControlled = prop !== undefined;
|
|
1005
|
-
const value1 = isControlled ? prop : uncontrolledProp;
|
|
1006
|
-
const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange);
|
|
1007
|
-
const setValue = React$2.useCallback((nextValue)=>{
|
|
1008
|
-
if (isControlled) {
|
|
1009
|
-
const setter = nextValue;
|
|
1010
|
-
const value = typeof nextValue === 'function' ? setter(prop) : nextValue;
|
|
1011
|
-
if (value !== prop) handleChange(value);
|
|
1012
|
-
} else setUncontrolledProp(nextValue);
|
|
1013
|
-
}, [
|
|
1014
|
-
isControlled,
|
|
1015
|
-
prop,
|
|
1016
|
-
setUncontrolledProp,
|
|
1017
|
-
handleChange
|
|
1018
|
-
]);
|
|
1019
|
-
return [
|
|
1020
|
-
value1,
|
|
1021
|
-
setValue
|
|
1022
|
-
];
|
|
1023
|
-
}
|
|
1024
|
-
function $71cd76cc60e0454e$var$useUncontrolledState({ defaultProp: defaultProp , onChange: onChange }) {
|
|
1025
|
-
const uncontrolledState = React$2.useState(defaultProp);
|
|
1026
|
-
const [value] = uncontrolledState;
|
|
1027
|
-
const prevValueRef = React$2.useRef(value);
|
|
1028
|
-
const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange);
|
|
1029
|
-
React$2.useEffect(()=>{
|
|
1030
|
-
if (prevValueRef.current !== value) {
|
|
1031
|
-
handleChange(value);
|
|
1032
|
-
prevValueRef.current = value;
|
|
1033
|
-
}
|
|
1034
|
-
}, [
|
|
1035
|
-
value,
|
|
1036
|
-
prevValueRef,
|
|
1037
|
-
handleChange
|
|
1038
|
-
]);
|
|
1039
|
-
return uncontrolledState;
|
|
1040
|
-
}
|
|
1041
|
-
|
|
1042
|
-
function $010c2913dbd2fe3d$export$5cae361ad82dce8b(value) {
|
|
1043
|
-
const ref = React$2.useRef({
|
|
1044
|
-
value: value,
|
|
1045
|
-
previous: value
|
|
1046
|
-
}); // We compare values before making an update to ensure that
|
|
1047
|
-
// a change has been made. This ensures the previous value is
|
|
1048
|
-
// persisted correctly between renders.
|
|
1049
|
-
return React$2.useMemo(()=>{
|
|
1050
|
-
if (ref.current.value !== value) {
|
|
1051
|
-
ref.current.previous = ref.current.value;
|
|
1052
|
-
ref.current.value = value;
|
|
1053
|
-
}
|
|
1054
|
-
return ref.current.previous;
|
|
1055
|
-
}, [
|
|
1056
|
-
value
|
|
1057
|
-
]);
|
|
1058
|
-
}
|
|
1059
|
-
|
|
1060
|
-
const $ea1ef594cf570d83$export$439d29a4e110a164 = /*#__PURE__*/ React$2.forwardRef((props, forwardedRef)=>{
|
|
1061
|
-
return /*#__PURE__*/ React$2.createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({}, props, {
|
|
678
|
+
const $ea1ef594cf570d83$export$439d29a4e110a164 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
679
|
+
return /*#__PURE__*/ React$1.createElement(index_module.$8927f6f2acc4f386$export$250ffa63cdc0d034.span, index_module._extends({}, props, {
|
|
1062
680
|
ref: forwardedRef,
|
|
1063
681
|
style: {
|
|
1064
682
|
// See: https://github.com/twbs/bootstrap/blob/master/scss/mixins/_screen-reader.scss
|
|
@@ -1300,7 +918,7 @@ function assignRef(ref, value) {
|
|
|
1300
918
|
* @returns {MutableRefObject}
|
|
1301
919
|
*/
|
|
1302
920
|
function useCallbackRef(initialValue, callback) {
|
|
1303
|
-
var ref = React$
|
|
921
|
+
var ref = React$1.useState(function () { return ({
|
|
1304
922
|
// value
|
|
1305
923
|
value: initialValue,
|
|
1306
924
|
// last callback
|
|
@@ -1934,37 +1552,37 @@ const $cc7e05a45900e73f$var$SELECTION_KEYS = [
|
|
|
1934
1552
|
* Select
|
|
1935
1553
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$SELECT_NAME = 'Select';
|
|
1936
1554
|
const [$cc7e05a45900e73f$var$Collection, $cc7e05a45900e73f$var$useCollection, $cc7e05a45900e73f$var$createCollectionScope] = $e02a7d9cb1dc128c$export$c74125a8e3af6bb2($cc7e05a45900e73f$var$SELECT_NAME);
|
|
1937
|
-
const [$cc7e05a45900e73f$var$createSelectContext, $cc7e05a45900e73f$export$286727a75dc039bd] =
|
|
1555
|
+
const [$cc7e05a45900e73f$var$createSelectContext, $cc7e05a45900e73f$export$286727a75dc039bd] = index_module.$c512c27ab02ef895$export$50c7b4e9d9f19c1($cc7e05a45900e73f$var$SELECT_NAME, [
|
|
1938
1556
|
$cc7e05a45900e73f$var$createCollectionScope
|
|
1939
1557
|
]);
|
|
1940
1558
|
const [$cc7e05a45900e73f$var$SelectProvider, $cc7e05a45900e73f$var$useSelectContext] = $cc7e05a45900e73f$var$createSelectContext($cc7e05a45900e73f$var$SELECT_NAME);
|
|
1941
1559
|
const [$cc7e05a45900e73f$var$SelectNativeOptionsProvider, $cc7e05a45900e73f$var$useSelectNativeOptionsContext] = $cc7e05a45900e73f$var$createSelectContext($cc7e05a45900e73f$var$SELECT_NAME);
|
|
1942
1560
|
const $cc7e05a45900e73f$export$ef9b1a59e592288f = (props)=>{
|
|
1943
1561
|
const { __scopeSelect: __scopeSelect , children: children , open: openProp , defaultOpen: defaultOpen , onOpenChange: onOpenChange , value: valueProp , defaultValue: defaultValue , onValueChange: onValueChange , dir: dir , name: name , autoComplete: autoComplete , disabled: disabled , required: required } = props;
|
|
1944
|
-
const [trigger, setTrigger] = React$
|
|
1945
|
-
const [valueNode, setValueNode] = React$
|
|
1946
|
-
const [valueNodeHasChildren, setValueNodeHasChildren] = React$
|
|
1562
|
+
const [trigger, setTrigger] = React$1.useState(null);
|
|
1563
|
+
const [valueNode, setValueNode] = React$1.useState(null);
|
|
1564
|
+
const [valueNodeHasChildren, setValueNodeHasChildren] = React$1.useState(false);
|
|
1947
1565
|
const direction = $f631663db3294ace$export$b39126d51d94e6f3(dir);
|
|
1948
|
-
const [open = false, setOpen] =
|
|
1566
|
+
const [open = false, setOpen] = index_module.$71cd76cc60e0454e$export$6f32135080cb4c3({
|
|
1949
1567
|
prop: openProp,
|
|
1950
1568
|
defaultProp: defaultOpen,
|
|
1951
1569
|
onChange: onOpenChange
|
|
1952
1570
|
});
|
|
1953
|
-
const [value, setValue] =
|
|
1571
|
+
const [value, setValue] = index_module.$71cd76cc60e0454e$export$6f32135080cb4c3({
|
|
1954
1572
|
prop: valueProp,
|
|
1955
1573
|
defaultProp: defaultValue,
|
|
1956
1574
|
onChange: onValueChange
|
|
1957
1575
|
});
|
|
1958
|
-
const triggerPointerDownPosRef = React$
|
|
1576
|
+
const triggerPointerDownPosRef = React$1.useRef(null); // We set this to true by default so that events bubble to forms without JS (SSR)
|
|
1959
1577
|
const isFormControl = trigger ? Boolean(trigger.closest('form')) : true;
|
|
1960
|
-
const [nativeOptionsSet, setNativeOptionsSet] = React$
|
|
1578
|
+
const [nativeOptionsSet, setNativeOptionsSet] = React$1.useState(new Set()); // The native `select` only associates the correct default value if the corresponding
|
|
1961
1579
|
// `option` is rendered as a child **at the same time** as itself.
|
|
1962
1580
|
// Because it might take a few renders for our items to gather the information to build
|
|
1963
1581
|
// the native `option`(s), we generate a key on the `select` to make sure React re-builds it
|
|
1964
1582
|
// each time the options change.
|
|
1965
1583
|
const nativeSelectKey = Array.from(nativeOptionsSet).map((option)=>option.props.value
|
|
1966
1584
|
).join(';');
|
|
1967
|
-
return /*#__PURE__*/ React$
|
|
1585
|
+
return /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$SelectProvider, {
|
|
1968
1586
|
required: required,
|
|
1969
1587
|
scope: __scopeSelect,
|
|
1970
1588
|
trigger: trigger,
|
|
@@ -1981,22 +1599,22 @@ const $cc7e05a45900e73f$export$ef9b1a59e592288f = (props)=>{
|
|
|
1981
1599
|
dir: direction,
|
|
1982
1600
|
triggerPointerDownPosRef: triggerPointerDownPosRef,
|
|
1983
1601
|
disabled: disabled
|
|
1984
|
-
}, /*#__PURE__*/ React$
|
|
1602
|
+
}, /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$Collection.Provider, {
|
|
1985
1603
|
scope: __scopeSelect
|
|
1986
|
-
}, /*#__PURE__*/ React$
|
|
1604
|
+
}, /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$SelectNativeOptionsProvider, {
|
|
1987
1605
|
scope: props.__scopeSelect,
|
|
1988
|
-
onNativeOptionAdd: React$
|
|
1606
|
+
onNativeOptionAdd: React$1.useCallback((option)=>{
|
|
1989
1607
|
setNativeOptionsSet((prev)=>new Set(prev).add(option)
|
|
1990
1608
|
);
|
|
1991
1609
|
}, []),
|
|
1992
|
-
onNativeOptionRemove: React$
|
|
1610
|
+
onNativeOptionRemove: React$1.useCallback((option)=>{
|
|
1993
1611
|
setNativeOptionsSet((prev)=>{
|
|
1994
1612
|
const optionsSet = new Set(prev);
|
|
1995
1613
|
optionsSet.delete(option);
|
|
1996
1614
|
return optionsSet;
|
|
1997
1615
|
});
|
|
1998
1616
|
}, [])
|
|
1999
|
-
}, children)), isFormControl ? /*#__PURE__*/ React$
|
|
1617
|
+
}, children)), isFormControl ? /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$BubbleSelect, {
|
|
2000
1618
|
key: nativeSelectKey,
|
|
2001
1619
|
"aria-hidden": true,
|
|
2002
1620
|
required: required,
|
|
@@ -2008,18 +1626,18 @@ const $cc7e05a45900e73f$export$ef9b1a59e592288f = (props)=>{
|
|
|
2008
1626
|
onChange: (event)=>setValue(event.target.value)
|
|
2009
1627
|
,
|
|
2010
1628
|
disabled: disabled
|
|
2011
|
-
}, value === undefined ? /*#__PURE__*/ React$
|
|
1629
|
+
}, value === undefined ? /*#__PURE__*/ React$1.createElement("option", {
|
|
2012
1630
|
value: ""
|
|
2013
1631
|
}) : null, Array.from(nativeOptionsSet)) : null);
|
|
2014
1632
|
};
|
|
2015
1633
|
/* -------------------------------------------------------------------------------------------------
|
|
2016
1634
|
* SelectTrigger
|
|
2017
1635
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$TRIGGER_NAME = 'SelectTrigger';
|
|
2018
|
-
const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ React$
|
|
1636
|
+
const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
2019
1637
|
const { __scopeSelect: __scopeSelect , disabled: disabled = false , ...triggerProps } = props;
|
|
2020
1638
|
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$TRIGGER_NAME, __scopeSelect);
|
|
2021
1639
|
const isDisabled = context.disabled || disabled;
|
|
2022
|
-
const composedRefs =
|
|
1640
|
+
const composedRefs = index_module.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.onTriggerChange);
|
|
2023
1641
|
const getItems = $cc7e05a45900e73f$var$useCollection(__scopeSelect);
|
|
2024
1642
|
const [searchRef, handleTypeaheadSearch, resetTypeahead] = $cc7e05a45900e73f$var$useTypeaheadSearch((search)=>{
|
|
2025
1643
|
const enabledItems = getItems().filter((item)=>!item.disabled
|
|
@@ -2035,7 +1653,7 @@ const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ React$2.forwardRe
|
|
|
2035
1653
|
resetTypeahead();
|
|
2036
1654
|
}
|
|
2037
1655
|
};
|
|
2038
|
-
return /*#__PURE__*/ React$
|
|
1656
|
+
return /*#__PURE__*/ React$1.createElement(index_module.$8927f6f2acc4f386$export$250ffa63cdc0d034.button, index_module._extends({
|
|
2039
1657
|
type: "button",
|
|
2040
1658
|
role: "combobox",
|
|
2041
1659
|
"aria-controls": context.contentId,
|
|
@@ -2050,7 +1668,7 @@ const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ React$2.forwardRe
|
|
|
2050
1668
|
}, triggerProps, {
|
|
2051
1669
|
ref: composedRefs // Enable compatibility with native label or custom `Label` "click" for Safari:
|
|
2052
1670
|
,
|
|
2053
|
-
onClick:
|
|
1671
|
+
onClick: index_module.$e42e1063c40fb3ef$export$b9ecd428b558ff10(triggerProps.onClick, (event)=>{
|
|
2054
1672
|
// Whilst browsers generally have no issue focusing the trigger when clicking
|
|
2055
1673
|
// on a label, Safari seems to struggle with the fact that there's no `onClick`.
|
|
2056
1674
|
// We force `focus` in this case. Note: this doesn't create any other side-effect
|
|
@@ -2058,7 +1676,7 @@ const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ React$2.forwardRe
|
|
|
2058
1676
|
// this only runs for a label "click"
|
|
2059
1677
|
event.currentTarget.focus();
|
|
2060
1678
|
}),
|
|
2061
|
-
onPointerDown:
|
|
1679
|
+
onPointerDown: index_module.$e42e1063c40fb3ef$export$b9ecd428b558ff10(triggerProps.onPointerDown, (event)=>{
|
|
2062
1680
|
// prevent implicit pointer capture
|
|
2063
1681
|
// https://www.w3.org/TR/pointerevents3/#implicit-pointer-capture
|
|
2064
1682
|
const target = event.target;
|
|
@@ -2074,7 +1692,7 @@ const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ React$2.forwardRe
|
|
|
2074
1692
|
event.preventDefault();
|
|
2075
1693
|
}
|
|
2076
1694
|
}),
|
|
2077
|
-
onKeyDown:
|
|
1695
|
+
onKeyDown: index_module.$e42e1063c40fb3ef$export$b9ecd428b558ff10(triggerProps.onKeyDown, (event)=>{
|
|
2078
1696
|
const isTypingAhead = searchRef.current !== '';
|
|
2079
1697
|
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;
|
|
2080
1698
|
if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key);
|
|
@@ -2089,20 +1707,20 @@ const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ React$2.forwardRe
|
|
|
2089
1707
|
/* -------------------------------------------------------------------------------------------------
|
|
2090
1708
|
* SelectValue
|
|
2091
1709
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$VALUE_NAME = 'SelectValue';
|
|
2092
|
-
const $cc7e05a45900e73f$export$e288731fd71264f0 = /*#__PURE__*/ React$
|
|
1710
|
+
const $cc7e05a45900e73f$export$e288731fd71264f0 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
2093
1711
|
// We ignore `className` and `style` as this part shouldn't be styled.
|
|
2094
1712
|
const { __scopeSelect: __scopeSelect , className: className , style: style , children: children , placeholder: placeholder , ...valueProps } = props;
|
|
2095
1713
|
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$VALUE_NAME, __scopeSelect);
|
|
2096
1714
|
const { onValueNodeHasChildrenChange: onValueNodeHasChildrenChange } = context;
|
|
2097
1715
|
const hasChildren = children !== undefined;
|
|
2098
|
-
const composedRefs =
|
|
2099
|
-
|
|
1716
|
+
const composedRefs = index_module.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.onValueNodeChange);
|
|
1717
|
+
index_module.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
2100
1718
|
onValueNodeHasChildrenChange(hasChildren);
|
|
2101
1719
|
}, [
|
|
2102
1720
|
onValueNodeHasChildrenChange,
|
|
2103
1721
|
hasChildren
|
|
2104
1722
|
]);
|
|
2105
|
-
return /*#__PURE__*/ React$
|
|
1723
|
+
return /*#__PURE__*/ React$1.createElement(index_module.$8927f6f2acc4f386$export$250ffa63cdc0d034.span, index_module._extends({}, valueProps, {
|
|
2106
1724
|
ref: composedRefs // we don't want events from the portalled `SelectValue` children to bubble
|
|
2107
1725
|
,
|
|
2108
1726
|
style: {
|
|
@@ -2110,67 +1728,67 @@ const $cc7e05a45900e73f$export$e288731fd71264f0 = /*#__PURE__*/ React$2.forwardR
|
|
|
2110
1728
|
}
|
|
2111
1729
|
}), context.value === undefined && placeholder !== undefined ? placeholder : children);
|
|
2112
1730
|
});
|
|
2113
|
-
const $cc7e05a45900e73f$export$99b400cabb58c515 = /*#__PURE__*/ React$
|
|
1731
|
+
const $cc7e05a45900e73f$export$99b400cabb58c515 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
2114
1732
|
const { __scopeSelect: __scopeSelect , children: children , ...iconProps } = props;
|
|
2115
|
-
return /*#__PURE__*/ React$
|
|
1733
|
+
return /*#__PURE__*/ React$1.createElement(index_module.$8927f6f2acc4f386$export$250ffa63cdc0d034.span, index_module._extends({
|
|
2116
1734
|
"aria-hidden": true
|
|
2117
1735
|
}, iconProps, {
|
|
2118
1736
|
ref: forwardedRef
|
|
2119
1737
|
}), children || '▼');
|
|
2120
1738
|
});
|
|
2121
1739
|
const $cc7e05a45900e73f$export$b2af6c9944296213 = (props)=>{
|
|
2122
|
-
return /*#__PURE__*/ React$
|
|
1740
|
+
return /*#__PURE__*/ React$1.createElement($f1701beae083dbae$export$602eac185826482c, index_module._extends({
|
|
2123
1741
|
asChild: true
|
|
2124
1742
|
}, props));
|
|
2125
1743
|
};
|
|
2126
1744
|
/* -------------------------------------------------------------------------------------------------
|
|
2127
1745
|
* SelectContent
|
|
2128
1746
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$CONTENT_NAME = 'SelectContent';
|
|
2129
|
-
const $cc7e05a45900e73f$export$c973a4b3cb86a03d = /*#__PURE__*/ React$
|
|
1747
|
+
const $cc7e05a45900e73f$export$c973a4b3cb86a03d = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
2130
1748
|
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$CONTENT_NAME, props.__scopeSelect);
|
|
2131
|
-
const [fragment, setFragment] = React$
|
|
2132
|
-
|
|
1749
|
+
const [fragment, setFragment] = React$1.useState(); // setting the fragment in `useLayoutEffect` as `DocumentFragment` doesn't exist on the server
|
|
1750
|
+
index_module.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
2133
1751
|
setFragment(new DocumentFragment());
|
|
2134
1752
|
}, []);
|
|
2135
|
-
return /*#__PURE__*/ React$
|
|
1753
|
+
return /*#__PURE__*/ React$1.createElement(React$1.Fragment, null, context.open ? /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$SelectContentImpl, index_module._extends({}, props, {
|
|
2136
1754
|
ref: forwardedRef
|
|
2137
|
-
})) : fragment ? /*#__PURE__*/ $7SXl2$reactdom.createPortal(/*#__PURE__*/ React$
|
|
1755
|
+
})) : fragment ? /*#__PURE__*/ $7SXl2$reactdom.createPortal(/*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$SelectContentProvider, {
|
|
2138
1756
|
scope: props.__scopeSelect
|
|
2139
|
-
}, /*#__PURE__*/ React$
|
|
1757
|
+
}, /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$Collection.Slot, {
|
|
2140
1758
|
scope: props.__scopeSelect
|
|
2141
|
-
}, /*#__PURE__*/ React$
|
|
1759
|
+
}, /*#__PURE__*/ React$1.createElement("div", null, props.children))), fragment) : null);
|
|
2142
1760
|
});
|
|
2143
1761
|
const $cc7e05a45900e73f$var$CONTENT_MARGIN = 10;
|
|
2144
1762
|
const [$cc7e05a45900e73f$var$SelectContentProvider, $cc7e05a45900e73f$var$useSelectContentContext] = $cc7e05a45900e73f$var$createSelectContext($cc7e05a45900e73f$var$CONTENT_NAME);
|
|
2145
|
-
const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$
|
|
1763
|
+
const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
2146
1764
|
const { __scopeSelect: __scopeSelect , onCloseAutoFocus: onCloseAutoFocus , ...contentProps } = props;
|
|
2147
1765
|
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$CONTENT_NAME, __scopeSelect);
|
|
2148
|
-
const [contentWrapper, setContentWrapper] = React$
|
|
2149
|
-
const [content, setContent] = React$
|
|
2150
|
-
const [viewport, setViewport] = React$
|
|
2151
|
-
const composedRefs =
|
|
1766
|
+
const [contentWrapper, setContentWrapper] = React$1.useState(null);
|
|
1767
|
+
const [content, setContent] = React$1.useState(null);
|
|
1768
|
+
const [viewport, setViewport] = React$1.useState(null);
|
|
1769
|
+
const composedRefs = index_module.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setContent(node)
|
|
2152
1770
|
);
|
|
2153
|
-
const [selectedItem, setSelectedItem] = React$
|
|
2154
|
-
const [selectedItemText, setSelectedItemText] = React$
|
|
1771
|
+
const [selectedItem, setSelectedItem] = React$1.useState(null);
|
|
1772
|
+
const [selectedItemText, setSelectedItemText] = React$1.useState(null);
|
|
2155
1773
|
const getItems = $cc7e05a45900e73f$var$useCollection(__scopeSelect);
|
|
2156
|
-
const [isPositioned, setIsPositioned] = React$
|
|
2157
|
-
const shouldRepositionRef = React$
|
|
2158
|
-
const shouldExpandOnScrollRef = React$
|
|
2159
|
-
const firstValidItemFoundRef = React$
|
|
2160
|
-
React$
|
|
1774
|
+
const [isPositioned, setIsPositioned] = React$1.useState(false);
|
|
1775
|
+
const shouldRepositionRef = React$1.useRef(true);
|
|
1776
|
+
const shouldExpandOnScrollRef = React$1.useRef(false);
|
|
1777
|
+
const firstValidItemFoundRef = React$1.useRef(false); // aria-hide everything except the content (better supported equivalent to setting aria-modal)
|
|
1778
|
+
React$1.useEffect(()=>{
|
|
2161
1779
|
if (content) return hideOthers(content);
|
|
2162
1780
|
}, [
|
|
2163
1781
|
content
|
|
2164
1782
|
]); // Make sure the whole tree has focus guards as our `Select` may be
|
|
2165
1783
|
// the last element in the DOM (because of the `Portal`)
|
|
2166
1784
|
$3db38b7d1fb3fe6a$export$b7ece24a22aeda8c();
|
|
2167
|
-
const [contentZIndex, setContentZIndex] = React$
|
|
2168
|
-
|
|
1785
|
+
const [contentZIndex, setContentZIndex] = React$1.useState();
|
|
1786
|
+
index_module.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
2169
1787
|
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
2170
1788
|
}, [
|
|
2171
1789
|
content
|
|
2172
1790
|
]);
|
|
2173
|
-
const focusFirst = React$
|
|
1791
|
+
const focusFirst = React$1.useCallback((candidates)=>{
|
|
2174
1792
|
const [firstItem, ...restItems] = getItems().map((item)=>item.ref.current
|
|
2175
1793
|
);
|
|
2176
1794
|
const [lastItem] = restItems.slice(-1);
|
|
@@ -2190,7 +1808,7 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$2.forwardRef
|
|
|
2190
1808
|
getItems,
|
|
2191
1809
|
viewport
|
|
2192
1810
|
]);
|
|
2193
|
-
const position = React$
|
|
1811
|
+
const position = React$1.useCallback(()=>{
|
|
2194
1812
|
if (context.trigger && context.valueNode && contentWrapper && content && viewport && selectedItem && selectedItemText) {
|
|
2195
1813
|
const triggerRect = context.trigger.getBoundingClientRect(); // -----------------------------------------------------------------------------------------
|
|
2196
1814
|
// Horizontal positioning
|
|
@@ -2281,11 +1899,11 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$2.forwardRef
|
|
|
2281
1899
|
selectedItemText,
|
|
2282
1900
|
context.dir
|
|
2283
1901
|
]);
|
|
2284
|
-
|
|
1902
|
+
index_module.$9f79659886946c16$export$e5c5a5f917a5871c(()=>position()
|
|
2285
1903
|
, [
|
|
2286
1904
|
position
|
|
2287
1905
|
]);
|
|
2288
|
-
const focusSelectedItem = React$
|
|
1906
|
+
const focusSelectedItem = React$1.useCallback(()=>focusFirst([
|
|
2289
1907
|
selectedItem,
|
|
2290
1908
|
content
|
|
2291
1909
|
])
|
|
@@ -2295,7 +1913,7 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$2.forwardRef
|
|
|
2295
1913
|
content
|
|
2296
1914
|
]); // Since this is not dependent on layout, we want to ensure this runs at the same time as
|
|
2297
1915
|
// other effects across components. Hence why we don't call `focusSelectedItem` inside `position`.
|
|
2298
|
-
React$
|
|
1916
|
+
React$1.useEffect(()=>{
|
|
2299
1917
|
if (isPositioned) focusSelectedItem();
|
|
2300
1918
|
}, [
|
|
2301
1919
|
isPositioned,
|
|
@@ -2304,7 +1922,7 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$2.forwardRef
|
|
|
2304
1922
|
// Because it is part of the normal flow, it will push down the viewport, thus throwing our
|
|
2305
1923
|
// trigger => selectedItem alignment off by the amount the viewport was pushed down.
|
|
2306
1924
|
// We wait for this to happen and then re-run the positining logic one more time to account for it.
|
|
2307
|
-
const handleScrollButtonChange = React$
|
|
1925
|
+
const handleScrollButtonChange = React$1.useCallback((node)=>{
|
|
2308
1926
|
if (node && shouldRepositionRef.current === true) {
|
|
2309
1927
|
position();
|
|
2310
1928
|
focusSelectedItem();
|
|
@@ -2316,7 +1934,7 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$2.forwardRef
|
|
|
2316
1934
|
]); // prevent selecting items on `pointerup` in some cases after opening from `pointerdown`
|
|
2317
1935
|
// and close on `pointerup` outside.
|
|
2318
1936
|
const { onOpenChange: onOpenChange , triggerPointerDownPosRef: triggerPointerDownPosRef } = context;
|
|
2319
|
-
React$
|
|
1937
|
+
React$1.useEffect(()=>{
|
|
2320
1938
|
if (content) {
|
|
2321
1939
|
let pointerMoveDelta = {
|
|
2322
1940
|
x: 0,
|
|
@@ -2356,7 +1974,7 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$2.forwardRef
|
|
|
2356
1974
|
onOpenChange,
|
|
2357
1975
|
triggerPointerDownPosRef
|
|
2358
1976
|
]);
|
|
2359
|
-
React$
|
|
1977
|
+
React$1.useEffect(()=>{
|
|
2360
1978
|
const close = ()=>onOpenChange(false)
|
|
2361
1979
|
;
|
|
2362
1980
|
window.addEventListener('blur', close);
|
|
@@ -2380,7 +1998,7 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$2.forwardRef
|
|
|
2380
1998
|
*/ setTimeout(()=>nextItem.ref.current.focus()
|
|
2381
1999
|
);
|
|
2382
2000
|
});
|
|
2383
|
-
const itemRefCallback = React$
|
|
2001
|
+
const itemRefCallback = React$1.useCallback((node, value, disabled)=>{
|
|
2384
2002
|
const isFirstValidItem = !firstValidItemFoundRef.current && !disabled;
|
|
2385
2003
|
const isSelectedItem = context.value !== undefined && context.value === value;
|
|
2386
2004
|
if (isSelectedItem || isFirstValidItem) {
|
|
@@ -2390,18 +2008,18 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$2.forwardRef
|
|
|
2390
2008
|
}, [
|
|
2391
2009
|
context.value
|
|
2392
2010
|
]);
|
|
2393
|
-
const handleItemLeave = React$
|
|
2011
|
+
const handleItemLeave = React$1.useCallback(()=>content === null || content === void 0 ? void 0 : content.focus()
|
|
2394
2012
|
, [
|
|
2395
2013
|
content
|
|
2396
2014
|
]);
|
|
2397
|
-
const itemTextRefCallback = React$
|
|
2015
|
+
const itemTextRefCallback = React$1.useCallback((node, value, disabled)=>{
|
|
2398
2016
|
const isFirstValidItem = !firstValidItemFoundRef.current && !disabled;
|
|
2399
2017
|
const isSelectedItem = context.value !== undefined && context.value === value;
|
|
2400
2018
|
if (isSelectedItem || isFirstValidItem) setSelectedItemText(node);
|
|
2401
2019
|
}, [
|
|
2402
2020
|
context.value
|
|
2403
2021
|
]);
|
|
2404
|
-
return /*#__PURE__*/ React$
|
|
2022
|
+
return /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$SelectContentProvider, {
|
|
2405
2023
|
scope: __scopeSelect,
|
|
2406
2024
|
contentWrapper: contentWrapper,
|
|
2407
2025
|
content: content,
|
|
@@ -2416,10 +2034,10 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$2.forwardRef
|
|
|
2416
2034
|
isPositioned: isPositioned,
|
|
2417
2035
|
shouldExpandOnScrollRef: shouldExpandOnScrollRef,
|
|
2418
2036
|
searchRef: searchRef
|
|
2419
|
-
}, /*#__PURE__*/ React$
|
|
2420
|
-
as:
|
|
2037
|
+
}, /*#__PURE__*/ React$1.createElement($01b9c$RemoveScroll, {
|
|
2038
|
+
as: index_module.$5e63c961fc1ce211$export$8c6ed5c666ac1360,
|
|
2421
2039
|
allowPinchZoom: true
|
|
2422
|
-
}, /*#__PURE__*/ React$
|
|
2040
|
+
}, /*#__PURE__*/ React$1.createElement("div", {
|
|
2423
2041
|
ref: setContentWrapper,
|
|
2424
2042
|
style: {
|
|
2425
2043
|
display: 'flex',
|
|
@@ -2427,7 +2045,7 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$2.forwardRef
|
|
|
2427
2045
|
position: 'fixed',
|
|
2428
2046
|
zIndex: contentZIndex
|
|
2429
2047
|
}
|
|
2430
|
-
}, /*#__PURE__*/ React$
|
|
2048
|
+
}, /*#__PURE__*/ React$1.createElement($d3863c46a17e8a28$export$20e40289641fbbb6, {
|
|
2431
2049
|
asChild: true // we make sure we're not trapping once it's been closed
|
|
2432
2050
|
,
|
|
2433
2051
|
trapped: context.open,
|
|
@@ -2435,14 +2053,14 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$2.forwardRef
|
|
|
2435
2053
|
// we prevent open autofocus because we manually focus the selected item
|
|
2436
2054
|
event.preventDefault();
|
|
2437
2055
|
},
|
|
2438
|
-
onUnmountAutoFocus:
|
|
2056
|
+
onUnmountAutoFocus: index_module.$e42e1063c40fb3ef$export$b9ecd428b558ff10(onCloseAutoFocus, (event)=>{
|
|
2439
2057
|
var _context$trigger;
|
|
2440
2058
|
(_context$trigger = context.trigger) === null || _context$trigger === void 0 || _context$trigger.focus({
|
|
2441
2059
|
preventScroll: true
|
|
2442
2060
|
});
|
|
2443
2061
|
event.preventDefault();
|
|
2444
2062
|
})
|
|
2445
|
-
}, /*#__PURE__*/ React$
|
|
2063
|
+
}, /*#__PURE__*/ React$1.createElement($5cb92bef7577960e$export$177fb62ff3ec1f22, index_module._extends({
|
|
2446
2064
|
role: "listbox",
|
|
2447
2065
|
id: context.contentId,
|
|
2448
2066
|
"data-state": context.open ? 'open' : 'closed',
|
|
@@ -2466,7 +2084,7 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$2.forwardRef
|
|
|
2466
2084
|
,
|
|
2467
2085
|
onDismiss: ()=>context.onOpenChange(false)
|
|
2468
2086
|
,
|
|
2469
|
-
onKeyDown:
|
|
2087
|
+
onKeyDown: index_module.$e42e1063c40fb3ef$export$b9ecd428b558ff10(contentProps.onKeyDown, (event)=>{
|
|
2470
2088
|
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey; // select should not be navigated using tab key so we prevent it
|
|
2471
2089
|
if (event.key === 'Tab') event.preventDefault();
|
|
2472
2090
|
if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key);
|
|
@@ -2505,18 +2123,18 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$2.forwardRef
|
|
|
2505
2123
|
/* -------------------------------------------------------------------------------------------------
|
|
2506
2124
|
* SelectViewport
|
|
2507
2125
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$VIEWPORT_NAME = 'SelectViewport';
|
|
2508
|
-
const $cc7e05a45900e73f$export$9ed6e7b40248d36d = /*#__PURE__*/ React$
|
|
2126
|
+
const $cc7e05a45900e73f$export$9ed6e7b40248d36d = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
2509
2127
|
const { __scopeSelect: __scopeSelect , ...viewportProps } = props;
|
|
2510
2128
|
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$VIEWPORT_NAME, __scopeSelect);
|
|
2511
|
-
const composedRefs =
|
|
2512
|
-
const prevScrollTopRef = React$
|
|
2513
|
-
return /*#__PURE__*/ React$
|
|
2129
|
+
const composedRefs = index_module.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, contentContext.onViewportChange);
|
|
2130
|
+
const prevScrollTopRef = React$1.useRef(0);
|
|
2131
|
+
return /*#__PURE__*/ React$1.createElement(React$1.Fragment, null, /*#__PURE__*/ React$1.createElement("style", {
|
|
2514
2132
|
dangerouslySetInnerHTML: {
|
|
2515
2133
|
__html: `[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`
|
|
2516
2134
|
}
|
|
2517
|
-
}), /*#__PURE__*/ React$
|
|
2135
|
+
}), /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$Collection.Slot, {
|
|
2518
2136
|
scope: __scopeSelect
|
|
2519
|
-
}, /*#__PURE__*/ React$
|
|
2137
|
+
}, /*#__PURE__*/ React$1.createElement(index_module.$8927f6f2acc4f386$export$250ffa63cdc0d034.div, index_module._extends({
|
|
2520
2138
|
"data-radix-select-viewport": "",
|
|
2521
2139
|
role: "presentation"
|
|
2522
2140
|
}, viewportProps, {
|
|
@@ -2530,7 +2148,7 @@ const $cc7e05a45900e73f$export$9ed6e7b40248d36d = /*#__PURE__*/ React$2.forwardR
|
|
|
2530
2148
|
overflow: 'auto',
|
|
2531
2149
|
...viewportProps.style
|
|
2532
2150
|
},
|
|
2533
|
-
onScroll:
|
|
2151
|
+
onScroll: index_module.$e42e1063c40fb3ef$export$b9ecd428b558ff10(viewportProps.onScroll, (event)=>{
|
|
2534
2152
|
const viewport = event.currentTarget;
|
|
2535
2153
|
const { contentWrapper: contentWrapper , shouldExpandOnScrollRef: shouldExpandOnScrollRef } = contentContext;
|
|
2536
2154
|
if (shouldExpandOnScrollRef !== null && shouldExpandOnScrollRef !== void 0 && shouldExpandOnScrollRef.current && contentWrapper) {
|
|
@@ -2564,14 +2182,14 @@ $cc7e05a45900e73f$var$createSelectContext($cc7e05a45900e73f$var$GROUP_NAME);
|
|
|
2564
2182
|
* SelectItem
|
|
2565
2183
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$ITEM_NAME = 'SelectItem';
|
|
2566
2184
|
const [$cc7e05a45900e73f$var$SelectItemContextProvider, $cc7e05a45900e73f$var$useSelectItemContext] = $cc7e05a45900e73f$var$createSelectContext($cc7e05a45900e73f$var$ITEM_NAME);
|
|
2567
|
-
const $cc7e05a45900e73f$export$13ef48a934230896 = /*#__PURE__*/ React$
|
|
2185
|
+
const $cc7e05a45900e73f$export$13ef48a934230896 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
2568
2186
|
const { __scopeSelect: __scopeSelect , value: value , disabled: disabled = false , textValue: textValueProp , ...itemProps } = props;
|
|
2569
2187
|
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$ITEM_NAME, __scopeSelect);
|
|
2570
2188
|
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$ITEM_NAME, __scopeSelect);
|
|
2571
2189
|
const isSelected = context.value === value;
|
|
2572
|
-
const [textValue, setTextValue] = React$
|
|
2573
|
-
const [isFocused, setIsFocused] = React$
|
|
2574
|
-
const composedRefs =
|
|
2190
|
+
const [textValue, setTextValue] = React$1.useState(textValueProp !== null && textValueProp !== void 0 ? textValueProp : '');
|
|
2191
|
+
const [isFocused, setIsFocused] = React$1.useState(false);
|
|
2192
|
+
const composedRefs = index_module.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>{
|
|
2575
2193
|
var _contentContext$itemR;
|
|
2576
2194
|
return (_contentContext$itemR = contentContext.itemRefCallback) === null || _contentContext$itemR === void 0 ? void 0 : _contentContext$itemR.call(contentContext, node, value, disabled);
|
|
2577
2195
|
});
|
|
@@ -2582,24 +2200,24 @@ const $cc7e05a45900e73f$export$13ef48a934230896 = /*#__PURE__*/ React$2.forwardR
|
|
|
2582
2200
|
context.onOpenChange(false);
|
|
2583
2201
|
}
|
|
2584
2202
|
};
|
|
2585
|
-
return /*#__PURE__*/ React$
|
|
2203
|
+
return /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$SelectItemContextProvider, {
|
|
2586
2204
|
scope: __scopeSelect,
|
|
2587
2205
|
value: value,
|
|
2588
2206
|
disabled: disabled,
|
|
2589
2207
|
textId: textId,
|
|
2590
2208
|
isSelected: isSelected,
|
|
2591
|
-
onItemTextChange: React$
|
|
2209
|
+
onItemTextChange: React$1.useCallback((node)=>{
|
|
2592
2210
|
setTextValue((prevTextValue)=>{
|
|
2593
2211
|
var _node$textContent;
|
|
2594
2212
|
return prevTextValue || ((_node$textContent = node === null || node === void 0 ? void 0 : node.textContent) !== null && _node$textContent !== void 0 ? _node$textContent : '').trim();
|
|
2595
2213
|
});
|
|
2596
2214
|
}, [])
|
|
2597
|
-
}, /*#__PURE__*/ React$
|
|
2215
|
+
}, /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$Collection.ItemSlot, {
|
|
2598
2216
|
scope: __scopeSelect,
|
|
2599
2217
|
value: value,
|
|
2600
2218
|
disabled: disabled,
|
|
2601
2219
|
textValue: textValue
|
|
2602
|
-
}, /*#__PURE__*/ React$
|
|
2220
|
+
}, /*#__PURE__*/ React$1.createElement(index_module.$8927f6f2acc4f386$export$250ffa63cdc0d034.div, index_module._extends({
|
|
2603
2221
|
role: "option",
|
|
2604
2222
|
"aria-labelledby": textId,
|
|
2605
2223
|
"data-highlighted": isFocused ? '' : undefined // `isFocused` caveat fixes stuttering in VoiceOver
|
|
@@ -2611,12 +2229,12 @@ const $cc7e05a45900e73f$export$13ef48a934230896 = /*#__PURE__*/ React$2.forwardR
|
|
|
2611
2229
|
tabIndex: disabled ? undefined : -1
|
|
2612
2230
|
}, itemProps, {
|
|
2613
2231
|
ref: composedRefs,
|
|
2614
|
-
onFocus:
|
|
2232
|
+
onFocus: index_module.$e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onFocus, ()=>setIsFocused(true)
|
|
2615
2233
|
),
|
|
2616
|
-
onBlur:
|
|
2234
|
+
onBlur: index_module.$e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onBlur, ()=>setIsFocused(false)
|
|
2617
2235
|
),
|
|
2618
|
-
onPointerUp:
|
|
2619
|
-
onPointerMove:
|
|
2236
|
+
onPointerUp: index_module.$e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onPointerUp, handleSelect),
|
|
2237
|
+
onPointerMove: index_module.$e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onPointerMove, (event)=>{
|
|
2620
2238
|
if (disabled) {
|
|
2621
2239
|
var _contentContext$onIte;
|
|
2622
2240
|
(_contentContext$onIte = contentContext.onItemLeave) === null || _contentContext$onIte === void 0 || _contentContext$onIte.call(contentContext);
|
|
@@ -2626,13 +2244,13 @@ const $cc7e05a45900e73f$export$13ef48a934230896 = /*#__PURE__*/ React$2.forwardR
|
|
|
2626
2244
|
preventScroll: true
|
|
2627
2245
|
});
|
|
2628
2246
|
}),
|
|
2629
|
-
onPointerLeave:
|
|
2247
|
+
onPointerLeave: index_module.$e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onPointerLeave, (event)=>{
|
|
2630
2248
|
if (event.currentTarget === document.activeElement) {
|
|
2631
2249
|
var _contentContext$onIte2;
|
|
2632
2250
|
(_contentContext$onIte2 = contentContext.onItemLeave) === null || _contentContext$onIte2 === void 0 || _contentContext$onIte2.call(contentContext);
|
|
2633
2251
|
}
|
|
2634
2252
|
}),
|
|
2635
|
-
onKeyDown:
|
|
2253
|
+
onKeyDown: index_module.$e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onKeyDown, (event)=>{
|
|
2636
2254
|
var _contentContext$searc;
|
|
2637
2255
|
const isTypingAhead = ((_contentContext$searc = contentContext.searchRef) === null || _contentContext$searc === void 0 ? void 0 : _contentContext$searc.current) !== '';
|
|
2638
2256
|
if (isTypingAhead && event.key === ' ') return;
|
|
@@ -2644,21 +2262,21 @@ const $cc7e05a45900e73f$export$13ef48a934230896 = /*#__PURE__*/ React$2.forwardR
|
|
|
2644
2262
|
/* -------------------------------------------------------------------------------------------------
|
|
2645
2263
|
* SelectItemText
|
|
2646
2264
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$ITEM_TEXT_NAME = 'SelectItemText';
|
|
2647
|
-
const $cc7e05a45900e73f$export$3572fb0fb821ff49 = /*#__PURE__*/ React$
|
|
2265
|
+
const $cc7e05a45900e73f$export$3572fb0fb821ff49 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
2648
2266
|
// We ignore `className` and `style` as this part shouldn't be styled.
|
|
2649
2267
|
const { __scopeSelect: __scopeSelect , className: className , style: style , ...itemTextProps } = props;
|
|
2650
2268
|
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$ITEM_TEXT_NAME, __scopeSelect);
|
|
2651
2269
|
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$ITEM_TEXT_NAME, __scopeSelect);
|
|
2652
2270
|
const itemContext = $cc7e05a45900e73f$var$useSelectItemContext($cc7e05a45900e73f$var$ITEM_TEXT_NAME, __scopeSelect);
|
|
2653
2271
|
const nativeOptionsContext = $cc7e05a45900e73f$var$useSelectNativeOptionsContext($cc7e05a45900e73f$var$ITEM_TEXT_NAME, __scopeSelect);
|
|
2654
|
-
const [itemTextNode, setItemTextNode] = React$
|
|
2655
|
-
const composedRefs =
|
|
2272
|
+
const [itemTextNode, setItemTextNode] = React$1.useState(null);
|
|
2273
|
+
const composedRefs = index_module.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setItemTextNode(node)
|
|
2656
2274
|
, itemContext.onItemTextChange, (node)=>{
|
|
2657
2275
|
var _contentContext$itemT;
|
|
2658
2276
|
return (_contentContext$itemT = contentContext.itemTextRefCallback) === null || _contentContext$itemT === void 0 ? void 0 : _contentContext$itemT.call(contentContext, node, itemContext.value, itemContext.disabled);
|
|
2659
2277
|
});
|
|
2660
2278
|
const textContent = itemTextNode === null || itemTextNode === void 0 ? void 0 : itemTextNode.textContent;
|
|
2661
|
-
const nativeOption = React$
|
|
2279
|
+
const nativeOption = React$1.useMemo(()=>/*#__PURE__*/ React$1.createElement("option", {
|
|
2662
2280
|
key: itemContext.value,
|
|
2663
2281
|
value: itemContext.value,
|
|
2664
2282
|
disabled: itemContext.disabled
|
|
@@ -2669,7 +2287,7 @@ const $cc7e05a45900e73f$export$3572fb0fb821ff49 = /*#__PURE__*/ React$2.forwardR
|
|
|
2669
2287
|
textContent
|
|
2670
2288
|
]);
|
|
2671
2289
|
const { onNativeOptionAdd: onNativeOptionAdd , onNativeOptionRemove: onNativeOptionRemove } = nativeOptionsContext;
|
|
2672
|
-
|
|
2290
|
+
index_module.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
2673
2291
|
onNativeOptionAdd(nativeOption);
|
|
2674
2292
|
return ()=>onNativeOptionRemove(nativeOption)
|
|
2675
2293
|
;
|
|
@@ -2678,7 +2296,7 @@ const $cc7e05a45900e73f$export$3572fb0fb821ff49 = /*#__PURE__*/ React$2.forwardR
|
|
|
2678
2296
|
onNativeOptionRemove,
|
|
2679
2297
|
nativeOption
|
|
2680
2298
|
]);
|
|
2681
|
-
return /*#__PURE__*/ React$
|
|
2299
|
+
return /*#__PURE__*/ React$1.createElement(React$1.Fragment, null, /*#__PURE__*/ React$1.createElement(index_module.$8927f6f2acc4f386$export$250ffa63cdc0d034.span, index_module._extends({
|
|
2682
2300
|
id: itemContext.textId
|
|
2683
2301
|
}, itemTextProps, {
|
|
2684
2302
|
ref: composedRefs
|
|
@@ -2687,10 +2305,10 @@ const $cc7e05a45900e73f$export$3572fb0fb821ff49 = /*#__PURE__*/ React$2.forwardR
|
|
|
2687
2305
|
/* -------------------------------------------------------------------------------------------------
|
|
2688
2306
|
* SelectItemIndicator
|
|
2689
2307
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$ITEM_INDICATOR_NAME = 'SelectItemIndicator';
|
|
2690
|
-
const $cc7e05a45900e73f$export$6b9198de19accfe6 = /*#__PURE__*/ React$
|
|
2308
|
+
const $cc7e05a45900e73f$export$6b9198de19accfe6 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
2691
2309
|
const { __scopeSelect: __scopeSelect , ...itemIndicatorProps } = props;
|
|
2692
2310
|
const itemContext = $cc7e05a45900e73f$var$useSelectItemContext($cc7e05a45900e73f$var$ITEM_INDICATOR_NAME, __scopeSelect);
|
|
2693
|
-
return itemContext.isSelected ? /*#__PURE__*/ React$
|
|
2311
|
+
return itemContext.isSelected ? /*#__PURE__*/ React$1.createElement(index_module.$8927f6f2acc4f386$export$250ffa63cdc0d034.span, index_module._extends({
|
|
2694
2312
|
"aria-hidden": true
|
|
2695
2313
|
}, itemIndicatorProps, {
|
|
2696
2314
|
ref: forwardedRef
|
|
@@ -2699,11 +2317,11 @@ const $cc7e05a45900e73f$export$6b9198de19accfe6 = /*#__PURE__*/ React$2.forwardR
|
|
|
2699
2317
|
/* -------------------------------------------------------------------------------------------------
|
|
2700
2318
|
* SelectScrollUpButton
|
|
2701
2319
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$SCROLL_UP_BUTTON_NAME = 'SelectScrollUpButton';
|
|
2702
|
-
const $cc7e05a45900e73f$export$d8117927658af6d7 = /*#__PURE__*/ React$
|
|
2320
|
+
const $cc7e05a45900e73f$export$d8117927658af6d7 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
2703
2321
|
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$SCROLL_UP_BUTTON_NAME, props.__scopeSelect);
|
|
2704
|
-
const [canScrollUp1, setCanScrollUp] = React$
|
|
2705
|
-
const composedRefs =
|
|
2706
|
-
|
|
2322
|
+
const [canScrollUp1, setCanScrollUp] = React$1.useState(false);
|
|
2323
|
+
const composedRefs = index_module.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, contentContext.onScrollButtonChange);
|
|
2324
|
+
index_module.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
2707
2325
|
if (contentContext.viewport && contentContext.isPositioned) {
|
|
2708
2326
|
const viewport = contentContext.viewport;
|
|
2709
2327
|
function handleScroll() {
|
|
@@ -2719,7 +2337,7 @@ const $cc7e05a45900e73f$export$d8117927658af6d7 = /*#__PURE__*/ React$2.forwardR
|
|
|
2719
2337
|
contentContext.viewport,
|
|
2720
2338
|
contentContext.isPositioned
|
|
2721
2339
|
]);
|
|
2722
|
-
return canScrollUp1 ? /*#__PURE__*/ React$
|
|
2340
|
+
return canScrollUp1 ? /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$SelectScrollButtonImpl, index_module._extends({}, props, {
|
|
2723
2341
|
ref: composedRefs,
|
|
2724
2342
|
onAutoScroll: ()=>{
|
|
2725
2343
|
const { viewport: viewport , selectedItem: selectedItem } = contentContext;
|
|
@@ -2730,11 +2348,11 @@ const $cc7e05a45900e73f$export$d8117927658af6d7 = /*#__PURE__*/ React$2.forwardR
|
|
|
2730
2348
|
/* -------------------------------------------------------------------------------------------------
|
|
2731
2349
|
* SelectScrollDownButton
|
|
2732
2350
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$SCROLL_DOWN_BUTTON_NAME = 'SelectScrollDownButton';
|
|
2733
|
-
const $cc7e05a45900e73f$export$ff951e476c12189 = /*#__PURE__*/ React$
|
|
2351
|
+
const $cc7e05a45900e73f$export$ff951e476c12189 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
2734
2352
|
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);
|
|
2735
|
-
const [canScrollDown1, setCanScrollDown] = React$
|
|
2736
|
-
const composedRefs =
|
|
2737
|
-
|
|
2353
|
+
const [canScrollDown1, setCanScrollDown] = React$1.useState(false);
|
|
2354
|
+
const composedRefs = index_module.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, contentContext.onScrollButtonChange);
|
|
2355
|
+
index_module.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
2738
2356
|
if (contentContext.viewport && contentContext.isPositioned) {
|
|
2739
2357
|
const viewport = contentContext.viewport;
|
|
2740
2358
|
function handleScroll() {
|
|
@@ -2752,7 +2370,7 @@ const $cc7e05a45900e73f$export$ff951e476c12189 = /*#__PURE__*/ React$2.forwardRe
|
|
|
2752
2370
|
contentContext.viewport,
|
|
2753
2371
|
contentContext.isPositioned
|
|
2754
2372
|
]);
|
|
2755
|
-
return canScrollDown1 ? /*#__PURE__*/ React$
|
|
2373
|
+
return canScrollDown1 ? /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$SelectScrollButtonImpl, index_module._extends({}, props, {
|
|
2756
2374
|
ref: composedRefs,
|
|
2757
2375
|
onAutoScroll: ()=>{
|
|
2758
2376
|
const { viewport: viewport , selectedItem: selectedItem } = contentContext;
|
|
@@ -2760,18 +2378,18 @@ const $cc7e05a45900e73f$export$ff951e476c12189 = /*#__PURE__*/ React$2.forwardRe
|
|
|
2760
2378
|
}
|
|
2761
2379
|
})) : null;
|
|
2762
2380
|
});
|
|
2763
|
-
const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ React$
|
|
2381
|
+
const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
2764
2382
|
const { __scopeSelect: __scopeSelect , onAutoScroll: onAutoScroll , ...scrollIndicatorProps } = props;
|
|
2765
2383
|
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext('SelectScrollButton', __scopeSelect);
|
|
2766
|
-
const autoScrollTimerRef = React$
|
|
2384
|
+
const autoScrollTimerRef = React$1.useRef(null);
|
|
2767
2385
|
const getItems = $cc7e05a45900e73f$var$useCollection(__scopeSelect);
|
|
2768
|
-
const clearAutoScrollTimer = React$
|
|
2386
|
+
const clearAutoScrollTimer = React$1.useCallback(()=>{
|
|
2769
2387
|
if (autoScrollTimerRef.current !== null) {
|
|
2770
2388
|
window.clearInterval(autoScrollTimerRef.current);
|
|
2771
2389
|
autoScrollTimerRef.current = null;
|
|
2772
2390
|
}
|
|
2773
2391
|
}, []);
|
|
2774
|
-
React$
|
|
2392
|
+
React$1.useEffect(()=>{
|
|
2775
2393
|
return ()=>clearAutoScrollTimer()
|
|
2776
2394
|
;
|
|
2777
2395
|
}, [
|
|
@@ -2780,7 +2398,7 @@ const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ React$2.forwa
|
|
|
2780
2398
|
// Because it is part of the normal flow, it will push down (top button) or shrink (bottom button)
|
|
2781
2399
|
// the viewport, potentially causing the active item to now be partially out of view.
|
|
2782
2400
|
// We re-run the `scrollIntoView` logic to make sure it stays within the viewport.
|
|
2783
|
-
|
|
2401
|
+
index_module.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
2784
2402
|
var _activeItem$ref$curre;
|
|
2785
2403
|
const activeItem = getItems().find((item)=>item.ref.current === document.activeElement
|
|
2786
2404
|
);
|
|
@@ -2790,7 +2408,7 @@ const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ React$2.forwa
|
|
|
2790
2408
|
}, [
|
|
2791
2409
|
getItems
|
|
2792
2410
|
]);
|
|
2793
|
-
return /*#__PURE__*/ React$
|
|
2411
|
+
return /*#__PURE__*/ React$1.createElement(index_module.$8927f6f2acc4f386$export$250ffa63cdc0d034.div, index_module._extends({
|
|
2794
2412
|
"aria-hidden": true
|
|
2795
2413
|
}, scrollIndicatorProps, {
|
|
2796
2414
|
ref: forwardedRef,
|
|
@@ -2798,22 +2416,22 @@ const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ React$2.forwa
|
|
|
2798
2416
|
flexShrink: 0,
|
|
2799
2417
|
...scrollIndicatorProps.style
|
|
2800
2418
|
},
|
|
2801
|
-
onPointerMove:
|
|
2419
|
+
onPointerMove: index_module.$e42e1063c40fb3ef$export$b9ecd428b558ff10(scrollIndicatorProps.onPointerMove, ()=>{
|
|
2802
2420
|
var _contentContext$onIte3;
|
|
2803
2421
|
(_contentContext$onIte3 = contentContext.onItemLeave) === null || _contentContext$onIte3 === void 0 || _contentContext$onIte3.call(contentContext);
|
|
2804
2422
|
if (autoScrollTimerRef.current === null) autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);
|
|
2805
2423
|
}),
|
|
2806
|
-
onPointerLeave:
|
|
2424
|
+
onPointerLeave: index_module.$e42e1063c40fb3ef$export$b9ecd428b558ff10(scrollIndicatorProps.onPointerLeave, ()=>{
|
|
2807
2425
|
clearAutoScrollTimer();
|
|
2808
2426
|
})
|
|
2809
2427
|
}));
|
|
2810
2428
|
});
|
|
2811
|
-
/* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$BubbleSelect = /*#__PURE__*/ React$
|
|
2429
|
+
/* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$BubbleSelect = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
2812
2430
|
const { value: value , ...selectProps } = props;
|
|
2813
|
-
const ref = React$
|
|
2814
|
-
const composedRefs =
|
|
2815
|
-
const prevValue =
|
|
2816
|
-
React$
|
|
2431
|
+
const ref = React$1.useRef(null);
|
|
2432
|
+
const composedRefs = index_module.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
|
|
2433
|
+
const prevValue = index_module.$010c2913dbd2fe3d$export$5cae361ad82dce8b(value); // Bubble value change to parents (e.g form change event)
|
|
2434
|
+
React$1.useEffect(()=>{
|
|
2817
2435
|
const select = ref.current;
|
|
2818
2436
|
const selectProto = window.HTMLSelectElement.prototype;
|
|
2819
2437
|
const descriptor = Object.getOwnPropertyDescriptor(selectProto, 'value');
|
|
@@ -2840,19 +2458,19 @@ const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ React$2.forwa
|
|
|
2840
2458
|
*
|
|
2841
2459
|
* We use `VisuallyHidden` rather than `display: "none"` because Safari autofill
|
|
2842
2460
|
* won't work otherwise.
|
|
2843
|
-
*/ return /*#__PURE__*/ React$
|
|
2461
|
+
*/ return /*#__PURE__*/ React$1.createElement($ea1ef594cf570d83$export$439d29a4e110a164, {
|
|
2844
2462
|
asChild: true
|
|
2845
|
-
}, /*#__PURE__*/ React$
|
|
2463
|
+
}, /*#__PURE__*/ React$1.createElement("select", index_module._extends({}, selectProps, {
|
|
2846
2464
|
ref: composedRefs,
|
|
2847
2465
|
defaultValue: value
|
|
2848
2466
|
})));
|
|
2849
2467
|
});
|
|
2850
2468
|
$cc7e05a45900e73f$var$BubbleSelect.displayName = 'BubbleSelect';
|
|
2851
2469
|
function $cc7e05a45900e73f$var$useTypeaheadSearch(onSearchChange) {
|
|
2852
|
-
const handleSearchChange =
|
|
2853
|
-
const searchRef = React$
|
|
2854
|
-
const timerRef = React$
|
|
2855
|
-
const handleTypeaheadSearch = React$
|
|
2470
|
+
const handleSearchChange = index_module.$b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onSearchChange);
|
|
2471
|
+
const searchRef = React$1.useRef('');
|
|
2472
|
+
const timerRef = React$1.useRef(0);
|
|
2473
|
+
const handleTypeaheadSearch = React$1.useCallback((key)=>{
|
|
2856
2474
|
const search = searchRef.current + key;
|
|
2857
2475
|
handleSearchChange(search);
|
|
2858
2476
|
(function updateSearch(value) {
|
|
@@ -2864,11 +2482,11 @@ function $cc7e05a45900e73f$var$useTypeaheadSearch(onSearchChange) {
|
|
|
2864
2482
|
}, [
|
|
2865
2483
|
handleSearchChange
|
|
2866
2484
|
]);
|
|
2867
|
-
const resetTypeahead = React$
|
|
2485
|
+
const resetTypeahead = React$1.useCallback(()=>{
|
|
2868
2486
|
searchRef.current = '';
|
|
2869
2487
|
window.clearTimeout(timerRef.current);
|
|
2870
2488
|
}, []);
|
|
2871
|
-
React$
|
|
2489
|
+
React$1.useEffect(()=>{
|
|
2872
2490
|
return ()=>window.clearTimeout(timerRef.current)
|
|
2873
2491
|
;
|
|
2874
2492
|
}, []);
|
|
@@ -2927,28 +2545,8 @@ const $cc7e05a45900e73f$export$c3468e2714d175fa = $cc7e05a45900e73f$export$6b919
|
|
|
2927
2545
|
const $cc7e05a45900e73f$export$2f60d3ec9ad468f2 = $cc7e05a45900e73f$export$d8117927658af6d7;
|
|
2928
2546
|
const $cc7e05a45900e73f$export$bf1aedc3039c8d63 = $cc7e05a45900e73f$export$ff951e476c12189;
|
|
2929
2547
|
|
|
2930
|
-
const React$1 = React__default["default"];
|
|
2931
|
-
const BtIconChevronUp2Px = props =>
|
|
2932
|
-
/*#__PURE__*/ React$1.createElement(
|
|
2933
|
-
"svg",
|
|
2934
|
-
Object.assign(
|
|
2935
|
-
{
|
|
2936
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2937
|
-
viewBox: "0 0 32 32"
|
|
2938
|
-
},
|
|
2939
|
-
props
|
|
2940
|
-
),
|
|
2941
|
-
/*#__PURE__*/ React$1.createElement("defs", null),
|
|
2942
|
-
/*#__PURE__*/ React$1.createElement("path", {
|
|
2943
|
-
d:
|
|
2944
|
-
"M28.999,23.5a.99676.99676,0,0,1-.707-.293l-12.28515-12.293L3.708,23.207A.99989.99989,0,0,1,2.294,21.793l13.71289-13.707L29.70605,21.793a.99976.99976,0,0,1-.707,1.707Z",
|
|
2945
|
-
fill: "currentColor"
|
|
2946
|
-
})
|
|
2947
|
-
);
|
|
2948
|
-
var BtIconChevronUp2Px_2 = BtIconChevronUp2Px;
|
|
2949
|
-
|
|
2950
2548
|
const React = React__default["default"];
|
|
2951
|
-
const
|
|
2549
|
+
const BtIconChevronUp2Px = props =>
|
|
2952
2550
|
/*#__PURE__*/ React.createElement(
|
|
2953
2551
|
"svg",
|
|
2954
2552
|
Object.assign(
|
|
@@ -2961,23 +2559,27 @@ const BtIconTickAlt2Px = props =>
|
|
|
2961
2559
|
/*#__PURE__*/ React.createElement("defs", null),
|
|
2962
2560
|
/*#__PURE__*/ React.createElement("path", {
|
|
2963
2561
|
d:
|
|
2964
|
-
"
|
|
2562
|
+
"M28.999,23.5a.99676.99676,0,0,1-.707-.293l-12.28515-12.293L3.708,23.207A.99989.99989,0,0,1,2.294,21.793l13.71289-13.707L29.70605,21.793a.99976.99976,0,0,1-.707,1.707Z",
|
|
2965
2563
|
fill: "currentColor"
|
|
2966
2564
|
})
|
|
2967
2565
|
);
|
|
2968
|
-
var
|
|
2566
|
+
var BtIconChevronUp2Px_2 = BtIconChevronUp2Px;
|
|
2969
2567
|
|
|
2970
2568
|
/** Use `Select` to choose from a dropdown list of options. */
|
|
2971
2569
|
var Select = function (_a) {
|
|
2972
2570
|
var isRequired = _a.isRequired, isDisabled = _a.isDisabled, placeholder = _a.placeholder, label = _a.label, options = _a.options, onOpenChange = _a.onOpenChange, isDefaultOpen = _a.isDefaultOpen, defaultValue = _a.defaultValue, errorMessage = _a.errorMessage, labelSize = _a.labelSize, helper = _a.helper, name = _a.name, isFluid = _a.isFluid, onBlur = _a.onBlur, onChange = _a.onChange, disclosureTitle = _a.disclosureTitle, disclosureText = _a.disclosureText, onClickDisclosure = _a.onClickDisclosure;
|
|
2973
|
-
var id = React$
|
|
2974
|
-
var arcRootElement = React$
|
|
2975
|
-
var surface = React$
|
|
2976
|
-
var _b = React$
|
|
2571
|
+
var id = React$1.useId();
|
|
2572
|
+
var arcRootElement = React$1.useContext(Base.ArcRootElementContext);
|
|
2573
|
+
var surface = React$1.useContext(Surface.Context).surface;
|
|
2574
|
+
var _b = React$1.useState(defaultValue), selectedValue = _b[0], setSelectedValue = _b[1];
|
|
2977
2575
|
var onValueChange = function (value) {
|
|
2978
2576
|
onChange && onChange(value);
|
|
2979
2577
|
setSelectedValue(value);
|
|
2980
2578
|
};
|
|
2579
|
+
var getSelectedValueName = function (value) {
|
|
2580
|
+
var _a;
|
|
2581
|
+
return (_a = options.find(function (option) { return option.value === value; })) === null || _a === void 0 ? void 0 : _a.name;
|
|
2582
|
+
};
|
|
2981
2583
|
return (React__default["default"].createElement(FormControl.FormControl, { errorMessage: errorMessage, helper: helper, htmlFor: id, label: label, labelSize: labelSize, requirementStatus: isRequired ? "required" : "optional", isDisabled: isDisabled, disclosureText: disclosureText, disclosureTitle: disclosureTitle, onClickDisclosure: onClickDisclosure },
|
|
2982
2584
|
React__default["default"].createElement($cc7e05a45900e73f$export$be92b6f5f03c0fe9, { name: name, required: isRequired, disabled: isDisabled, defaultOpen: isDefaultOpen, value: selectedValue, onOpenChange: onOpenChange, onValueChange: function (value) { return onValueChange(value); } },
|
|
2983
2585
|
React__default["default"].createElement($cc7e05a45900e73f$export$41fb9f06171c75f4, { id: id, name: name, onBlur: onBlur, className: index.classNames("arc-Select-trigger", {
|
|
@@ -2985,7 +2587,7 @@ var Select = function (_a) {
|
|
|
2985
2587
|
"arc-Select-trigger--onDarkSurface": surface === "dark",
|
|
2986
2588
|
"arc-Select-trigger--invalid": errorMessage
|
|
2987
2589
|
}) },
|
|
2988
|
-
React__default["default"].createElement($cc7e05a45900e73f$export$4c8d1a57a761ef94, { asChild: true, "aria-label": selectedValue }, !selectedValue ? (React__default["default"].createElement("span", { "aria-hidden": true, className: "arc-Select-placeHolder" }, placeholder)) : (React__default["default"].createElement("span", { className: "arc-Select-valueItem" }, selectedValue))),
|
|
2590
|
+
React__default["default"].createElement($cc7e05a45900e73f$export$4c8d1a57a761ef94, { asChild: true, "aria-label": getSelectedValueName(selectedValue) }, !selectedValue ? (React__default["default"].createElement("span", { "aria-hidden": true, className: "arc-Select-placeHolder" }, placeholder)) : (React__default["default"].createElement("span", { className: "arc-Select-valueItem" }, getSelectedValueName(selectedValue)))),
|
|
2989
2591
|
React__default["default"].createElement($cc7e05a45900e73f$export$f04a61298a47a40f, { className: "arc-Select-triggerIcon" },
|
|
2990
2592
|
React__default["default"].createElement(Icon.Icon, { icon: BtIconChevronDown2Px.BtIconChevronDown2Px_2, size: 20 }))),
|
|
2991
2593
|
React__default["default"].createElement($cc7e05a45900e73f$export$602eac185826482c, { container: arcRootElement },
|
|
@@ -3001,7 +2603,7 @@ var Select = function (_a) {
|
|
|
3001
2603
|
React__default["default"].createElement($cc7e05a45900e73f$export$d6e5bf9c43ea9319, { asChild: true },
|
|
3002
2604
|
React__default["default"].createElement("span", { className: "arc-Select-itemText" }, name))),
|
|
3003
2605
|
React__default["default"].createElement($cc7e05a45900e73f$export$c3468e2714d175fa, null,
|
|
3004
|
-
React__default["default"].createElement(Icon.Icon, { icon: BtIconTickAlt2Px_2, size: 20 }))));
|
|
2606
|
+
React__default["default"].createElement(Icon.Icon, { icon: BtIconTickAlt2Px.BtIconTickAlt2Px_2, size: 20 }))));
|
|
3005
2607
|
})),
|
|
3006
2608
|
React__default["default"].createElement($cc7e05a45900e73f$export$bf1aedc3039c8d63, { className: "arc-Select-scrollButton" },
|
|
3007
2609
|
React__default["default"].createElement(Icon.Icon, { icon: BtIconChevronDown2Px.BtIconChevronDown2Px_2, size: 16 })))))));
|