@arc-ui/components 11.1.0 → 11.2.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/Select/Select.cjs.js +207 -606
- package/dist/Select/Select.esm.js +43 -442
- package/dist/Switch/Switch.cjs.d.ts +40 -0
- package/dist/Switch/Switch.cjs.js +210 -0
- package/dist/Switch/Switch.esm.d.ts +40 -0
- package/dist/Switch/Switch.esm.js +202 -0
- package/dist/Switch/package.json +7 -0
- 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-b12ecc78.js +425 -0
- package/dist/_shared/cjs/VerticalSpace-65ad083c.d.ts +18 -0
- package/dist/_shared/cjs/VerticalSpace-65ad083c.js +25 -0
- package/dist/_shared/esm/BtIconTickAlt2Px-2c4ec3be.js +408 -0
- package/dist/_shared/esm/VerticalSpace-6b4f5e50.d.ts +18 -0
- package/dist/_shared/esm/VerticalSpace-6b4f5e50.js +19 -0
- package/dist/index.es.js +208 -16
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +208 -15
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/components/Switch/Switch.d.ts +13 -8
- package/dist/types/components/index.d.ts +1 -0
- package/package.json +4 -4
|
@@ -3,7 +3,8 @@
|
|
|
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 BtIconTickAlt2Px = require('../_shared/cjs/BtIconTickAlt2Px-b12ecc78.js');
|
|
7
8
|
var $7SXl2$reactdom = require('react-dom');
|
|
8
9
|
var BtIconChevronDown2Px = require('../_shared/cjs/BtIconChevronDown2Px-8fb4e2eb.js');
|
|
9
10
|
var Icon = require('../_shared/cjs/Icon-719d13d4.js');
|
|
@@ -18,252 +19,31 @@ require('../_shared/cjs/BtIconChevronRightMid-5a38d855.js');
|
|
|
18
19
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
19
20
|
|
|
20
21
|
function _interopNamespace(e) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
if (e && e.__esModule) return e;
|
|
23
|
+
var n = Object.create(null);
|
|
24
|
+
if (e) {
|
|
25
|
+
Object.keys(e).forEach(function (k) {
|
|
26
|
+
if (k !== 'default') {
|
|
27
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
28
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
29
|
+
enumerable: true,
|
|
30
|
+
get: function () { return e[k]; }
|
|
31
|
+
});
|
|
32
|
+
}
|
|
30
33
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
n["default"] = e;
|
|
35
|
-
return Object.freeze(n);
|
|
34
|
+
}
|
|
35
|
+
n["default"] = e;
|
|
36
|
+
return Object.freeze(n);
|
|
36
37
|
}
|
|
37
38
|
|
|
38
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React$
|
|
39
|
-
var React__namespace = /*#__PURE__*/_interopNamespace(React$
|
|
39
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React$1);
|
|
40
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React$1);
|
|
40
41
|
var $7SXl2$reactdom__default = /*#__PURE__*/_interopDefaultLegacy($7SXl2$reactdom);
|
|
41
42
|
|
|
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
43
|
function $ae6933e535247d3d$export$7d15b64cf5a3a4c4(value, [min, max]) {
|
|
61
44
|
return Math.min(max, Math.max(min, value));
|
|
62
45
|
}
|
|
63
46
|
|
|
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
47
|
// We have resorted to returning slots directly rather than exposing primitives that can then
|
|
268
48
|
// be slotted like `<CollectionItem as={Slot}>…</CollectionItem>`.
|
|
269
49
|
// This is because we encountered issues with generic types that cannot be statically analysed
|
|
@@ -272,7 +52,7 @@ function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name) {
|
|
|
272
52
|
/* -----------------------------------------------------------------------------------------------
|
|
273
53
|
* CollectionProvider
|
|
274
54
|
* ---------------------------------------------------------------------------------------------*/ const PROVIDER_NAME = name + 'CollectionProvider';
|
|
275
|
-
const [createCollectionContext, createCollectionScope] =
|
|
55
|
+
const [createCollectionContext, createCollectionScope] = BtIconTickAlt2Px.$c512c27ab02ef895$export$50c7b4e9d9f19c1(PROVIDER_NAME);
|
|
276
56
|
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(PROVIDER_NAME, {
|
|
277
57
|
collectionRef: {
|
|
278
58
|
current: null
|
|
@@ -295,8 +75,8 @@ function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name) {
|
|
|
295
75
|
const CollectionSlot = /*#__PURE__*/ React__default["default"].forwardRef((props, forwardedRef)=>{
|
|
296
76
|
const { scope: scope , children: children } = props;
|
|
297
77
|
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
298
|
-
const composedRefs =
|
|
299
|
-
return /*#__PURE__*/ React__default["default"].createElement(
|
|
78
|
+
const composedRefs = BtIconTickAlt2Px.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.collectionRef);
|
|
79
|
+
return /*#__PURE__*/ React__default["default"].createElement(BtIconTickAlt2Px.$5e63c961fc1ce211$export$8c6ed5c666ac1360, {
|
|
300
80
|
ref: composedRefs
|
|
301
81
|
}, children);
|
|
302
82
|
});
|
|
@@ -307,7 +87,7 @@ function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name) {
|
|
|
307
87
|
const CollectionItemSlot = /*#__PURE__*/ React__default["default"].forwardRef((props, forwardedRef)=>{
|
|
308
88
|
const { scope: scope , children: children , ...itemData } = props;
|
|
309
89
|
const ref = React__default["default"].useRef(null);
|
|
310
|
-
const composedRefs =
|
|
90
|
+
const composedRefs = BtIconTickAlt2Px.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
|
|
311
91
|
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
312
92
|
React__default["default"].useEffect(()=>{
|
|
313
93
|
context.itemMap.set(ref, {
|
|
@@ -317,7 +97,7 @@ function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name) {
|
|
|
317
97
|
return ()=>void context.itemMap.delete(ref)
|
|
318
98
|
;
|
|
319
99
|
});
|
|
320
|
-
return /*#__PURE__*/ React__default["default"].createElement(
|
|
100
|
+
return /*#__PURE__*/ React__default["default"].createElement(BtIconTickAlt2Px.$5e63c961fc1ce211$export$8c6ed5c666ac1360, {
|
|
321
101
|
[ITEM_DATA_ATTR]: '',
|
|
322
102
|
ref: composedRefs
|
|
323
103
|
}, children);
|
|
@@ -351,111 +131,17 @@ function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name) {
|
|
|
351
131
|
];
|
|
352
132
|
}
|
|
353
133
|
|
|
354
|
-
const $f631663db3294ace$var$DirectionContext = /*#__PURE__*/ React$
|
|
134
|
+
const $f631663db3294ace$var$DirectionContext = /*#__PURE__*/ React$1.createContext(undefined);
|
|
355
135
|
/* -----------------------------------------------------------------------------------------------*/ function $f631663db3294ace$export$b39126d51d94e6f3(localDir) {
|
|
356
|
-
const globalDir = React$
|
|
136
|
+
const globalDir = React$1.useContext($f631663db3294ace$var$DirectionContext);
|
|
357
137
|
return localDir || globalDir || 'ltr';
|
|
358
138
|
}
|
|
359
139
|
|
|
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
140
|
/**
|
|
455
141
|
* Listens for when the escape key is down
|
|
456
142
|
*/ function $addc16e1bbe58fd0$export$3a72a57244d6e765(onEscapeKeyDownProp, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
|
|
457
|
-
const onEscapeKeyDown =
|
|
458
|
-
React$
|
|
143
|
+
const onEscapeKeyDown = BtIconTickAlt2Px.$b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onEscapeKeyDownProp);
|
|
144
|
+
React$1.useEffect(()=>{
|
|
459
145
|
const handleKeyDown = (event)=>{
|
|
460
146
|
if (event.key === 'Escape') onEscapeKeyDown(event);
|
|
461
147
|
};
|
|
@@ -472,19 +158,19 @@ const $5cb92bef7577960e$var$CONTEXT_UPDATE = 'dismissableLayer.update';
|
|
|
472
158
|
const $5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE = 'dismissableLayer.pointerDownOutside';
|
|
473
159
|
const $5cb92bef7577960e$var$FOCUS_OUTSIDE = 'dismissableLayer.focusOutside';
|
|
474
160
|
let $5cb92bef7577960e$var$originalBodyPointerEvents;
|
|
475
|
-
const $5cb92bef7577960e$var$DismissableLayerContext = /*#__PURE__*/ React$
|
|
161
|
+
const $5cb92bef7577960e$var$DismissableLayerContext = /*#__PURE__*/ React$1.createContext({
|
|
476
162
|
layers: new Set(),
|
|
477
163
|
layersWithOutsidePointerEventsDisabled: new Set(),
|
|
478
164
|
branches: new Set()
|
|
479
165
|
});
|
|
480
|
-
const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ React$
|
|
166
|
+
const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
481
167
|
var _node$ownerDocument;
|
|
482
168
|
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$
|
|
169
|
+
const context = React$1.useContext($5cb92bef7577960e$var$DismissableLayerContext);
|
|
170
|
+
const [node1, setNode] = React$1.useState(null);
|
|
485
171
|
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 =
|
|
172
|
+
const [, force] = React$1.useState({});
|
|
173
|
+
const composedRefs = BtIconTickAlt2Px.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setNode(node)
|
|
488
174
|
);
|
|
489
175
|
const layers = Array.from(context.layers);
|
|
490
176
|
const [highestLayerWithOutsidePointerEventsDisabled] = [
|
|
@@ -525,7 +211,7 @@ const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ React$2.forwardR
|
|
|
525
211
|
onDismiss();
|
|
526
212
|
}
|
|
527
213
|
}, ownerDocument);
|
|
528
|
-
React$
|
|
214
|
+
React$1.useEffect(()=>{
|
|
529
215
|
if (!node1) return;
|
|
530
216
|
if (disableOutsidePointerEvents) {
|
|
531
217
|
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
@@ -550,7 +236,7 @@ const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ React$2.forwardR
|
|
|
550
236
|
* because a change to `disableOutsidePointerEvents` would remove this layer from the stack
|
|
551
237
|
* and add it to the end again so the layering order wouldn't be _creation order_.
|
|
552
238
|
* We only want them to be removed from context stacks when unmounted.
|
|
553
|
-
*/ React$
|
|
239
|
+
*/ React$1.useEffect(()=>{
|
|
554
240
|
return ()=>{
|
|
555
241
|
if (!node1) return;
|
|
556
242
|
context.layers.delete(node1);
|
|
@@ -561,22 +247,22 @@ const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ React$2.forwardR
|
|
|
561
247
|
node1,
|
|
562
248
|
context
|
|
563
249
|
]);
|
|
564
|
-
React$
|
|
250
|
+
React$1.useEffect(()=>{
|
|
565
251
|
const handleUpdate = ()=>force({})
|
|
566
252
|
;
|
|
567
253
|
document.addEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate);
|
|
568
254
|
return ()=>document.removeEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate)
|
|
569
255
|
;
|
|
570
256
|
}, []);
|
|
571
|
-
return /*#__PURE__*/ React$
|
|
257
|
+
return /*#__PURE__*/ React$1.createElement(BtIconTickAlt2Px.$8927f6f2acc4f386$export$250ffa63cdc0d034.div, BtIconTickAlt2Px._extends({}, layerProps, {
|
|
572
258
|
ref: composedRefs,
|
|
573
259
|
style: {
|
|
574
260
|
pointerEvents: isBodyPointerEventsDisabled ? isPointerEventsEnabled ? 'auto' : 'none' : undefined,
|
|
575
261
|
...props.style
|
|
576
262
|
},
|
|
577
|
-
onFocusCapture:
|
|
578
|
-
onBlurCapture:
|
|
579
|
-
onPointerDownCapture:
|
|
263
|
+
onFocusCapture: BtIconTickAlt2Px.$e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onFocusCapture, focusOutside.onFocusCapture),
|
|
264
|
+
onBlurCapture: BtIconTickAlt2Px.$e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onBlurCapture, focusOutside.onBlurCapture),
|
|
265
|
+
onPointerDownCapture: BtIconTickAlt2Px.$e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDownCapture, pointerDownOutside.onPointerDownCapture)
|
|
580
266
|
}));
|
|
581
267
|
});
|
|
582
268
|
/* -----------------------------------------------------------------------------------------------*/ /**
|
|
@@ -584,10 +270,10 @@ const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ React$2.forwardR
|
|
|
584
270
|
* to mimic layer dismissing behaviour present in OS.
|
|
585
271
|
* Returns props to pass to the node we want to check for outside events.
|
|
586
272
|
*/ 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$
|
|
273
|
+
const handlePointerDownOutside = BtIconTickAlt2Px.$b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onPointerDownOutside);
|
|
274
|
+
const isPointerInsideReactTreeRef = React$1.useRef(false);
|
|
275
|
+
const handleClickRef = React$1.useRef(()=>{});
|
|
276
|
+
React$1.useEffect(()=>{
|
|
591
277
|
const handlePointerDown = (event)=>{
|
|
592
278
|
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
593
279
|
const eventDetail = {
|
|
@@ -652,9 +338,9 @@ const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ React$2.forwardR
|
|
|
652
338
|
* Listens for when focus happens outside a react subtree.
|
|
653
339
|
* Returns props to pass to the root (node) of the subtree we want to check.
|
|
654
340
|
*/ function $5cb92bef7577960e$var$useFocusOutside(onFocusOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
|
|
655
|
-
const handleFocusOutside =
|
|
656
|
-
const isFocusInsideReactTreeRef = React$
|
|
657
|
-
React$
|
|
341
|
+
const handleFocusOutside = BtIconTickAlt2Px.$b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onFocusOutside);
|
|
342
|
+
const isFocusInsideReactTreeRef = React$1.useRef(false);
|
|
343
|
+
React$1.useEffect(()=>{
|
|
658
344
|
const handleFocus = (event)=>{
|
|
659
345
|
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
660
346
|
const eventDetail = {
|
|
@@ -692,7 +378,7 @@ function $5cb92bef7577960e$var$handleAndDispatchCustomEvent(name, handler, detai
|
|
|
692
378
|
if (handler) target.addEventListener(name, handler, {
|
|
693
379
|
once: true
|
|
694
380
|
});
|
|
695
|
-
if (discrete)
|
|
381
|
+
if (discrete) BtIconTickAlt2Px.$8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event);
|
|
696
382
|
else target.dispatchEvent(event);
|
|
697
383
|
}
|
|
698
384
|
|
|
@@ -701,7 +387,7 @@ function $5cb92bef7577960e$var$handleAndDispatchCustomEvent(name, handler, detai
|
|
|
701
387
|
* Injects a pair of focus guards at the edges of the whole DOM tree
|
|
702
388
|
* to ensure `focusin` & `focusout` events can be caught consistently.
|
|
703
389
|
*/ function $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c() {
|
|
704
|
-
React$
|
|
390
|
+
React$1.useEffect(()=>{
|
|
705
391
|
var _edgeGuards$, _edgeGuards$2;
|
|
706
392
|
const edgeGuards = document.querySelectorAll('[data-radix-focus-guard]');
|
|
707
393
|
document.body.insertAdjacentElement('afterbegin', (_edgeGuards$ = edgeGuards[0]) !== null && _edgeGuards$ !== void 0 ? _edgeGuards$ : $3db38b7d1fb3fe6a$var$createFocusGuard());
|
|
@@ -728,15 +414,15 @@ const $d3863c46a17e8a28$var$EVENT_OPTIONS = {
|
|
|
728
414
|
bubbles: false,
|
|
729
415
|
cancelable: true
|
|
730
416
|
};
|
|
731
|
-
const $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ React$
|
|
417
|
+
const $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
732
418
|
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 =
|
|
419
|
+
const [container1, setContainer] = React$1.useState(null);
|
|
420
|
+
const onMountAutoFocus = BtIconTickAlt2Px.$b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onMountAutoFocusProp);
|
|
421
|
+
const onUnmountAutoFocus = BtIconTickAlt2Px.$b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onUnmountAutoFocusProp);
|
|
422
|
+
const lastFocusedElementRef = React$1.useRef(null);
|
|
423
|
+
const composedRefs = BtIconTickAlt2Px.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setContainer(node)
|
|
738
424
|
);
|
|
739
|
-
const focusScope = React$
|
|
425
|
+
const focusScope = React$1.useRef({
|
|
740
426
|
paused: false,
|
|
741
427
|
pause () {
|
|
742
428
|
this.paused = true;
|
|
@@ -745,7 +431,7 @@ const $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ React$2.forwardR
|
|
|
745
431
|
this.paused = false;
|
|
746
432
|
}
|
|
747
433
|
}).current; // Takes care of trapping focus if focus is moved outside programmatically for example
|
|
748
|
-
React$
|
|
434
|
+
React$1.useEffect(()=>{
|
|
749
435
|
if (trapped) {
|
|
750
436
|
function handleFocusIn(event) {
|
|
751
437
|
if (focusScope.paused || !container1) return;
|
|
@@ -773,7 +459,7 @@ const $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ React$2.forwardR
|
|
|
773
459
|
container1,
|
|
774
460
|
focusScope.paused
|
|
775
461
|
]);
|
|
776
|
-
React$
|
|
462
|
+
React$1.useEffect(()=>{
|
|
777
463
|
if (container1) {
|
|
778
464
|
$d3863c46a17e8a28$var$focusScopesStack.add(focusScope);
|
|
779
465
|
const previouslyFocusedElement = document.activeElement;
|
|
@@ -812,7 +498,7 @@ const $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ React$2.forwardR
|
|
|
812
498
|
onUnmountAutoFocus,
|
|
813
499
|
focusScope
|
|
814
500
|
]); // Takes care of looping focus (when tabbing whilst at the edges)
|
|
815
|
-
const handleKeyDown = React$
|
|
501
|
+
const handleKeyDown = React$1.useCallback((event)=>{
|
|
816
502
|
if (!loop && !trapped) return;
|
|
817
503
|
if (focusScope.paused) return;
|
|
818
504
|
const isTabKey = event.key === 'Tab' && !event.altKey && !event.ctrlKey && !event.metaKey;
|
|
@@ -842,7 +528,7 @@ const $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ React$2.forwardR
|
|
|
842
528
|
trapped,
|
|
843
529
|
focusScope.paused
|
|
844
530
|
]);
|
|
845
|
-
return /*#__PURE__*/ React$
|
|
531
|
+
return /*#__PURE__*/ React$1.createElement(BtIconTickAlt2Px.$8927f6f2acc4f386$export$250ffa63cdc0d034.div, BtIconTickAlt2Px._extends({
|
|
846
532
|
tabIndex: -1
|
|
847
533
|
}, scopeProps, {
|
|
848
534
|
ref: composedRefs,
|
|
@@ -966,20 +652,12 @@ function $d3863c46a17e8a28$var$removeLinks(items) {
|
|
|
966
652
|
);
|
|
967
653
|
}
|
|
968
654
|
|
|
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
655
|
const $1746a345f3d73bb7$var$useReactId = React__namespace['useId'.toString()] || (()=>undefined
|
|
978
656
|
);
|
|
979
657
|
let $1746a345f3d73bb7$var$count = 0;
|
|
980
658
|
function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {
|
|
981
659
|
const [id, setId] = React__namespace.useState($1746a345f3d73bb7$var$useReactId()); // React versions older than 18 will have client-side ids only.
|
|
982
|
-
|
|
660
|
+
BtIconTickAlt2Px.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
983
661
|
if (!deterministicId) setId((reactId)=>reactId !== null && reactId !== void 0 ? reactId : String($1746a345f3d73bb7$var$count++)
|
|
984
662
|
);
|
|
985
663
|
}, [
|
|
@@ -988,77 +666,16 @@ function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {
|
|
|
988
666
|
return deterministicId || (id ? `radix-${id}` : '');
|
|
989
667
|
}
|
|
990
668
|
|
|
991
|
-
const $f1701beae083dbae$export$602eac185826482c = /*#__PURE__*/ React$
|
|
669
|
+
const $f1701beae083dbae$export$602eac185826482c = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
992
670
|
var _globalThis$document;
|
|
993
671
|
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$
|
|
672
|
+
return container ? /*#__PURE__*/ $7SXl2$reactdom__default["default"].createPortal(/*#__PURE__*/ React$1.createElement(BtIconTickAlt2Px.$8927f6f2acc4f386$export$250ffa63cdc0d034.div, BtIconTickAlt2Px._extends({}, portalProps, {
|
|
995
673
|
ref: forwardedRef
|
|
996
674
|
})), container) : null;
|
|
997
675
|
});
|
|
998
676
|
|
|
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, {
|
|
677
|
+
const $ea1ef594cf570d83$export$439d29a4e110a164 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
678
|
+
return /*#__PURE__*/ React$1.createElement(BtIconTickAlt2Px.$8927f6f2acc4f386$export$250ffa63cdc0d034.span, BtIconTickAlt2Px._extends({}, props, {
|
|
1062
679
|
ref: forwardedRef,
|
|
1063
680
|
style: {
|
|
1064
681
|
// See: https://github.com/twbs/bootstrap/blob/master/scss/mixins/_screen-reader.scss
|
|
@@ -1300,7 +917,7 @@ function assignRef(ref, value) {
|
|
|
1300
917
|
* @returns {MutableRefObject}
|
|
1301
918
|
*/
|
|
1302
919
|
function useCallbackRef(initialValue, callback) {
|
|
1303
|
-
var ref = React$
|
|
920
|
+
var ref = React$1.useState(function () { return ({
|
|
1304
921
|
// value
|
|
1305
922
|
value: initialValue,
|
|
1306
923
|
// last callback
|
|
@@ -1934,37 +1551,37 @@ const $cc7e05a45900e73f$var$SELECTION_KEYS = [
|
|
|
1934
1551
|
* Select
|
|
1935
1552
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$SELECT_NAME = 'Select';
|
|
1936
1553
|
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] =
|
|
1554
|
+
const [$cc7e05a45900e73f$var$createSelectContext, $cc7e05a45900e73f$export$286727a75dc039bd] = BtIconTickAlt2Px.$c512c27ab02ef895$export$50c7b4e9d9f19c1($cc7e05a45900e73f$var$SELECT_NAME, [
|
|
1938
1555
|
$cc7e05a45900e73f$var$createCollectionScope
|
|
1939
1556
|
]);
|
|
1940
1557
|
const [$cc7e05a45900e73f$var$SelectProvider, $cc7e05a45900e73f$var$useSelectContext] = $cc7e05a45900e73f$var$createSelectContext($cc7e05a45900e73f$var$SELECT_NAME);
|
|
1941
1558
|
const [$cc7e05a45900e73f$var$SelectNativeOptionsProvider, $cc7e05a45900e73f$var$useSelectNativeOptionsContext] = $cc7e05a45900e73f$var$createSelectContext($cc7e05a45900e73f$var$SELECT_NAME);
|
|
1942
1559
|
const $cc7e05a45900e73f$export$ef9b1a59e592288f = (props)=>{
|
|
1943
1560
|
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$
|
|
1561
|
+
const [trigger, setTrigger] = React$1.useState(null);
|
|
1562
|
+
const [valueNode, setValueNode] = React$1.useState(null);
|
|
1563
|
+
const [valueNodeHasChildren, setValueNodeHasChildren] = React$1.useState(false);
|
|
1947
1564
|
const direction = $f631663db3294ace$export$b39126d51d94e6f3(dir);
|
|
1948
|
-
const [open = false, setOpen] =
|
|
1565
|
+
const [open = false, setOpen] = BtIconTickAlt2Px.$71cd76cc60e0454e$export$6f32135080cb4c3({
|
|
1949
1566
|
prop: openProp,
|
|
1950
1567
|
defaultProp: defaultOpen,
|
|
1951
1568
|
onChange: onOpenChange
|
|
1952
1569
|
});
|
|
1953
|
-
const [value, setValue] =
|
|
1570
|
+
const [value, setValue] = BtIconTickAlt2Px.$71cd76cc60e0454e$export$6f32135080cb4c3({
|
|
1954
1571
|
prop: valueProp,
|
|
1955
1572
|
defaultProp: defaultValue,
|
|
1956
1573
|
onChange: onValueChange
|
|
1957
1574
|
});
|
|
1958
|
-
const triggerPointerDownPosRef = React$
|
|
1575
|
+
const triggerPointerDownPosRef = React$1.useRef(null); // We set this to true by default so that events bubble to forms without JS (SSR)
|
|
1959
1576
|
const isFormControl = trigger ? Boolean(trigger.closest('form')) : true;
|
|
1960
|
-
const [nativeOptionsSet, setNativeOptionsSet] = React$
|
|
1577
|
+
const [nativeOptionsSet, setNativeOptionsSet] = React$1.useState(new Set()); // The native `select` only associates the correct default value if the corresponding
|
|
1961
1578
|
// `option` is rendered as a child **at the same time** as itself.
|
|
1962
1579
|
// Because it might take a few renders for our items to gather the information to build
|
|
1963
1580
|
// the native `option`(s), we generate a key on the `select` to make sure React re-builds it
|
|
1964
1581
|
// each time the options change.
|
|
1965
1582
|
const nativeSelectKey = Array.from(nativeOptionsSet).map((option)=>option.props.value
|
|
1966
1583
|
).join(';');
|
|
1967
|
-
return /*#__PURE__*/ React$
|
|
1584
|
+
return /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$SelectProvider, {
|
|
1968
1585
|
required: required,
|
|
1969
1586
|
scope: __scopeSelect,
|
|
1970
1587
|
trigger: trigger,
|
|
@@ -1981,22 +1598,22 @@ const $cc7e05a45900e73f$export$ef9b1a59e592288f = (props)=>{
|
|
|
1981
1598
|
dir: direction,
|
|
1982
1599
|
triggerPointerDownPosRef: triggerPointerDownPosRef,
|
|
1983
1600
|
disabled: disabled
|
|
1984
|
-
}, /*#__PURE__*/ React$
|
|
1601
|
+
}, /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$Collection.Provider, {
|
|
1985
1602
|
scope: __scopeSelect
|
|
1986
|
-
}, /*#__PURE__*/ React$
|
|
1603
|
+
}, /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$SelectNativeOptionsProvider, {
|
|
1987
1604
|
scope: props.__scopeSelect,
|
|
1988
|
-
onNativeOptionAdd: React$
|
|
1605
|
+
onNativeOptionAdd: React$1.useCallback((option)=>{
|
|
1989
1606
|
setNativeOptionsSet((prev)=>new Set(prev).add(option)
|
|
1990
1607
|
);
|
|
1991
1608
|
}, []),
|
|
1992
|
-
onNativeOptionRemove: React$
|
|
1609
|
+
onNativeOptionRemove: React$1.useCallback((option)=>{
|
|
1993
1610
|
setNativeOptionsSet((prev)=>{
|
|
1994
1611
|
const optionsSet = new Set(prev);
|
|
1995
1612
|
optionsSet.delete(option);
|
|
1996
1613
|
return optionsSet;
|
|
1997
1614
|
});
|
|
1998
1615
|
}, [])
|
|
1999
|
-
}, children)), isFormControl ? /*#__PURE__*/ React$
|
|
1616
|
+
}, children)), isFormControl ? /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$BubbleSelect, {
|
|
2000
1617
|
key: nativeSelectKey,
|
|
2001
1618
|
"aria-hidden": true,
|
|
2002
1619
|
required: required,
|
|
@@ -2008,18 +1625,18 @@ const $cc7e05a45900e73f$export$ef9b1a59e592288f = (props)=>{
|
|
|
2008
1625
|
onChange: (event)=>setValue(event.target.value)
|
|
2009
1626
|
,
|
|
2010
1627
|
disabled: disabled
|
|
2011
|
-
}, value === undefined ? /*#__PURE__*/ React$
|
|
1628
|
+
}, value === undefined ? /*#__PURE__*/ React$1.createElement("option", {
|
|
2012
1629
|
value: ""
|
|
2013
1630
|
}) : null, Array.from(nativeOptionsSet)) : null);
|
|
2014
1631
|
};
|
|
2015
1632
|
/* -------------------------------------------------------------------------------------------------
|
|
2016
1633
|
* SelectTrigger
|
|
2017
1634
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$TRIGGER_NAME = 'SelectTrigger';
|
|
2018
|
-
const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ React$
|
|
1635
|
+
const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
2019
1636
|
const { __scopeSelect: __scopeSelect , disabled: disabled = false , ...triggerProps } = props;
|
|
2020
1637
|
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$TRIGGER_NAME, __scopeSelect);
|
|
2021
1638
|
const isDisabled = context.disabled || disabled;
|
|
2022
|
-
const composedRefs =
|
|
1639
|
+
const composedRefs = BtIconTickAlt2Px.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.onTriggerChange);
|
|
2023
1640
|
const getItems = $cc7e05a45900e73f$var$useCollection(__scopeSelect);
|
|
2024
1641
|
const [searchRef, handleTypeaheadSearch, resetTypeahead] = $cc7e05a45900e73f$var$useTypeaheadSearch((search)=>{
|
|
2025
1642
|
const enabledItems = getItems().filter((item)=>!item.disabled
|
|
@@ -2035,7 +1652,7 @@ const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ React$2.forwardRe
|
|
|
2035
1652
|
resetTypeahead();
|
|
2036
1653
|
}
|
|
2037
1654
|
};
|
|
2038
|
-
return /*#__PURE__*/ React$
|
|
1655
|
+
return /*#__PURE__*/ React$1.createElement(BtIconTickAlt2Px.$8927f6f2acc4f386$export$250ffa63cdc0d034.button, BtIconTickAlt2Px._extends({
|
|
2039
1656
|
type: "button",
|
|
2040
1657
|
role: "combobox",
|
|
2041
1658
|
"aria-controls": context.contentId,
|
|
@@ -2050,7 +1667,7 @@ const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ React$2.forwardRe
|
|
|
2050
1667
|
}, triggerProps, {
|
|
2051
1668
|
ref: composedRefs // Enable compatibility with native label or custom `Label` "click" for Safari:
|
|
2052
1669
|
,
|
|
2053
|
-
onClick:
|
|
1670
|
+
onClick: BtIconTickAlt2Px.$e42e1063c40fb3ef$export$b9ecd428b558ff10(triggerProps.onClick, (event)=>{
|
|
2054
1671
|
// Whilst browsers generally have no issue focusing the trigger when clicking
|
|
2055
1672
|
// on a label, Safari seems to struggle with the fact that there's no `onClick`.
|
|
2056
1673
|
// We force `focus` in this case. Note: this doesn't create any other side-effect
|
|
@@ -2058,7 +1675,7 @@ const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ React$2.forwardRe
|
|
|
2058
1675
|
// this only runs for a label "click"
|
|
2059
1676
|
event.currentTarget.focus();
|
|
2060
1677
|
}),
|
|
2061
|
-
onPointerDown:
|
|
1678
|
+
onPointerDown: BtIconTickAlt2Px.$e42e1063c40fb3ef$export$b9ecd428b558ff10(triggerProps.onPointerDown, (event)=>{
|
|
2062
1679
|
// prevent implicit pointer capture
|
|
2063
1680
|
// https://www.w3.org/TR/pointerevents3/#implicit-pointer-capture
|
|
2064
1681
|
const target = event.target;
|
|
@@ -2074,7 +1691,7 @@ const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ React$2.forwardRe
|
|
|
2074
1691
|
event.preventDefault();
|
|
2075
1692
|
}
|
|
2076
1693
|
}),
|
|
2077
|
-
onKeyDown:
|
|
1694
|
+
onKeyDown: BtIconTickAlt2Px.$e42e1063c40fb3ef$export$b9ecd428b558ff10(triggerProps.onKeyDown, (event)=>{
|
|
2078
1695
|
const isTypingAhead = searchRef.current !== '';
|
|
2079
1696
|
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey;
|
|
2080
1697
|
if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key);
|
|
@@ -2089,20 +1706,20 @@ const $cc7e05a45900e73f$export$3ac1e88a1c0b9f1 = /*#__PURE__*/ React$2.forwardRe
|
|
|
2089
1706
|
/* -------------------------------------------------------------------------------------------------
|
|
2090
1707
|
* SelectValue
|
|
2091
1708
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$VALUE_NAME = 'SelectValue';
|
|
2092
|
-
const $cc7e05a45900e73f$export$e288731fd71264f0 = /*#__PURE__*/ React$
|
|
1709
|
+
const $cc7e05a45900e73f$export$e288731fd71264f0 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
2093
1710
|
// We ignore `className` and `style` as this part shouldn't be styled.
|
|
2094
1711
|
const { __scopeSelect: __scopeSelect , className: className , style: style , children: children , placeholder: placeholder , ...valueProps } = props;
|
|
2095
1712
|
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$VALUE_NAME, __scopeSelect);
|
|
2096
1713
|
const { onValueNodeHasChildrenChange: onValueNodeHasChildrenChange } = context;
|
|
2097
1714
|
const hasChildren = children !== undefined;
|
|
2098
|
-
const composedRefs =
|
|
2099
|
-
|
|
1715
|
+
const composedRefs = BtIconTickAlt2Px.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.onValueNodeChange);
|
|
1716
|
+
BtIconTickAlt2Px.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
2100
1717
|
onValueNodeHasChildrenChange(hasChildren);
|
|
2101
1718
|
}, [
|
|
2102
1719
|
onValueNodeHasChildrenChange,
|
|
2103
1720
|
hasChildren
|
|
2104
1721
|
]);
|
|
2105
|
-
return /*#__PURE__*/ React$
|
|
1722
|
+
return /*#__PURE__*/ React$1.createElement(BtIconTickAlt2Px.$8927f6f2acc4f386$export$250ffa63cdc0d034.span, BtIconTickAlt2Px._extends({}, valueProps, {
|
|
2106
1723
|
ref: composedRefs // we don't want events from the portalled `SelectValue` children to bubble
|
|
2107
1724
|
,
|
|
2108
1725
|
style: {
|
|
@@ -2110,67 +1727,67 @@ const $cc7e05a45900e73f$export$e288731fd71264f0 = /*#__PURE__*/ React$2.forwardR
|
|
|
2110
1727
|
}
|
|
2111
1728
|
}), context.value === undefined && placeholder !== undefined ? placeholder : children);
|
|
2112
1729
|
});
|
|
2113
|
-
const $cc7e05a45900e73f$export$99b400cabb58c515 = /*#__PURE__*/ React$
|
|
1730
|
+
const $cc7e05a45900e73f$export$99b400cabb58c515 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
2114
1731
|
const { __scopeSelect: __scopeSelect , children: children , ...iconProps } = props;
|
|
2115
|
-
return /*#__PURE__*/ React$
|
|
1732
|
+
return /*#__PURE__*/ React$1.createElement(BtIconTickAlt2Px.$8927f6f2acc4f386$export$250ffa63cdc0d034.span, BtIconTickAlt2Px._extends({
|
|
2116
1733
|
"aria-hidden": true
|
|
2117
1734
|
}, iconProps, {
|
|
2118
1735
|
ref: forwardedRef
|
|
2119
1736
|
}), children || '▼');
|
|
2120
1737
|
});
|
|
2121
1738
|
const $cc7e05a45900e73f$export$b2af6c9944296213 = (props)=>{
|
|
2122
|
-
return /*#__PURE__*/ React$
|
|
1739
|
+
return /*#__PURE__*/ React$1.createElement($f1701beae083dbae$export$602eac185826482c, BtIconTickAlt2Px._extends({
|
|
2123
1740
|
asChild: true
|
|
2124
1741
|
}, props));
|
|
2125
1742
|
};
|
|
2126
1743
|
/* -------------------------------------------------------------------------------------------------
|
|
2127
1744
|
* SelectContent
|
|
2128
1745
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$CONTENT_NAME = 'SelectContent';
|
|
2129
|
-
const $cc7e05a45900e73f$export$c973a4b3cb86a03d = /*#__PURE__*/ React$
|
|
1746
|
+
const $cc7e05a45900e73f$export$c973a4b3cb86a03d = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
2130
1747
|
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$CONTENT_NAME, props.__scopeSelect);
|
|
2131
|
-
const [fragment, setFragment] = React$
|
|
2132
|
-
|
|
1748
|
+
const [fragment, setFragment] = React$1.useState(); // setting the fragment in `useLayoutEffect` as `DocumentFragment` doesn't exist on the server
|
|
1749
|
+
BtIconTickAlt2Px.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
2133
1750
|
setFragment(new DocumentFragment());
|
|
2134
1751
|
}, []);
|
|
2135
|
-
return /*#__PURE__*/ React$
|
|
1752
|
+
return /*#__PURE__*/ React$1.createElement(React$1.Fragment, null, context.open ? /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$SelectContentImpl, BtIconTickAlt2Px._extends({}, props, {
|
|
2136
1753
|
ref: forwardedRef
|
|
2137
|
-
})) : fragment ? /*#__PURE__*/ $7SXl2$reactdom.createPortal(/*#__PURE__*/ React$
|
|
1754
|
+
})) : fragment ? /*#__PURE__*/ $7SXl2$reactdom.createPortal(/*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$SelectContentProvider, {
|
|
2138
1755
|
scope: props.__scopeSelect
|
|
2139
|
-
}, /*#__PURE__*/ React$
|
|
1756
|
+
}, /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$Collection.Slot, {
|
|
2140
1757
|
scope: props.__scopeSelect
|
|
2141
|
-
}, /*#__PURE__*/ React$
|
|
1758
|
+
}, /*#__PURE__*/ React$1.createElement("div", null, props.children))), fragment) : null);
|
|
2142
1759
|
});
|
|
2143
1760
|
const $cc7e05a45900e73f$var$CONTENT_MARGIN = 10;
|
|
2144
1761
|
const [$cc7e05a45900e73f$var$SelectContentProvider, $cc7e05a45900e73f$var$useSelectContentContext] = $cc7e05a45900e73f$var$createSelectContext($cc7e05a45900e73f$var$CONTENT_NAME);
|
|
2145
|
-
const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$
|
|
1762
|
+
const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
2146
1763
|
const { __scopeSelect: __scopeSelect , onCloseAutoFocus: onCloseAutoFocus , ...contentProps } = props;
|
|
2147
1764
|
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 =
|
|
1765
|
+
const [contentWrapper, setContentWrapper] = React$1.useState(null);
|
|
1766
|
+
const [content, setContent] = React$1.useState(null);
|
|
1767
|
+
const [viewport, setViewport] = React$1.useState(null);
|
|
1768
|
+
const composedRefs = BtIconTickAlt2Px.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setContent(node)
|
|
2152
1769
|
);
|
|
2153
|
-
const [selectedItem, setSelectedItem] = React$
|
|
2154
|
-
const [selectedItemText, setSelectedItemText] = React$
|
|
1770
|
+
const [selectedItem, setSelectedItem] = React$1.useState(null);
|
|
1771
|
+
const [selectedItemText, setSelectedItemText] = React$1.useState(null);
|
|
2155
1772
|
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$
|
|
1773
|
+
const [isPositioned, setIsPositioned] = React$1.useState(false);
|
|
1774
|
+
const shouldRepositionRef = React$1.useRef(true);
|
|
1775
|
+
const shouldExpandOnScrollRef = React$1.useRef(false);
|
|
1776
|
+
const firstValidItemFoundRef = React$1.useRef(false); // aria-hide everything except the content (better supported equivalent to setting aria-modal)
|
|
1777
|
+
React$1.useEffect(()=>{
|
|
2161
1778
|
if (content) return hideOthers(content);
|
|
2162
1779
|
}, [
|
|
2163
1780
|
content
|
|
2164
1781
|
]); // Make sure the whole tree has focus guards as our `Select` may be
|
|
2165
1782
|
// the last element in the DOM (because of the `Portal`)
|
|
2166
1783
|
$3db38b7d1fb3fe6a$export$b7ece24a22aeda8c();
|
|
2167
|
-
const [contentZIndex, setContentZIndex] = React$
|
|
2168
|
-
|
|
1784
|
+
const [contentZIndex, setContentZIndex] = React$1.useState();
|
|
1785
|
+
BtIconTickAlt2Px.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
2169
1786
|
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
2170
1787
|
}, [
|
|
2171
1788
|
content
|
|
2172
1789
|
]);
|
|
2173
|
-
const focusFirst = React$
|
|
1790
|
+
const focusFirst = React$1.useCallback((candidates)=>{
|
|
2174
1791
|
const [firstItem, ...restItems] = getItems().map((item)=>item.ref.current
|
|
2175
1792
|
);
|
|
2176
1793
|
const [lastItem] = restItems.slice(-1);
|
|
@@ -2190,7 +1807,7 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$2.forwardRef
|
|
|
2190
1807
|
getItems,
|
|
2191
1808
|
viewport
|
|
2192
1809
|
]);
|
|
2193
|
-
const position = React$
|
|
1810
|
+
const position = React$1.useCallback(()=>{
|
|
2194
1811
|
if (context.trigger && context.valueNode && contentWrapper && content && viewport && selectedItem && selectedItemText) {
|
|
2195
1812
|
const triggerRect = context.trigger.getBoundingClientRect(); // -----------------------------------------------------------------------------------------
|
|
2196
1813
|
// Horizontal positioning
|
|
@@ -2281,11 +1898,11 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$2.forwardRef
|
|
|
2281
1898
|
selectedItemText,
|
|
2282
1899
|
context.dir
|
|
2283
1900
|
]);
|
|
2284
|
-
|
|
1901
|
+
BtIconTickAlt2Px.$9f79659886946c16$export$e5c5a5f917a5871c(()=>position()
|
|
2285
1902
|
, [
|
|
2286
1903
|
position
|
|
2287
1904
|
]);
|
|
2288
|
-
const focusSelectedItem = React$
|
|
1905
|
+
const focusSelectedItem = React$1.useCallback(()=>focusFirst([
|
|
2289
1906
|
selectedItem,
|
|
2290
1907
|
content
|
|
2291
1908
|
])
|
|
@@ -2295,7 +1912,7 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$2.forwardRef
|
|
|
2295
1912
|
content
|
|
2296
1913
|
]); // Since this is not dependent on layout, we want to ensure this runs at the same time as
|
|
2297
1914
|
// other effects across components. Hence why we don't call `focusSelectedItem` inside `position`.
|
|
2298
|
-
React$
|
|
1915
|
+
React$1.useEffect(()=>{
|
|
2299
1916
|
if (isPositioned) focusSelectedItem();
|
|
2300
1917
|
}, [
|
|
2301
1918
|
isPositioned,
|
|
@@ -2304,7 +1921,7 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$2.forwardRef
|
|
|
2304
1921
|
// Because it is part of the normal flow, it will push down the viewport, thus throwing our
|
|
2305
1922
|
// trigger => selectedItem alignment off by the amount the viewport was pushed down.
|
|
2306
1923
|
// We wait for this to happen and then re-run the positining logic one more time to account for it.
|
|
2307
|
-
const handleScrollButtonChange = React$
|
|
1924
|
+
const handleScrollButtonChange = React$1.useCallback((node)=>{
|
|
2308
1925
|
if (node && shouldRepositionRef.current === true) {
|
|
2309
1926
|
position();
|
|
2310
1927
|
focusSelectedItem();
|
|
@@ -2316,7 +1933,7 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$2.forwardRef
|
|
|
2316
1933
|
]); // prevent selecting items on `pointerup` in some cases after opening from `pointerdown`
|
|
2317
1934
|
// and close on `pointerup` outside.
|
|
2318
1935
|
const { onOpenChange: onOpenChange , triggerPointerDownPosRef: triggerPointerDownPosRef } = context;
|
|
2319
|
-
React$
|
|
1936
|
+
React$1.useEffect(()=>{
|
|
2320
1937
|
if (content) {
|
|
2321
1938
|
let pointerMoveDelta = {
|
|
2322
1939
|
x: 0,
|
|
@@ -2356,7 +1973,7 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$2.forwardRef
|
|
|
2356
1973
|
onOpenChange,
|
|
2357
1974
|
triggerPointerDownPosRef
|
|
2358
1975
|
]);
|
|
2359
|
-
React$
|
|
1976
|
+
React$1.useEffect(()=>{
|
|
2360
1977
|
const close = ()=>onOpenChange(false)
|
|
2361
1978
|
;
|
|
2362
1979
|
window.addEventListener('blur', close);
|
|
@@ -2380,7 +1997,7 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$2.forwardRef
|
|
|
2380
1997
|
*/ setTimeout(()=>nextItem.ref.current.focus()
|
|
2381
1998
|
);
|
|
2382
1999
|
});
|
|
2383
|
-
const itemRefCallback = React$
|
|
2000
|
+
const itemRefCallback = React$1.useCallback((node, value, disabled)=>{
|
|
2384
2001
|
const isFirstValidItem = !firstValidItemFoundRef.current && !disabled;
|
|
2385
2002
|
const isSelectedItem = context.value !== undefined && context.value === value;
|
|
2386
2003
|
if (isSelectedItem || isFirstValidItem) {
|
|
@@ -2390,18 +2007,18 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$2.forwardRef
|
|
|
2390
2007
|
}, [
|
|
2391
2008
|
context.value
|
|
2392
2009
|
]);
|
|
2393
|
-
const handleItemLeave = React$
|
|
2010
|
+
const handleItemLeave = React$1.useCallback(()=>content === null || content === void 0 ? void 0 : content.focus()
|
|
2394
2011
|
, [
|
|
2395
2012
|
content
|
|
2396
2013
|
]);
|
|
2397
|
-
const itemTextRefCallback = React$
|
|
2014
|
+
const itemTextRefCallback = React$1.useCallback((node, value, disabled)=>{
|
|
2398
2015
|
const isFirstValidItem = !firstValidItemFoundRef.current && !disabled;
|
|
2399
2016
|
const isSelectedItem = context.value !== undefined && context.value === value;
|
|
2400
2017
|
if (isSelectedItem || isFirstValidItem) setSelectedItemText(node);
|
|
2401
2018
|
}, [
|
|
2402
2019
|
context.value
|
|
2403
2020
|
]);
|
|
2404
|
-
return /*#__PURE__*/ React$
|
|
2021
|
+
return /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$SelectContentProvider, {
|
|
2405
2022
|
scope: __scopeSelect,
|
|
2406
2023
|
contentWrapper: contentWrapper,
|
|
2407
2024
|
content: content,
|
|
@@ -2416,10 +2033,10 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$2.forwardRef
|
|
|
2416
2033
|
isPositioned: isPositioned,
|
|
2417
2034
|
shouldExpandOnScrollRef: shouldExpandOnScrollRef,
|
|
2418
2035
|
searchRef: searchRef
|
|
2419
|
-
}, /*#__PURE__*/ React$
|
|
2420
|
-
as:
|
|
2036
|
+
}, /*#__PURE__*/ React$1.createElement($01b9c$RemoveScroll, {
|
|
2037
|
+
as: BtIconTickAlt2Px.$5e63c961fc1ce211$export$8c6ed5c666ac1360,
|
|
2421
2038
|
allowPinchZoom: true
|
|
2422
|
-
}, /*#__PURE__*/ React$
|
|
2039
|
+
}, /*#__PURE__*/ React$1.createElement("div", {
|
|
2423
2040
|
ref: setContentWrapper,
|
|
2424
2041
|
style: {
|
|
2425
2042
|
display: 'flex',
|
|
@@ -2427,7 +2044,7 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$2.forwardRef
|
|
|
2427
2044
|
position: 'fixed',
|
|
2428
2045
|
zIndex: contentZIndex
|
|
2429
2046
|
}
|
|
2430
|
-
}, /*#__PURE__*/ React$
|
|
2047
|
+
}, /*#__PURE__*/ React$1.createElement($d3863c46a17e8a28$export$20e40289641fbbb6, {
|
|
2431
2048
|
asChild: true // we make sure we're not trapping once it's been closed
|
|
2432
2049
|
,
|
|
2433
2050
|
trapped: context.open,
|
|
@@ -2435,14 +2052,14 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$2.forwardRef
|
|
|
2435
2052
|
// we prevent open autofocus because we manually focus the selected item
|
|
2436
2053
|
event.preventDefault();
|
|
2437
2054
|
},
|
|
2438
|
-
onUnmountAutoFocus:
|
|
2055
|
+
onUnmountAutoFocus: BtIconTickAlt2Px.$e42e1063c40fb3ef$export$b9ecd428b558ff10(onCloseAutoFocus, (event)=>{
|
|
2439
2056
|
var _context$trigger;
|
|
2440
2057
|
(_context$trigger = context.trigger) === null || _context$trigger === void 0 || _context$trigger.focus({
|
|
2441
2058
|
preventScroll: true
|
|
2442
2059
|
});
|
|
2443
2060
|
event.preventDefault();
|
|
2444
2061
|
})
|
|
2445
|
-
}, /*#__PURE__*/ React$
|
|
2062
|
+
}, /*#__PURE__*/ React$1.createElement($5cb92bef7577960e$export$177fb62ff3ec1f22, BtIconTickAlt2Px._extends({
|
|
2446
2063
|
role: "listbox",
|
|
2447
2064
|
id: context.contentId,
|
|
2448
2065
|
"data-state": context.open ? 'open' : 'closed',
|
|
@@ -2466,7 +2083,7 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$2.forwardRef
|
|
|
2466
2083
|
,
|
|
2467
2084
|
onDismiss: ()=>context.onOpenChange(false)
|
|
2468
2085
|
,
|
|
2469
|
-
onKeyDown:
|
|
2086
|
+
onKeyDown: BtIconTickAlt2Px.$e42e1063c40fb3ef$export$b9ecd428b558ff10(contentProps.onKeyDown, (event)=>{
|
|
2470
2087
|
const isModifierKey = event.ctrlKey || event.altKey || event.metaKey; // select should not be navigated using tab key so we prevent it
|
|
2471
2088
|
if (event.key === 'Tab') event.preventDefault();
|
|
2472
2089
|
if (!isModifierKey && event.key.length === 1) handleTypeaheadSearch(event.key);
|
|
@@ -2505,18 +2122,18 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ React$2.forwardRef
|
|
|
2505
2122
|
/* -------------------------------------------------------------------------------------------------
|
|
2506
2123
|
* SelectViewport
|
|
2507
2124
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$VIEWPORT_NAME = 'SelectViewport';
|
|
2508
|
-
const $cc7e05a45900e73f$export$9ed6e7b40248d36d = /*#__PURE__*/ React$
|
|
2125
|
+
const $cc7e05a45900e73f$export$9ed6e7b40248d36d = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
2509
2126
|
const { __scopeSelect: __scopeSelect , ...viewportProps } = props;
|
|
2510
2127
|
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$VIEWPORT_NAME, __scopeSelect);
|
|
2511
|
-
const composedRefs =
|
|
2512
|
-
const prevScrollTopRef = React$
|
|
2513
|
-
return /*#__PURE__*/ React$
|
|
2128
|
+
const composedRefs = BtIconTickAlt2Px.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, contentContext.onViewportChange);
|
|
2129
|
+
const prevScrollTopRef = React$1.useRef(0);
|
|
2130
|
+
return /*#__PURE__*/ React$1.createElement(React$1.Fragment, null, /*#__PURE__*/ React$1.createElement("style", {
|
|
2514
2131
|
dangerouslySetInnerHTML: {
|
|
2515
2132
|
__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
2133
|
}
|
|
2517
|
-
}), /*#__PURE__*/ React$
|
|
2134
|
+
}), /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$Collection.Slot, {
|
|
2518
2135
|
scope: __scopeSelect
|
|
2519
|
-
}, /*#__PURE__*/ React$
|
|
2136
|
+
}, /*#__PURE__*/ React$1.createElement(BtIconTickAlt2Px.$8927f6f2acc4f386$export$250ffa63cdc0d034.div, BtIconTickAlt2Px._extends({
|
|
2520
2137
|
"data-radix-select-viewport": "",
|
|
2521
2138
|
role: "presentation"
|
|
2522
2139
|
}, viewportProps, {
|
|
@@ -2530,7 +2147,7 @@ const $cc7e05a45900e73f$export$9ed6e7b40248d36d = /*#__PURE__*/ React$2.forwardR
|
|
|
2530
2147
|
overflow: 'auto',
|
|
2531
2148
|
...viewportProps.style
|
|
2532
2149
|
},
|
|
2533
|
-
onScroll:
|
|
2150
|
+
onScroll: BtIconTickAlt2Px.$e42e1063c40fb3ef$export$b9ecd428b558ff10(viewportProps.onScroll, (event)=>{
|
|
2534
2151
|
const viewport = event.currentTarget;
|
|
2535
2152
|
const { contentWrapper: contentWrapper , shouldExpandOnScrollRef: shouldExpandOnScrollRef } = contentContext;
|
|
2536
2153
|
if (shouldExpandOnScrollRef !== null && shouldExpandOnScrollRef !== void 0 && shouldExpandOnScrollRef.current && contentWrapper) {
|
|
@@ -2564,14 +2181,14 @@ $cc7e05a45900e73f$var$createSelectContext($cc7e05a45900e73f$var$GROUP_NAME);
|
|
|
2564
2181
|
* SelectItem
|
|
2565
2182
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$ITEM_NAME = 'SelectItem';
|
|
2566
2183
|
const [$cc7e05a45900e73f$var$SelectItemContextProvider, $cc7e05a45900e73f$var$useSelectItemContext] = $cc7e05a45900e73f$var$createSelectContext($cc7e05a45900e73f$var$ITEM_NAME);
|
|
2567
|
-
const $cc7e05a45900e73f$export$13ef48a934230896 = /*#__PURE__*/ React$
|
|
2184
|
+
const $cc7e05a45900e73f$export$13ef48a934230896 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
2568
2185
|
const { __scopeSelect: __scopeSelect , value: value , disabled: disabled = false , textValue: textValueProp , ...itemProps } = props;
|
|
2569
2186
|
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$ITEM_NAME, __scopeSelect);
|
|
2570
2187
|
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$ITEM_NAME, __scopeSelect);
|
|
2571
2188
|
const isSelected = context.value === value;
|
|
2572
|
-
const [textValue, setTextValue] = React$
|
|
2573
|
-
const [isFocused, setIsFocused] = React$
|
|
2574
|
-
const composedRefs =
|
|
2189
|
+
const [textValue, setTextValue] = React$1.useState(textValueProp !== null && textValueProp !== void 0 ? textValueProp : '');
|
|
2190
|
+
const [isFocused, setIsFocused] = React$1.useState(false);
|
|
2191
|
+
const composedRefs = BtIconTickAlt2Px.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>{
|
|
2575
2192
|
var _contentContext$itemR;
|
|
2576
2193
|
return (_contentContext$itemR = contentContext.itemRefCallback) === null || _contentContext$itemR === void 0 ? void 0 : _contentContext$itemR.call(contentContext, node, value, disabled);
|
|
2577
2194
|
});
|
|
@@ -2582,24 +2199,24 @@ const $cc7e05a45900e73f$export$13ef48a934230896 = /*#__PURE__*/ React$2.forwardR
|
|
|
2582
2199
|
context.onOpenChange(false);
|
|
2583
2200
|
}
|
|
2584
2201
|
};
|
|
2585
|
-
return /*#__PURE__*/ React$
|
|
2202
|
+
return /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$SelectItemContextProvider, {
|
|
2586
2203
|
scope: __scopeSelect,
|
|
2587
2204
|
value: value,
|
|
2588
2205
|
disabled: disabled,
|
|
2589
2206
|
textId: textId,
|
|
2590
2207
|
isSelected: isSelected,
|
|
2591
|
-
onItemTextChange: React$
|
|
2208
|
+
onItemTextChange: React$1.useCallback((node)=>{
|
|
2592
2209
|
setTextValue((prevTextValue)=>{
|
|
2593
2210
|
var _node$textContent;
|
|
2594
2211
|
return prevTextValue || ((_node$textContent = node === null || node === void 0 ? void 0 : node.textContent) !== null && _node$textContent !== void 0 ? _node$textContent : '').trim();
|
|
2595
2212
|
});
|
|
2596
2213
|
}, [])
|
|
2597
|
-
}, /*#__PURE__*/ React$
|
|
2214
|
+
}, /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$Collection.ItemSlot, {
|
|
2598
2215
|
scope: __scopeSelect,
|
|
2599
2216
|
value: value,
|
|
2600
2217
|
disabled: disabled,
|
|
2601
2218
|
textValue: textValue
|
|
2602
|
-
}, /*#__PURE__*/ React$
|
|
2219
|
+
}, /*#__PURE__*/ React$1.createElement(BtIconTickAlt2Px.$8927f6f2acc4f386$export$250ffa63cdc0d034.div, BtIconTickAlt2Px._extends({
|
|
2603
2220
|
role: "option",
|
|
2604
2221
|
"aria-labelledby": textId,
|
|
2605
2222
|
"data-highlighted": isFocused ? '' : undefined // `isFocused` caveat fixes stuttering in VoiceOver
|
|
@@ -2611,12 +2228,12 @@ const $cc7e05a45900e73f$export$13ef48a934230896 = /*#__PURE__*/ React$2.forwardR
|
|
|
2611
2228
|
tabIndex: disabled ? undefined : -1
|
|
2612
2229
|
}, itemProps, {
|
|
2613
2230
|
ref: composedRefs,
|
|
2614
|
-
onFocus:
|
|
2231
|
+
onFocus: BtIconTickAlt2Px.$e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onFocus, ()=>setIsFocused(true)
|
|
2615
2232
|
),
|
|
2616
|
-
onBlur:
|
|
2233
|
+
onBlur: BtIconTickAlt2Px.$e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onBlur, ()=>setIsFocused(false)
|
|
2617
2234
|
),
|
|
2618
|
-
onPointerUp:
|
|
2619
|
-
onPointerMove:
|
|
2235
|
+
onPointerUp: BtIconTickAlt2Px.$e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onPointerUp, handleSelect),
|
|
2236
|
+
onPointerMove: BtIconTickAlt2Px.$e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onPointerMove, (event)=>{
|
|
2620
2237
|
if (disabled) {
|
|
2621
2238
|
var _contentContext$onIte;
|
|
2622
2239
|
(_contentContext$onIte = contentContext.onItemLeave) === null || _contentContext$onIte === void 0 || _contentContext$onIte.call(contentContext);
|
|
@@ -2626,13 +2243,13 @@ const $cc7e05a45900e73f$export$13ef48a934230896 = /*#__PURE__*/ React$2.forwardR
|
|
|
2626
2243
|
preventScroll: true
|
|
2627
2244
|
});
|
|
2628
2245
|
}),
|
|
2629
|
-
onPointerLeave:
|
|
2246
|
+
onPointerLeave: BtIconTickAlt2Px.$e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onPointerLeave, (event)=>{
|
|
2630
2247
|
if (event.currentTarget === document.activeElement) {
|
|
2631
2248
|
var _contentContext$onIte2;
|
|
2632
2249
|
(_contentContext$onIte2 = contentContext.onItemLeave) === null || _contentContext$onIte2 === void 0 || _contentContext$onIte2.call(contentContext);
|
|
2633
2250
|
}
|
|
2634
2251
|
}),
|
|
2635
|
-
onKeyDown:
|
|
2252
|
+
onKeyDown: BtIconTickAlt2Px.$e42e1063c40fb3ef$export$b9ecd428b558ff10(itemProps.onKeyDown, (event)=>{
|
|
2636
2253
|
var _contentContext$searc;
|
|
2637
2254
|
const isTypingAhead = ((_contentContext$searc = contentContext.searchRef) === null || _contentContext$searc === void 0 ? void 0 : _contentContext$searc.current) !== '';
|
|
2638
2255
|
if (isTypingAhead && event.key === ' ') return;
|
|
@@ -2644,21 +2261,21 @@ const $cc7e05a45900e73f$export$13ef48a934230896 = /*#__PURE__*/ React$2.forwardR
|
|
|
2644
2261
|
/* -------------------------------------------------------------------------------------------------
|
|
2645
2262
|
* SelectItemText
|
|
2646
2263
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$ITEM_TEXT_NAME = 'SelectItemText';
|
|
2647
|
-
const $cc7e05a45900e73f$export$3572fb0fb821ff49 = /*#__PURE__*/ React$
|
|
2264
|
+
const $cc7e05a45900e73f$export$3572fb0fb821ff49 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
2648
2265
|
// We ignore `className` and `style` as this part shouldn't be styled.
|
|
2649
2266
|
const { __scopeSelect: __scopeSelect , className: className , style: style , ...itemTextProps } = props;
|
|
2650
2267
|
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$ITEM_TEXT_NAME, __scopeSelect);
|
|
2651
2268
|
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$ITEM_TEXT_NAME, __scopeSelect);
|
|
2652
2269
|
const itemContext = $cc7e05a45900e73f$var$useSelectItemContext($cc7e05a45900e73f$var$ITEM_TEXT_NAME, __scopeSelect);
|
|
2653
2270
|
const nativeOptionsContext = $cc7e05a45900e73f$var$useSelectNativeOptionsContext($cc7e05a45900e73f$var$ITEM_TEXT_NAME, __scopeSelect);
|
|
2654
|
-
const [itemTextNode, setItemTextNode] = React$
|
|
2655
|
-
const composedRefs =
|
|
2271
|
+
const [itemTextNode, setItemTextNode] = React$1.useState(null);
|
|
2272
|
+
const composedRefs = BtIconTickAlt2Px.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setItemTextNode(node)
|
|
2656
2273
|
, itemContext.onItemTextChange, (node)=>{
|
|
2657
2274
|
var _contentContext$itemT;
|
|
2658
2275
|
return (_contentContext$itemT = contentContext.itemTextRefCallback) === null || _contentContext$itemT === void 0 ? void 0 : _contentContext$itemT.call(contentContext, node, itemContext.value, itemContext.disabled);
|
|
2659
2276
|
});
|
|
2660
2277
|
const textContent = itemTextNode === null || itemTextNode === void 0 ? void 0 : itemTextNode.textContent;
|
|
2661
|
-
const nativeOption = React$
|
|
2278
|
+
const nativeOption = React$1.useMemo(()=>/*#__PURE__*/ React$1.createElement("option", {
|
|
2662
2279
|
key: itemContext.value,
|
|
2663
2280
|
value: itemContext.value,
|
|
2664
2281
|
disabled: itemContext.disabled
|
|
@@ -2669,7 +2286,7 @@ const $cc7e05a45900e73f$export$3572fb0fb821ff49 = /*#__PURE__*/ React$2.forwardR
|
|
|
2669
2286
|
textContent
|
|
2670
2287
|
]);
|
|
2671
2288
|
const { onNativeOptionAdd: onNativeOptionAdd , onNativeOptionRemove: onNativeOptionRemove } = nativeOptionsContext;
|
|
2672
|
-
|
|
2289
|
+
BtIconTickAlt2Px.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
2673
2290
|
onNativeOptionAdd(nativeOption);
|
|
2674
2291
|
return ()=>onNativeOptionRemove(nativeOption)
|
|
2675
2292
|
;
|
|
@@ -2678,7 +2295,7 @@ const $cc7e05a45900e73f$export$3572fb0fb821ff49 = /*#__PURE__*/ React$2.forwardR
|
|
|
2678
2295
|
onNativeOptionRemove,
|
|
2679
2296
|
nativeOption
|
|
2680
2297
|
]);
|
|
2681
|
-
return /*#__PURE__*/ React$
|
|
2298
|
+
return /*#__PURE__*/ React$1.createElement(React$1.Fragment, null, /*#__PURE__*/ React$1.createElement(BtIconTickAlt2Px.$8927f6f2acc4f386$export$250ffa63cdc0d034.span, BtIconTickAlt2Px._extends({
|
|
2682
2299
|
id: itemContext.textId
|
|
2683
2300
|
}, itemTextProps, {
|
|
2684
2301
|
ref: composedRefs
|
|
@@ -2687,10 +2304,10 @@ const $cc7e05a45900e73f$export$3572fb0fb821ff49 = /*#__PURE__*/ React$2.forwardR
|
|
|
2687
2304
|
/* -------------------------------------------------------------------------------------------------
|
|
2688
2305
|
* SelectItemIndicator
|
|
2689
2306
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$ITEM_INDICATOR_NAME = 'SelectItemIndicator';
|
|
2690
|
-
const $cc7e05a45900e73f$export$6b9198de19accfe6 = /*#__PURE__*/ React$
|
|
2307
|
+
const $cc7e05a45900e73f$export$6b9198de19accfe6 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
2691
2308
|
const { __scopeSelect: __scopeSelect , ...itemIndicatorProps } = props;
|
|
2692
2309
|
const itemContext = $cc7e05a45900e73f$var$useSelectItemContext($cc7e05a45900e73f$var$ITEM_INDICATOR_NAME, __scopeSelect);
|
|
2693
|
-
return itemContext.isSelected ? /*#__PURE__*/ React$
|
|
2310
|
+
return itemContext.isSelected ? /*#__PURE__*/ React$1.createElement(BtIconTickAlt2Px.$8927f6f2acc4f386$export$250ffa63cdc0d034.span, BtIconTickAlt2Px._extends({
|
|
2694
2311
|
"aria-hidden": true
|
|
2695
2312
|
}, itemIndicatorProps, {
|
|
2696
2313
|
ref: forwardedRef
|
|
@@ -2699,11 +2316,11 @@ const $cc7e05a45900e73f$export$6b9198de19accfe6 = /*#__PURE__*/ React$2.forwardR
|
|
|
2699
2316
|
/* -------------------------------------------------------------------------------------------------
|
|
2700
2317
|
* SelectScrollUpButton
|
|
2701
2318
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$SCROLL_UP_BUTTON_NAME = 'SelectScrollUpButton';
|
|
2702
|
-
const $cc7e05a45900e73f$export$d8117927658af6d7 = /*#__PURE__*/ React$
|
|
2319
|
+
const $cc7e05a45900e73f$export$d8117927658af6d7 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
2703
2320
|
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$SCROLL_UP_BUTTON_NAME, props.__scopeSelect);
|
|
2704
|
-
const [canScrollUp1, setCanScrollUp] = React$
|
|
2705
|
-
const composedRefs =
|
|
2706
|
-
|
|
2321
|
+
const [canScrollUp1, setCanScrollUp] = React$1.useState(false);
|
|
2322
|
+
const composedRefs = BtIconTickAlt2Px.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, contentContext.onScrollButtonChange);
|
|
2323
|
+
BtIconTickAlt2Px.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
2707
2324
|
if (contentContext.viewport && contentContext.isPositioned) {
|
|
2708
2325
|
const viewport = contentContext.viewport;
|
|
2709
2326
|
function handleScroll() {
|
|
@@ -2719,7 +2336,7 @@ const $cc7e05a45900e73f$export$d8117927658af6d7 = /*#__PURE__*/ React$2.forwardR
|
|
|
2719
2336
|
contentContext.viewport,
|
|
2720
2337
|
contentContext.isPositioned
|
|
2721
2338
|
]);
|
|
2722
|
-
return canScrollUp1 ? /*#__PURE__*/ React$
|
|
2339
|
+
return canScrollUp1 ? /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$SelectScrollButtonImpl, BtIconTickAlt2Px._extends({}, props, {
|
|
2723
2340
|
ref: composedRefs,
|
|
2724
2341
|
onAutoScroll: ()=>{
|
|
2725
2342
|
const { viewport: viewport , selectedItem: selectedItem } = contentContext;
|
|
@@ -2730,11 +2347,11 @@ const $cc7e05a45900e73f$export$d8117927658af6d7 = /*#__PURE__*/ React$2.forwardR
|
|
|
2730
2347
|
/* -------------------------------------------------------------------------------------------------
|
|
2731
2348
|
* SelectScrollDownButton
|
|
2732
2349
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$SCROLL_DOWN_BUTTON_NAME = 'SelectScrollDownButton';
|
|
2733
|
-
const $cc7e05a45900e73f$export$ff951e476c12189 = /*#__PURE__*/ React$
|
|
2350
|
+
const $cc7e05a45900e73f$export$ff951e476c12189 = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
2734
2351
|
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$SCROLL_DOWN_BUTTON_NAME, props.__scopeSelect);
|
|
2735
|
-
const [canScrollDown1, setCanScrollDown] = React$
|
|
2736
|
-
const composedRefs =
|
|
2737
|
-
|
|
2352
|
+
const [canScrollDown1, setCanScrollDown] = React$1.useState(false);
|
|
2353
|
+
const composedRefs = BtIconTickAlt2Px.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, contentContext.onScrollButtonChange);
|
|
2354
|
+
BtIconTickAlt2Px.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
2738
2355
|
if (contentContext.viewport && contentContext.isPositioned) {
|
|
2739
2356
|
const viewport = contentContext.viewport;
|
|
2740
2357
|
function handleScroll() {
|
|
@@ -2752,7 +2369,7 @@ const $cc7e05a45900e73f$export$ff951e476c12189 = /*#__PURE__*/ React$2.forwardRe
|
|
|
2752
2369
|
contentContext.viewport,
|
|
2753
2370
|
contentContext.isPositioned
|
|
2754
2371
|
]);
|
|
2755
|
-
return canScrollDown1 ? /*#__PURE__*/ React$
|
|
2372
|
+
return canScrollDown1 ? /*#__PURE__*/ React$1.createElement($cc7e05a45900e73f$var$SelectScrollButtonImpl, BtIconTickAlt2Px._extends({}, props, {
|
|
2756
2373
|
ref: composedRefs,
|
|
2757
2374
|
onAutoScroll: ()=>{
|
|
2758
2375
|
const { viewport: viewport , selectedItem: selectedItem } = contentContext;
|
|
@@ -2760,18 +2377,18 @@ const $cc7e05a45900e73f$export$ff951e476c12189 = /*#__PURE__*/ React$2.forwardRe
|
|
|
2760
2377
|
}
|
|
2761
2378
|
})) : null;
|
|
2762
2379
|
});
|
|
2763
|
-
const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ React$
|
|
2380
|
+
const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
2764
2381
|
const { __scopeSelect: __scopeSelect , onAutoScroll: onAutoScroll , ...scrollIndicatorProps } = props;
|
|
2765
2382
|
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext('SelectScrollButton', __scopeSelect);
|
|
2766
|
-
const autoScrollTimerRef = React$
|
|
2383
|
+
const autoScrollTimerRef = React$1.useRef(null);
|
|
2767
2384
|
const getItems = $cc7e05a45900e73f$var$useCollection(__scopeSelect);
|
|
2768
|
-
const clearAutoScrollTimer = React$
|
|
2385
|
+
const clearAutoScrollTimer = React$1.useCallback(()=>{
|
|
2769
2386
|
if (autoScrollTimerRef.current !== null) {
|
|
2770
2387
|
window.clearInterval(autoScrollTimerRef.current);
|
|
2771
2388
|
autoScrollTimerRef.current = null;
|
|
2772
2389
|
}
|
|
2773
2390
|
}, []);
|
|
2774
|
-
React$
|
|
2391
|
+
React$1.useEffect(()=>{
|
|
2775
2392
|
return ()=>clearAutoScrollTimer()
|
|
2776
2393
|
;
|
|
2777
2394
|
}, [
|
|
@@ -2780,7 +2397,7 @@ const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ React$2.forwa
|
|
|
2780
2397
|
// Because it is part of the normal flow, it will push down (top button) or shrink (bottom button)
|
|
2781
2398
|
// the viewport, potentially causing the active item to now be partially out of view.
|
|
2782
2399
|
// We re-run the `scrollIntoView` logic to make sure it stays within the viewport.
|
|
2783
|
-
|
|
2400
|
+
BtIconTickAlt2Px.$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
2784
2401
|
var _activeItem$ref$curre;
|
|
2785
2402
|
const activeItem = getItems().find((item)=>item.ref.current === document.activeElement
|
|
2786
2403
|
);
|
|
@@ -2790,7 +2407,7 @@ const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ React$2.forwa
|
|
|
2790
2407
|
}, [
|
|
2791
2408
|
getItems
|
|
2792
2409
|
]);
|
|
2793
|
-
return /*#__PURE__*/ React$
|
|
2410
|
+
return /*#__PURE__*/ React$1.createElement(BtIconTickAlt2Px.$8927f6f2acc4f386$export$250ffa63cdc0d034.div, BtIconTickAlt2Px._extends({
|
|
2794
2411
|
"aria-hidden": true
|
|
2795
2412
|
}, scrollIndicatorProps, {
|
|
2796
2413
|
ref: forwardedRef,
|
|
@@ -2798,22 +2415,22 @@ const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ React$2.forwa
|
|
|
2798
2415
|
flexShrink: 0,
|
|
2799
2416
|
...scrollIndicatorProps.style
|
|
2800
2417
|
},
|
|
2801
|
-
onPointerMove:
|
|
2418
|
+
onPointerMove: BtIconTickAlt2Px.$e42e1063c40fb3ef$export$b9ecd428b558ff10(scrollIndicatorProps.onPointerMove, ()=>{
|
|
2802
2419
|
var _contentContext$onIte3;
|
|
2803
2420
|
(_contentContext$onIte3 = contentContext.onItemLeave) === null || _contentContext$onIte3 === void 0 || _contentContext$onIte3.call(contentContext);
|
|
2804
2421
|
if (autoScrollTimerRef.current === null) autoScrollTimerRef.current = window.setInterval(onAutoScroll, 50);
|
|
2805
2422
|
}),
|
|
2806
|
-
onPointerLeave:
|
|
2423
|
+
onPointerLeave: BtIconTickAlt2Px.$e42e1063c40fb3ef$export$b9ecd428b558ff10(scrollIndicatorProps.onPointerLeave, ()=>{
|
|
2807
2424
|
clearAutoScrollTimer();
|
|
2808
2425
|
})
|
|
2809
2426
|
}));
|
|
2810
2427
|
});
|
|
2811
|
-
/* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$BubbleSelect = /*#__PURE__*/ React$
|
|
2428
|
+
/* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$BubbleSelect = /*#__PURE__*/ React$1.forwardRef((props, forwardedRef)=>{
|
|
2812
2429
|
const { value: value , ...selectProps } = props;
|
|
2813
|
-
const ref = React$
|
|
2814
|
-
const composedRefs =
|
|
2815
|
-
const prevValue =
|
|
2816
|
-
React$
|
|
2430
|
+
const ref = React$1.useRef(null);
|
|
2431
|
+
const composedRefs = BtIconTickAlt2Px.$6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, ref);
|
|
2432
|
+
const prevValue = BtIconTickAlt2Px.$010c2913dbd2fe3d$export$5cae361ad82dce8b(value); // Bubble value change to parents (e.g form change event)
|
|
2433
|
+
React$1.useEffect(()=>{
|
|
2817
2434
|
const select = ref.current;
|
|
2818
2435
|
const selectProto = window.HTMLSelectElement.prototype;
|
|
2819
2436
|
const descriptor = Object.getOwnPropertyDescriptor(selectProto, 'value');
|
|
@@ -2840,19 +2457,19 @@ const $cc7e05a45900e73f$var$SelectScrollButtonImpl = /*#__PURE__*/ React$2.forwa
|
|
|
2840
2457
|
*
|
|
2841
2458
|
* We use `VisuallyHidden` rather than `display: "none"` because Safari autofill
|
|
2842
2459
|
* won't work otherwise.
|
|
2843
|
-
*/ return /*#__PURE__*/ React$
|
|
2460
|
+
*/ return /*#__PURE__*/ React$1.createElement($ea1ef594cf570d83$export$439d29a4e110a164, {
|
|
2844
2461
|
asChild: true
|
|
2845
|
-
}, /*#__PURE__*/ React$
|
|
2462
|
+
}, /*#__PURE__*/ React$1.createElement("select", BtIconTickAlt2Px._extends({}, selectProps, {
|
|
2846
2463
|
ref: composedRefs,
|
|
2847
2464
|
defaultValue: value
|
|
2848
2465
|
})));
|
|
2849
2466
|
});
|
|
2850
2467
|
$cc7e05a45900e73f$var$BubbleSelect.displayName = 'BubbleSelect';
|
|
2851
2468
|
function $cc7e05a45900e73f$var$useTypeaheadSearch(onSearchChange) {
|
|
2852
|
-
const handleSearchChange =
|
|
2853
|
-
const searchRef = React$
|
|
2854
|
-
const timerRef = React$
|
|
2855
|
-
const handleTypeaheadSearch = React$
|
|
2469
|
+
const handleSearchChange = BtIconTickAlt2Px.$b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onSearchChange);
|
|
2470
|
+
const searchRef = React$1.useRef('');
|
|
2471
|
+
const timerRef = React$1.useRef(0);
|
|
2472
|
+
const handleTypeaheadSearch = React$1.useCallback((key)=>{
|
|
2856
2473
|
const search = searchRef.current + key;
|
|
2857
2474
|
handleSearchChange(search);
|
|
2858
2475
|
(function updateSearch(value) {
|
|
@@ -2864,11 +2481,11 @@ function $cc7e05a45900e73f$var$useTypeaheadSearch(onSearchChange) {
|
|
|
2864
2481
|
}, [
|
|
2865
2482
|
handleSearchChange
|
|
2866
2483
|
]);
|
|
2867
|
-
const resetTypeahead = React$
|
|
2484
|
+
const resetTypeahead = React$1.useCallback(()=>{
|
|
2868
2485
|
searchRef.current = '';
|
|
2869
2486
|
window.clearTimeout(timerRef.current);
|
|
2870
2487
|
}, []);
|
|
2871
|
-
React$
|
|
2488
|
+
React$1.useEffect(()=>{
|
|
2872
2489
|
return ()=>window.clearTimeout(timerRef.current)
|
|
2873
2490
|
;
|
|
2874
2491
|
}, []);
|
|
@@ -2927,28 +2544,8 @@ const $cc7e05a45900e73f$export$c3468e2714d175fa = $cc7e05a45900e73f$export$6b919
|
|
|
2927
2544
|
const $cc7e05a45900e73f$export$2f60d3ec9ad468f2 = $cc7e05a45900e73f$export$d8117927658af6d7;
|
|
2928
2545
|
const $cc7e05a45900e73f$export$bf1aedc3039c8d63 = $cc7e05a45900e73f$export$ff951e476c12189;
|
|
2929
2546
|
|
|
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
2547
|
const React = React__default["default"];
|
|
2951
|
-
const
|
|
2548
|
+
const BtIconChevronUp2Px = props =>
|
|
2952
2549
|
/*#__PURE__*/ React.createElement(
|
|
2953
2550
|
"svg",
|
|
2954
2551
|
Object.assign(
|
|
@@ -2961,23 +2558,27 @@ const BtIconTickAlt2Px = props =>
|
|
|
2961
2558
|
/*#__PURE__*/ React.createElement("defs", null),
|
|
2962
2559
|
/*#__PURE__*/ React.createElement("path", {
|
|
2963
2560
|
d:
|
|
2964
|
-
"
|
|
2561
|
+
"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
2562
|
fill: "currentColor"
|
|
2966
2563
|
})
|
|
2967
2564
|
);
|
|
2968
|
-
var
|
|
2565
|
+
var BtIconChevronUp2Px_2 = BtIconChevronUp2Px;
|
|
2969
2566
|
|
|
2970
2567
|
/** Use `Select` to choose from a dropdown list of options. */
|
|
2971
2568
|
var Select = function (_a) {
|
|
2972
2569
|
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$
|
|
2570
|
+
var id = React$1.useId();
|
|
2571
|
+
var arcRootElement = React$1.useContext(Base.ArcRootElementContext);
|
|
2572
|
+
var surface = React$1.useContext(Surface.Context).surface;
|
|
2573
|
+
var _b = React$1.useState(defaultValue), selectedValue = _b[0], setSelectedValue = _b[1];
|
|
2977
2574
|
var onValueChange = function (value) {
|
|
2978
2575
|
onChange && onChange(value);
|
|
2979
2576
|
setSelectedValue(value);
|
|
2980
2577
|
};
|
|
2578
|
+
var getSelectedValueName = function (value) {
|
|
2579
|
+
var _a;
|
|
2580
|
+
return (_a = options.find(function (option) { return option.value === value; })) === null || _a === void 0 ? void 0 : _a.name;
|
|
2581
|
+
};
|
|
2981
2582
|
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
2583
|
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
2584
|
React__default["default"].createElement($cc7e05a45900e73f$export$41fb9f06171c75f4, { id: id, name: name, onBlur: onBlur, className: index.classNames("arc-Select-trigger", {
|
|
@@ -2985,7 +2586,7 @@ var Select = function (_a) {
|
|
|
2985
2586
|
"arc-Select-trigger--onDarkSurface": surface === "dark",
|
|
2986
2587
|
"arc-Select-trigger--invalid": errorMessage
|
|
2987
2588
|
}) },
|
|
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))),
|
|
2589
|
+
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
2590
|
React__default["default"].createElement($cc7e05a45900e73f$export$f04a61298a47a40f, { className: "arc-Select-triggerIcon" },
|
|
2990
2591
|
React__default["default"].createElement(Icon.Icon, { icon: BtIconChevronDown2Px.BtIconChevronDown2Px_2, size: 20 }))),
|
|
2991
2592
|
React__default["default"].createElement($cc7e05a45900e73f$export$602eac185826482c, { container: arcRootElement },
|
|
@@ -3001,7 +2602,7 @@ var Select = function (_a) {
|
|
|
3001
2602
|
React__default["default"].createElement($cc7e05a45900e73f$export$d6e5bf9c43ea9319, { asChild: true },
|
|
3002
2603
|
React__default["default"].createElement("span", { className: "arc-Select-itemText" }, name))),
|
|
3003
2604
|
React__default["default"].createElement($cc7e05a45900e73f$export$c3468e2714d175fa, null,
|
|
3004
|
-
React__default["default"].createElement(Icon.Icon, { icon: BtIconTickAlt2Px_2, size: 20 }))));
|
|
2605
|
+
React__default["default"].createElement(Icon.Icon, { icon: BtIconTickAlt2Px.BtIconTickAlt2Px_2, size: 20 }))));
|
|
3005
2606
|
})),
|
|
3006
2607
|
React__default["default"].createElement($cc7e05a45900e73f$export$bf1aedc3039c8d63, { className: "arc-Select-scrollButton" },
|
|
3007
2608
|
React__default["default"].createElement(Icon.Icon, { icon: BtIconChevronDown2Px.BtIconChevronDown2Px_2, size: 16 })))))));
|