@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
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { c as classNames } from '../_shared/esm/index-2ae58626.js';
|
|
2
|
-
import * as React$
|
|
3
|
-
import React__default, {
|
|
4
|
-
import $
|
|
2
|
+
import * as React$1 from 'react';
|
|
3
|
+
import React__default, { useContext, createContext, useEffect, forwardRef, useState, createElement, useRef, useCallback, Fragment, useMemo, useId } from 'react';
|
|
4
|
+
import { $ as $c512c27ab02ef895$export$50c7b4e9d9f19c1, a as $6ed0406888f73fc4$export$c7b2cbe3552a0d05, b as $5e63c961fc1ce211$export$8c6ed5c666ac1360, c as $b1b2314f5f9a1d84$export$25bec8c6f54ee79a, d as $8927f6f2acc4f386$export$250ffa63cdc0d034, _ as _extends, e as $e42e1063c40fb3ef$export$b9ecd428b558ff10, f as $8927f6f2acc4f386$export$6d1a0317bde7de7f, g as $9f79659886946c16$export$e5c5a5f917a5871c, h as $71cd76cc60e0454e$export$6f32135080cb4c3, i as $010c2913dbd2fe3d$export$5cae361ad82dce8b, B as BtIconTickAlt2Px_2 } from '../_shared/esm/BtIconTickAlt2Px-2c4ec3be.js';
|
|
5
|
+
import $7SXl2$reactdom, { createPortal } from 'react-dom';
|
|
5
6
|
import { B as BtIconChevronDown2Px_2 } from '../_shared/esm/BtIconChevronDown2Px-782876e2.js';
|
|
6
7
|
import { I as Icon } from '../_shared/esm/Icon-61f7237a.js';
|
|
7
8
|
import { F as FormControl } from '../_shared/esm/FormControl-84c9ace6.js';
|
|
@@ -12,231 +13,10 @@ import '../_shared/esm/suffix-modifier-f5e28822.js';
|
|
|
12
13
|
import '../_shared/esm/Text-6b958ad8.js';
|
|
13
14
|
import '../_shared/esm/BtIconChevronRightMid-d9b11761.js';
|
|
14
15
|
|
|
15
|
-
function _extends() {
|
|
16
|
-
_extends = Object.assign || function (target) {
|
|
17
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
18
|
-
var source = arguments[i];
|
|
19
|
-
|
|
20
|
-
for (var key in source) {
|
|
21
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
22
|
-
target[key] = source[key];
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
return target;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
return _extends.apply(this, arguments);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
16
|
function $ae6933e535247d3d$export$7d15b64cf5a3a4c4(value, [min, max]) {
|
|
34
17
|
return Math.min(max, Math.max(min, value));
|
|
35
18
|
}
|
|
36
19
|
|
|
37
|
-
function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEventHandler, { checkForDefaultPrevented: checkForDefaultPrevented = true } = {}) {
|
|
38
|
-
return function handleEvent(event) {
|
|
39
|
-
originalEventHandler === null || originalEventHandler === void 0 || originalEventHandler(event);
|
|
40
|
-
if (checkForDefaultPrevented === false || !event.defaultPrevented) return ourEventHandler === null || ourEventHandler === void 0 ? void 0 : ourEventHandler(event);
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
/* -------------------------------------------------------------------------------------------------
|
|
45
|
-
* createContextScope
|
|
46
|
-
* -----------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$export$50c7b4e9d9f19c1(scopeName, createContextScopeDeps = []) {
|
|
47
|
-
let defaultContexts = [];
|
|
48
|
-
/* -----------------------------------------------------------------------------------------------
|
|
49
|
-
* createContext
|
|
50
|
-
* ---------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$export$fd42f52fd3ae1109(rootComponentName, defaultContext) {
|
|
51
|
-
const BaseContext = /*#__PURE__*/ createContext(defaultContext);
|
|
52
|
-
const index = defaultContexts.length;
|
|
53
|
-
defaultContexts = [
|
|
54
|
-
...defaultContexts,
|
|
55
|
-
defaultContext
|
|
56
|
-
];
|
|
57
|
-
function Provider(props) {
|
|
58
|
-
const { scope: scope , children: children , ...context } = props;
|
|
59
|
-
const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext; // Only re-memoize when prop values change
|
|
60
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
61
|
-
const value = useMemo(()=>context
|
|
62
|
-
, Object.values(context));
|
|
63
|
-
return /*#__PURE__*/ createElement(Context.Provider, {
|
|
64
|
-
value: value
|
|
65
|
-
}, children);
|
|
66
|
-
}
|
|
67
|
-
function useContext$1(consumerName, scope) {
|
|
68
|
-
const Context = (scope === null || scope === void 0 ? void 0 : scope[scopeName][index]) || BaseContext;
|
|
69
|
-
const context = useContext(Context);
|
|
70
|
-
if (context) return context;
|
|
71
|
-
if (defaultContext !== undefined) return defaultContext; // if a defaultContext wasn't specified, it's a required context.
|
|
72
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
73
|
-
}
|
|
74
|
-
Provider.displayName = rootComponentName + 'Provider';
|
|
75
|
-
return [
|
|
76
|
-
Provider,
|
|
77
|
-
useContext$1
|
|
78
|
-
];
|
|
79
|
-
}
|
|
80
|
-
/* -----------------------------------------------------------------------------------------------
|
|
81
|
-
* createScope
|
|
82
|
-
* ---------------------------------------------------------------------------------------------*/ const createScope = ()=>{
|
|
83
|
-
const scopeContexts = defaultContexts.map((defaultContext)=>{
|
|
84
|
-
return /*#__PURE__*/ createContext(defaultContext);
|
|
85
|
-
});
|
|
86
|
-
return function useScope(scope) {
|
|
87
|
-
const contexts = (scope === null || scope === void 0 ? void 0 : scope[scopeName]) || scopeContexts;
|
|
88
|
-
return useMemo(()=>({
|
|
89
|
-
[`__scope${scopeName}`]: {
|
|
90
|
-
...scope,
|
|
91
|
-
[scopeName]: contexts
|
|
92
|
-
}
|
|
93
|
-
})
|
|
94
|
-
, [
|
|
95
|
-
scope,
|
|
96
|
-
contexts
|
|
97
|
-
]);
|
|
98
|
-
};
|
|
99
|
-
};
|
|
100
|
-
createScope.scopeName = scopeName;
|
|
101
|
-
return [
|
|
102
|
-
$c512c27ab02ef895$export$fd42f52fd3ae1109,
|
|
103
|
-
$c512c27ab02ef895$var$composeContextScopes(createScope, ...createContextScopeDeps)
|
|
104
|
-
];
|
|
105
|
-
}
|
|
106
|
-
/* -------------------------------------------------------------------------------------------------
|
|
107
|
-
* composeContextScopes
|
|
108
|
-
* -----------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$var$composeContextScopes(...scopes) {
|
|
109
|
-
const baseScope = scopes[0];
|
|
110
|
-
if (scopes.length === 1) return baseScope;
|
|
111
|
-
const createScope1 = ()=>{
|
|
112
|
-
const scopeHooks = scopes.map((createScope)=>({
|
|
113
|
-
useScope: createScope(),
|
|
114
|
-
scopeName: createScope.scopeName
|
|
115
|
-
})
|
|
116
|
-
);
|
|
117
|
-
return function useComposedScopes(overrideScopes) {
|
|
118
|
-
const nextScopes1 = scopeHooks.reduce((nextScopes, { useScope: useScope , scopeName: scopeName })=>{
|
|
119
|
-
// We are calling a hook inside a callback which React warns against to avoid inconsistent
|
|
120
|
-
// renders, however, scoping doesn't have render side effects so we ignore the rule.
|
|
121
|
-
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
122
|
-
const scopeProps = useScope(overrideScopes);
|
|
123
|
-
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
124
|
-
return {
|
|
125
|
-
...nextScopes,
|
|
126
|
-
...currentScope
|
|
127
|
-
};
|
|
128
|
-
}, {});
|
|
129
|
-
return useMemo(()=>({
|
|
130
|
-
[`__scope${baseScope.scopeName}`]: nextScopes1
|
|
131
|
-
})
|
|
132
|
-
, [
|
|
133
|
-
nextScopes1
|
|
134
|
-
]);
|
|
135
|
-
};
|
|
136
|
-
};
|
|
137
|
-
createScope1.scopeName = baseScope.scopeName;
|
|
138
|
-
return createScope1;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Set a given ref to a given value
|
|
143
|
-
* This utility takes care of different types of refs: callback refs and RefObject(s)
|
|
144
|
-
*/ function $6ed0406888f73fc4$var$setRef(ref, value) {
|
|
145
|
-
if (typeof ref === 'function') ref(value);
|
|
146
|
-
else if (ref !== null && ref !== undefined) ref.current = value;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* A utility to compose multiple refs together
|
|
150
|
-
* Accepts callback refs and RefObject(s)
|
|
151
|
-
*/ function $6ed0406888f73fc4$export$43e446d32b3d21af(...refs) {
|
|
152
|
-
return (node)=>refs.forEach((ref)=>$6ed0406888f73fc4$var$setRef(ref, node)
|
|
153
|
-
)
|
|
154
|
-
;
|
|
155
|
-
}
|
|
156
|
-
/**
|
|
157
|
-
* A custom hook that composes multiple refs
|
|
158
|
-
* Accepts callback refs and RefObject(s)
|
|
159
|
-
*/ function $6ed0406888f73fc4$export$c7b2cbe3552a0d05(...refs) {
|
|
160
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
161
|
-
return useCallback($6ed0406888f73fc4$export$43e446d32b3d21af(...refs), refs);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
/* -------------------------------------------------------------------------------------------------
|
|
165
|
-
* Slot
|
|
166
|
-
* -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$export$8c6ed5c666ac1360 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
167
|
-
const { children: children , ...slotProps } = props;
|
|
168
|
-
const childrenArray = Children.toArray(children);
|
|
169
|
-
const slottable = childrenArray.find($5e63c961fc1ce211$var$isSlottable);
|
|
170
|
-
if (slottable) {
|
|
171
|
-
// the new element to render is the one passed as a child of `Slottable`
|
|
172
|
-
const newElement = slottable.props.children;
|
|
173
|
-
const newChildren = childrenArray.map((child)=>{
|
|
174
|
-
if (child === slottable) {
|
|
175
|
-
// because the new element will be the one rendered, we are only interested
|
|
176
|
-
// in grabbing its children (`newElement.props.children`)
|
|
177
|
-
if (Children.count(newElement) > 1) return Children.only(null);
|
|
178
|
-
return /*#__PURE__*/ isValidElement(newElement) ? newElement.props.children : null;
|
|
179
|
-
} else return child;
|
|
180
|
-
});
|
|
181
|
-
return /*#__PURE__*/ createElement($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, {
|
|
182
|
-
ref: forwardedRef
|
|
183
|
-
}), /*#__PURE__*/ isValidElement(newElement) ? /*#__PURE__*/ cloneElement(newElement, undefined, newChildren) : null);
|
|
184
|
-
}
|
|
185
|
-
return /*#__PURE__*/ createElement($5e63c961fc1ce211$var$SlotClone, _extends({}, slotProps, {
|
|
186
|
-
ref: forwardedRef
|
|
187
|
-
}), children);
|
|
188
|
-
});
|
|
189
|
-
$5e63c961fc1ce211$export$8c6ed5c666ac1360.displayName = 'Slot';
|
|
190
|
-
/* -------------------------------------------------------------------------------------------------
|
|
191
|
-
* SlotClone
|
|
192
|
-
* -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$var$SlotClone = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
193
|
-
const { children: children , ...slotProps } = props;
|
|
194
|
-
if (/*#__PURE__*/ isValidElement(children)) return /*#__PURE__*/ cloneElement(children, {
|
|
195
|
-
...$5e63c961fc1ce211$var$mergeProps(slotProps, children.props),
|
|
196
|
-
ref: $6ed0406888f73fc4$export$43e446d32b3d21af(forwardedRef, children.ref)
|
|
197
|
-
});
|
|
198
|
-
return Children.count(children) > 1 ? Children.only(null) : null;
|
|
199
|
-
});
|
|
200
|
-
$5e63c961fc1ce211$var$SlotClone.displayName = 'SlotClone';
|
|
201
|
-
/* -------------------------------------------------------------------------------------------------
|
|
202
|
-
* Slottable
|
|
203
|
-
* -----------------------------------------------------------------------------------------------*/ const $5e63c961fc1ce211$export$d9f1ccf0bdb05d45 = ({ children: children })=>{
|
|
204
|
-
return /*#__PURE__*/ createElement(Fragment, null, children);
|
|
205
|
-
};
|
|
206
|
-
/* ---------------------------------------------------------------------------------------------- */ function $5e63c961fc1ce211$var$isSlottable(child) {
|
|
207
|
-
return /*#__PURE__*/ isValidElement(child) && child.type === $5e63c961fc1ce211$export$d9f1ccf0bdb05d45;
|
|
208
|
-
}
|
|
209
|
-
function $5e63c961fc1ce211$var$mergeProps(slotProps, childProps) {
|
|
210
|
-
// all child props should override
|
|
211
|
-
const overrideProps = {
|
|
212
|
-
...childProps
|
|
213
|
-
};
|
|
214
|
-
for(const propName in childProps){
|
|
215
|
-
const slotPropValue = slotProps[propName];
|
|
216
|
-
const childPropValue = childProps[propName];
|
|
217
|
-
const isHandler = /^on[A-Z]/.test(propName);
|
|
218
|
-
if (isHandler) {
|
|
219
|
-
// if the handler exists on both, we compose them
|
|
220
|
-
if (slotPropValue && childPropValue) overrideProps[propName] = (...args)=>{
|
|
221
|
-
childPropValue(...args);
|
|
222
|
-
slotPropValue(...args);
|
|
223
|
-
};
|
|
224
|
-
else if (slotPropValue) overrideProps[propName] = slotPropValue;
|
|
225
|
-
} else if (propName === 'style') overrideProps[propName] = {
|
|
226
|
-
...slotPropValue,
|
|
227
|
-
...childPropValue
|
|
228
|
-
};
|
|
229
|
-
else if (propName === 'className') overrideProps[propName] = [
|
|
230
|
-
slotPropValue,
|
|
231
|
-
childPropValue
|
|
232
|
-
].filter(Boolean).join(' ');
|
|
233
|
-
}
|
|
234
|
-
return {
|
|
235
|
-
...slotProps,
|
|
236
|
-
...overrideProps
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
|
|
240
20
|
// We have resorted to returning slots directly rather than exposing primitives that can then
|
|
241
21
|
// be slotted like `<CollectionItem as={Slot}>…</CollectionItem>`.
|
|
242
22
|
// This is because we encountered issues with generic types that cannot be statically analysed
|
|
@@ -330,100 +110,6 @@ const $f631663db3294ace$var$DirectionContext = /*#__PURE__*/ createContext(undef
|
|
|
330
110
|
return localDir || globalDir || 'ltr';
|
|
331
111
|
}
|
|
332
112
|
|
|
333
|
-
const $8927f6f2acc4f386$var$NODES = [
|
|
334
|
-
'a',
|
|
335
|
-
'button',
|
|
336
|
-
'div',
|
|
337
|
-
'h2',
|
|
338
|
-
'h3',
|
|
339
|
-
'img',
|
|
340
|
-
'label',
|
|
341
|
-
'li',
|
|
342
|
-
'nav',
|
|
343
|
-
'ol',
|
|
344
|
-
'p',
|
|
345
|
-
'span',
|
|
346
|
-
'svg',
|
|
347
|
-
'ul'
|
|
348
|
-
]; // Temporary while we await merge of this fix:
|
|
349
|
-
// https://github.com/DefinitelyTyped/DefinitelyTyped/pull/55396
|
|
350
|
-
// prettier-ignore
|
|
351
|
-
/* -------------------------------------------------------------------------------------------------
|
|
352
|
-
* Primitive
|
|
353
|
-
* -----------------------------------------------------------------------------------------------*/ const $8927f6f2acc4f386$export$250ffa63cdc0d034 = $8927f6f2acc4f386$var$NODES.reduce((primitive, node)=>{
|
|
354
|
-
const Node = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
355
|
-
const { asChild: asChild , ...primitiveProps } = props;
|
|
356
|
-
const Comp = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : node;
|
|
357
|
-
useEffect(()=>{
|
|
358
|
-
window[Symbol.for('radix-ui')] = true;
|
|
359
|
-
}, []);
|
|
360
|
-
return /*#__PURE__*/ createElement(Comp, _extends({}, primitiveProps, {
|
|
361
|
-
ref: forwardedRef
|
|
362
|
-
}));
|
|
363
|
-
});
|
|
364
|
-
Node.displayName = `Primitive.${node}`;
|
|
365
|
-
return {
|
|
366
|
-
...primitive,
|
|
367
|
-
[node]: Node
|
|
368
|
-
};
|
|
369
|
-
}, {});
|
|
370
|
-
/* -------------------------------------------------------------------------------------------------
|
|
371
|
-
* Utils
|
|
372
|
-
* -----------------------------------------------------------------------------------------------*/ /**
|
|
373
|
-
* Flush custom event dispatch
|
|
374
|
-
* https://github.com/radix-ui/primitives/pull/1378
|
|
375
|
-
*
|
|
376
|
-
* React batches *all* event handlers since version 18, this introduces certain considerations when using custom event types.
|
|
377
|
-
*
|
|
378
|
-
* Internally, React prioritises events in the following order:
|
|
379
|
-
* - discrete
|
|
380
|
-
* - continuous
|
|
381
|
-
* - default
|
|
382
|
-
*
|
|
383
|
-
* https://github.com/facebook/react/blob/a8a4742f1c54493df00da648a3f9d26e3db9c8b5/packages/react-dom/src/events/ReactDOMEventListener.js#L294-L350
|
|
384
|
-
*
|
|
385
|
-
* `discrete` is an important distinction as updates within these events are applied immediately.
|
|
386
|
-
* React however, is not able to infer the priority of custom event types due to how they are detected internally.
|
|
387
|
-
* Because of this, it's possible for updates from custom events to be unexpectedly batched when
|
|
388
|
-
* dispatched by another `discrete` event.
|
|
389
|
-
*
|
|
390
|
-
* In order to ensure that updates from custom events are applied predictably, we need to manually flush the batch.
|
|
391
|
-
* This utility should be used when dispatching a custom event from within another `discrete` event, this utility
|
|
392
|
-
* is not nessesary when dispatching known event types, or if dispatching a custom type inside a non-discrete event.
|
|
393
|
-
* For example:
|
|
394
|
-
*
|
|
395
|
-
* dispatching a known click 👎
|
|
396
|
-
* target.dispatchEvent(new Event(‘click’))
|
|
397
|
-
*
|
|
398
|
-
* dispatching a custom type within a non-discrete event 👎
|
|
399
|
-
* onScroll={(event) => event.target.dispatchEvent(new CustomEvent(‘customType’))}
|
|
400
|
-
*
|
|
401
|
-
* dispatching a custom type within a `discrete` event 👍
|
|
402
|
-
* onPointerDown={(event) => dispatchDiscreteCustomEvent(event.target, new CustomEvent(‘customType’))}
|
|
403
|
-
*
|
|
404
|
-
* Note: though React classifies `focus`, `focusin` and `focusout` events as `discrete`, it's not recommended to use
|
|
405
|
-
* this utility with them. This is because it's possible for those handlers to be called implicitly during render
|
|
406
|
-
* e.g. when focus is within a component as it is unmounted, or when managing focus on mount.
|
|
407
|
-
*/ function $8927f6f2acc4f386$export$6d1a0317bde7de7f(target, event) {
|
|
408
|
-
if (target) flushSync(()=>target.dispatchEvent(event)
|
|
409
|
-
);
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
/**
|
|
413
|
-
* A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a
|
|
414
|
-
* prop or avoid re-executing effects when passed as a dependency
|
|
415
|
-
*/ function $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(callback) {
|
|
416
|
-
const callbackRef = useRef(callback);
|
|
417
|
-
useEffect(()=>{
|
|
418
|
-
callbackRef.current = callback;
|
|
419
|
-
}); // https://github.com/facebook/react/issues/19240
|
|
420
|
-
return useMemo(()=>(...args)=>{
|
|
421
|
-
var _callbackRef$current;
|
|
422
|
-
return (_callbackRef$current = callbackRef.current) === null || _callbackRef$current === void 0 ? void 0 : _callbackRef$current.call(callbackRef, ...args);
|
|
423
|
-
}
|
|
424
|
-
, []);
|
|
425
|
-
}
|
|
426
|
-
|
|
427
113
|
/**
|
|
428
114
|
* Listens for when the escape key is down
|
|
429
115
|
*/ function $addc16e1bbe58fd0$export$3a72a57244d6e765(onEscapeKeyDownProp, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
|
|
@@ -939,19 +625,11 @@ function $d3863c46a17e8a28$var$removeLinks(items) {
|
|
|
939
625
|
);
|
|
940
626
|
}
|
|
941
627
|
|
|
942
|
-
|
|
943
|
-
* On the server, React emits a warning when calling `useLayoutEffect`.
|
|
944
|
-
* This is because neither `useLayoutEffect` nor `useEffect` run on the server.
|
|
945
|
-
* We use this safe version which suppresses the warning by replacing it with a noop on the server.
|
|
946
|
-
*
|
|
947
|
-
* See: https://reactjs.org/docs/hooks-reference.html#uselayouteffect
|
|
948
|
-
*/ const $9f79659886946c16$export$e5c5a5f917a5871c = Boolean(globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) ? useLayoutEffect : ()=>{};
|
|
949
|
-
|
|
950
|
-
const $1746a345f3d73bb7$var$useReactId = React$2['useId'.toString()] || (()=>undefined
|
|
628
|
+
const $1746a345f3d73bb7$var$useReactId = React$1['useId'.toString()] || (()=>undefined
|
|
951
629
|
);
|
|
952
630
|
let $1746a345f3d73bb7$var$count = 0;
|
|
953
631
|
function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {
|
|
954
|
-
const [id, setId] = React$
|
|
632
|
+
const [id, setId] = React$1.useState($1746a345f3d73bb7$var$useReactId()); // React versions older than 18 will have client-side ids only.
|
|
955
633
|
$9f79659886946c16$export$e5c5a5f917a5871c(()=>{
|
|
956
634
|
if (!deterministicId) setId((reactId)=>reactId !== null && reactId !== void 0 ? reactId : String($1746a345f3d73bb7$var$count++)
|
|
957
635
|
);
|
|
@@ -969,67 +647,6 @@ const $f1701beae083dbae$export$602eac185826482c = /*#__PURE__*/ forwardRef((prop
|
|
|
969
647
|
})), container) : null;
|
|
970
648
|
});
|
|
971
649
|
|
|
972
|
-
function $71cd76cc60e0454e$export$6f32135080cb4c3({ prop: prop , defaultProp: defaultProp , onChange: onChange = ()=>{} }) {
|
|
973
|
-
const [uncontrolledProp, setUncontrolledProp] = $71cd76cc60e0454e$var$useUncontrolledState({
|
|
974
|
-
defaultProp: defaultProp,
|
|
975
|
-
onChange: onChange
|
|
976
|
-
});
|
|
977
|
-
const isControlled = prop !== undefined;
|
|
978
|
-
const value1 = isControlled ? prop : uncontrolledProp;
|
|
979
|
-
const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange);
|
|
980
|
-
const setValue = useCallback((nextValue)=>{
|
|
981
|
-
if (isControlled) {
|
|
982
|
-
const setter = nextValue;
|
|
983
|
-
const value = typeof nextValue === 'function' ? setter(prop) : nextValue;
|
|
984
|
-
if (value !== prop) handleChange(value);
|
|
985
|
-
} else setUncontrolledProp(nextValue);
|
|
986
|
-
}, [
|
|
987
|
-
isControlled,
|
|
988
|
-
prop,
|
|
989
|
-
setUncontrolledProp,
|
|
990
|
-
handleChange
|
|
991
|
-
]);
|
|
992
|
-
return [
|
|
993
|
-
value1,
|
|
994
|
-
setValue
|
|
995
|
-
];
|
|
996
|
-
}
|
|
997
|
-
function $71cd76cc60e0454e$var$useUncontrolledState({ defaultProp: defaultProp , onChange: onChange }) {
|
|
998
|
-
const uncontrolledState = useState(defaultProp);
|
|
999
|
-
const [value] = uncontrolledState;
|
|
1000
|
-
const prevValueRef = useRef(value);
|
|
1001
|
-
const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange);
|
|
1002
|
-
useEffect(()=>{
|
|
1003
|
-
if (prevValueRef.current !== value) {
|
|
1004
|
-
handleChange(value);
|
|
1005
|
-
prevValueRef.current = value;
|
|
1006
|
-
}
|
|
1007
|
-
}, [
|
|
1008
|
-
value,
|
|
1009
|
-
prevValueRef,
|
|
1010
|
-
handleChange
|
|
1011
|
-
]);
|
|
1012
|
-
return uncontrolledState;
|
|
1013
|
-
}
|
|
1014
|
-
|
|
1015
|
-
function $010c2913dbd2fe3d$export$5cae361ad82dce8b(value) {
|
|
1016
|
-
const ref = useRef({
|
|
1017
|
-
value: value,
|
|
1018
|
-
previous: value
|
|
1019
|
-
}); // We compare values before making an update to ensure that
|
|
1020
|
-
// a change has been made. This ensures the previous value is
|
|
1021
|
-
// persisted correctly between renders.
|
|
1022
|
-
return useMemo(()=>{
|
|
1023
|
-
if (ref.current.value !== value) {
|
|
1024
|
-
ref.current.previous = ref.current.value;
|
|
1025
|
-
ref.current.value = value;
|
|
1026
|
-
}
|
|
1027
|
-
return ref.current.previous;
|
|
1028
|
-
}, [
|
|
1029
|
-
value
|
|
1030
|
-
]);
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
650
|
const $ea1ef594cf570d83$export$439d29a4e110a164 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
1034
651
|
return /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.span, _extends({}, props, {
|
|
1035
652
|
ref: forwardedRef,
|
|
@@ -1436,7 +1053,7 @@ var SideCar$1 = function (_a) {
|
|
|
1436
1053
|
if (!Target) {
|
|
1437
1054
|
throw new Error('Sidecar medium not found');
|
|
1438
1055
|
}
|
|
1439
|
-
return React$
|
|
1056
|
+
return React$1.createElement(Target, __assign({}, rest));
|
|
1440
1057
|
};
|
|
1441
1058
|
SideCar$1.isSideCarExport = true;
|
|
1442
1059
|
function exportSidecar(medium, exported) {
|
|
@@ -1452,9 +1069,9 @@ var nothing = function () {
|
|
|
1452
1069
|
/**
|
|
1453
1070
|
* Removes scrollbar from the page and contain the scroll within the Lock
|
|
1454
1071
|
*/
|
|
1455
|
-
var RemoveScroll = React$
|
|
1456
|
-
var ref = React$
|
|
1457
|
-
var _a = React$
|
|
1072
|
+
var RemoveScroll = React$1.forwardRef(function (props, parentRef) {
|
|
1073
|
+
var ref = React$1.useRef(null);
|
|
1074
|
+
var _a = React$1.useState({
|
|
1458
1075
|
onScrollCapture: nothing,
|
|
1459
1076
|
onWheelCapture: nothing,
|
|
1460
1077
|
onTouchMoveCapture: nothing,
|
|
@@ -1463,9 +1080,9 @@ var RemoveScroll = React$2.forwardRef(function (props, parentRef) {
|
|
|
1463
1080
|
var SideCar = sideCar;
|
|
1464
1081
|
var containerRef = useMergeRefs([ref, parentRef]);
|
|
1465
1082
|
var containerProps = __assign$1(__assign$1({}, rest), callbacks);
|
|
1466
|
-
return (React$
|
|
1467
|
-
enabled && (React$
|
|
1468
|
-
forwardProps ? (React$
|
|
1083
|
+
return (React$1.createElement(React$1.Fragment, null,
|
|
1084
|
+
enabled && (React$1.createElement(SideCar, { sideCar: effectCar, removeScrollBar: removeScrollBar, shards: shards, noIsolation: noIsolation, inert: inert, setCallbacks: setCallbacks, allowPinchZoom: !!allowPinchZoom, lockRef: ref })),
|
|
1085
|
+
forwardProps ? (React$1.cloneElement(React$1.Children.only(children), __assign$1(__assign$1({}, containerProps), { ref: containerRef }))) : (React$1.createElement(Container, __assign$1({}, containerProps, { className: className, ref: containerRef }), children))));
|
|
1469
1086
|
});
|
|
1470
1087
|
RemoveScroll.defaultProps = {
|
|
1471
1088
|
enabled: true,
|
|
@@ -1544,7 +1161,7 @@ var stylesheetSingleton = function () {
|
|
|
1544
1161
|
var styleHookSingleton = function () {
|
|
1545
1162
|
var sheet = stylesheetSingleton();
|
|
1546
1163
|
return function (styles, isDynamic) {
|
|
1547
|
-
React$
|
|
1164
|
+
React$1.useEffect(function () {
|
|
1548
1165
|
sheet.add(styles);
|
|
1549
1166
|
return function () {
|
|
1550
1167
|
sheet.remove();
|
|
@@ -1625,8 +1242,8 @@ var RemoveScrollBar = function (props) {
|
|
|
1625
1242
|
however it will be used only by the "first" invocation
|
|
1626
1243
|
due to singleton nature of <Style
|
|
1627
1244
|
*/
|
|
1628
|
-
var gap = React$
|
|
1629
|
-
return React$
|
|
1245
|
+
var gap = React$1.useMemo(function () { return getGapWidth(gapMode); }, [gapMode]);
|
|
1246
|
+
return React$1.createElement(Style, { styles: getStyles(gap, !noRelative, gapMode, !noImportant ? '!important' : '') });
|
|
1630
1247
|
};
|
|
1631
1248
|
|
|
1632
1249
|
var passiveSupported = false;
|
|
@@ -1758,16 +1375,16 @@ var generateStyle = function (id) { return "\n .block-interactivity-".concat(id
|
|
|
1758
1375
|
var idCounter = 0;
|
|
1759
1376
|
var lockStack = [];
|
|
1760
1377
|
function RemoveScrollSideCar(props) {
|
|
1761
|
-
var shouldPreventQueue = React$
|
|
1762
|
-
var touchStartRef = React$
|
|
1763
|
-
var activeAxis = React$
|
|
1764
|
-
var id = React$
|
|
1765
|
-
var Style = React$
|
|
1766
|
-
var lastProps = React$
|
|
1767
|
-
React$
|
|
1378
|
+
var shouldPreventQueue = React$1.useRef([]);
|
|
1379
|
+
var touchStartRef = React$1.useRef([0, 0]);
|
|
1380
|
+
var activeAxis = React$1.useRef();
|
|
1381
|
+
var id = React$1.useState(idCounter++)[0];
|
|
1382
|
+
var Style = React$1.useState(function () { return styleSingleton(); })[0];
|
|
1383
|
+
var lastProps = React$1.useRef(props);
|
|
1384
|
+
React$1.useEffect(function () {
|
|
1768
1385
|
lastProps.current = props;
|
|
1769
1386
|
}, [props]);
|
|
1770
|
-
React$
|
|
1387
|
+
React$1.useEffect(function () {
|
|
1771
1388
|
if (props.inert) {
|
|
1772
1389
|
document.body.classList.add("block-interactivity-".concat(id));
|
|
1773
1390
|
var allow_1 = __spreadArray([props.lockRef.current], (props.shards || []).map(extractRef), true).filter(Boolean);
|
|
@@ -1779,7 +1396,7 @@ function RemoveScrollSideCar(props) {
|
|
|
1779
1396
|
}
|
|
1780
1397
|
return;
|
|
1781
1398
|
}, [props.inert, props.lockRef.current, props.shards]);
|
|
1782
|
-
var shouldCancelEvent = React$
|
|
1399
|
+
var shouldCancelEvent = React$1.useCallback(function (event, parent) {
|
|
1783
1400
|
if ('touches' in event && event.touches.length === 2) {
|
|
1784
1401
|
return !lastProps.current.allowPinchZoom;
|
|
1785
1402
|
}
|
|
@@ -1818,7 +1435,7 @@ function RemoveScrollSideCar(props) {
|
|
|
1818
1435
|
var cancelingAxis = activeAxis.current || currentAxis;
|
|
1819
1436
|
return handleScroll(cancelingAxis, parent, event, cancelingAxis === 'h' ? deltaX : deltaY, true);
|
|
1820
1437
|
}, []);
|
|
1821
|
-
var shouldPrevent = React$
|
|
1438
|
+
var shouldPrevent = React$1.useCallback(function (_event) {
|
|
1822
1439
|
var event = _event;
|
|
1823
1440
|
if (!lockStack.length || lockStack[lockStack.length - 1] !== Style) {
|
|
1824
1441
|
// not the last active
|
|
@@ -1847,24 +1464,24 @@ function RemoveScrollSideCar(props) {
|
|
|
1847
1464
|
}
|
|
1848
1465
|
}
|
|
1849
1466
|
}, []);
|
|
1850
|
-
var shouldCancel = React$
|
|
1467
|
+
var shouldCancel = React$1.useCallback(function (name, delta, target, should) {
|
|
1851
1468
|
var event = { name: name, delta: delta, target: target, should: should };
|
|
1852
1469
|
shouldPreventQueue.current.push(event);
|
|
1853
1470
|
setTimeout(function () {
|
|
1854
1471
|
shouldPreventQueue.current = shouldPreventQueue.current.filter(function (e) { return e !== event; });
|
|
1855
1472
|
}, 1);
|
|
1856
1473
|
}, []);
|
|
1857
|
-
var scrollTouchStart = React$
|
|
1474
|
+
var scrollTouchStart = React$1.useCallback(function (event) {
|
|
1858
1475
|
touchStartRef.current = getTouchXY(event);
|
|
1859
1476
|
activeAxis.current = undefined;
|
|
1860
1477
|
}, []);
|
|
1861
|
-
var scrollWheel = React$
|
|
1478
|
+
var scrollWheel = React$1.useCallback(function (event) {
|
|
1862
1479
|
shouldCancel(event.type, getDeltaXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
1863
1480
|
}, []);
|
|
1864
|
-
var scrollTouchMove = React$
|
|
1481
|
+
var scrollTouchMove = React$1.useCallback(function (event) {
|
|
1865
1482
|
shouldCancel(event.type, getTouchXY(event), event.target, shouldCancelEvent(event, props.lockRef.current));
|
|
1866
1483
|
}, []);
|
|
1867
|
-
React$
|
|
1484
|
+
React$1.useEffect(function () {
|
|
1868
1485
|
lockStack.push(Style);
|
|
1869
1486
|
props.setCallbacks({
|
|
1870
1487
|
onScrollCapture: scrollWheel,
|
|
@@ -1882,14 +1499,14 @@ function RemoveScrollSideCar(props) {
|
|
|
1882
1499
|
};
|
|
1883
1500
|
}, []);
|
|
1884
1501
|
var removeScrollBar = props.removeScrollBar, inert = props.inert;
|
|
1885
|
-
return (React$
|
|
1886
|
-
inert ? React$
|
|
1887
|
-
removeScrollBar ? React$
|
|
1502
|
+
return (React$1.createElement(React$1.Fragment, null,
|
|
1503
|
+
inert ? React$1.createElement(Style, { styles: generateStyle(id) }) : null,
|
|
1504
|
+
removeScrollBar ? React$1.createElement(RemoveScrollBar, { gapMode: "margin" }) : null));
|
|
1888
1505
|
}
|
|
1889
1506
|
|
|
1890
1507
|
var SideCar = exportSidecar(effectCar, RemoveScrollSideCar);
|
|
1891
1508
|
|
|
1892
|
-
var ReactRemoveScroll = React$
|
|
1509
|
+
var ReactRemoveScroll = React$1.forwardRef(function (props, ref) { return (React$1.createElement(RemoveScroll, __assign$1({}, props, { ref: ref, sideCar: SideCar }))); });
|
|
1893
1510
|
ReactRemoveScroll.classNames = RemoveScroll.classNames;
|
|
1894
1511
|
var $01b9c$RemoveScroll = ReactRemoveScroll;
|
|
1895
1512
|
|
|
@@ -2900,28 +2517,8 @@ const $cc7e05a45900e73f$export$c3468e2714d175fa = $cc7e05a45900e73f$export$6b919
|
|
|
2900
2517
|
const $cc7e05a45900e73f$export$2f60d3ec9ad468f2 = $cc7e05a45900e73f$export$d8117927658af6d7;
|
|
2901
2518
|
const $cc7e05a45900e73f$export$bf1aedc3039c8d63 = $cc7e05a45900e73f$export$ff951e476c12189;
|
|
2902
2519
|
|
|
2903
|
-
const React$1 = React__default;
|
|
2904
|
-
const BtIconChevronUp2Px = props =>
|
|
2905
|
-
/*#__PURE__*/ React$1.createElement(
|
|
2906
|
-
"svg",
|
|
2907
|
-
Object.assign(
|
|
2908
|
-
{
|
|
2909
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
2910
|
-
viewBox: "0 0 32 32"
|
|
2911
|
-
},
|
|
2912
|
-
props
|
|
2913
|
-
),
|
|
2914
|
-
/*#__PURE__*/ React$1.createElement("defs", null),
|
|
2915
|
-
/*#__PURE__*/ React$1.createElement("path", {
|
|
2916
|
-
d:
|
|
2917
|
-
"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",
|
|
2918
|
-
fill: "currentColor"
|
|
2919
|
-
})
|
|
2920
|
-
);
|
|
2921
|
-
var BtIconChevronUp2Px_2 = BtIconChevronUp2Px;
|
|
2922
|
-
|
|
2923
2520
|
const React = React__default;
|
|
2924
|
-
const
|
|
2521
|
+
const BtIconChevronUp2Px = props =>
|
|
2925
2522
|
/*#__PURE__*/ React.createElement(
|
|
2926
2523
|
"svg",
|
|
2927
2524
|
Object.assign(
|
|
@@ -2934,11 +2531,11 @@ const BtIconTickAlt2Px = props =>
|
|
|
2934
2531
|
/*#__PURE__*/ React.createElement("defs", null),
|
|
2935
2532
|
/*#__PURE__*/ React.createElement("path", {
|
|
2936
2533
|
d:
|
|
2937
|
-
"
|
|
2534
|
+
"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",
|
|
2938
2535
|
fill: "currentColor"
|
|
2939
2536
|
})
|
|
2940
2537
|
);
|
|
2941
|
-
var
|
|
2538
|
+
var BtIconChevronUp2Px_2 = BtIconChevronUp2Px;
|
|
2942
2539
|
|
|
2943
2540
|
/** Use `Select` to choose from a dropdown list of options. */
|
|
2944
2541
|
var Select = function (_a) {
|
|
@@ -2951,6 +2548,10 @@ var Select = function (_a) {
|
|
|
2951
2548
|
onChange && onChange(value);
|
|
2952
2549
|
setSelectedValue(value);
|
|
2953
2550
|
};
|
|
2551
|
+
var getSelectedValueName = function (value) {
|
|
2552
|
+
var _a;
|
|
2553
|
+
return (_a = options.find(function (option) { return option.value === value; })) === null || _a === void 0 ? void 0 : _a.name;
|
|
2554
|
+
};
|
|
2954
2555
|
return (React__default.createElement(FormControl, { errorMessage: errorMessage, helper: helper, htmlFor: id, label: label, labelSize: labelSize, requirementStatus: isRequired ? "required" : "optional", isDisabled: isDisabled, disclosureText: disclosureText, disclosureTitle: disclosureTitle, onClickDisclosure: onClickDisclosure },
|
|
2955
2556
|
React__default.createElement($cc7e05a45900e73f$export$be92b6f5f03c0fe9, { name: name, required: isRequired, disabled: isDisabled, defaultOpen: isDefaultOpen, value: selectedValue, onOpenChange: onOpenChange, onValueChange: function (value) { return onValueChange(value); } },
|
|
2956
2557
|
React__default.createElement($cc7e05a45900e73f$export$41fb9f06171c75f4, { id: id, name: name, onBlur: onBlur, className: classNames("arc-Select-trigger", {
|
|
@@ -2958,7 +2559,7 @@ var Select = function (_a) {
|
|
|
2958
2559
|
"arc-Select-trigger--onDarkSurface": surface === "dark",
|
|
2959
2560
|
"arc-Select-trigger--invalid": errorMessage
|
|
2960
2561
|
}) },
|
|
2961
|
-
React__default.createElement($cc7e05a45900e73f$export$4c8d1a57a761ef94, { asChild: true, "aria-label": selectedValue }, !selectedValue ? (React__default.createElement("span", { "aria-hidden": true, className: "arc-Select-placeHolder" }, placeholder)) : (React__default.createElement("span", { className: "arc-Select-valueItem" }, selectedValue))),
|
|
2562
|
+
React__default.createElement($cc7e05a45900e73f$export$4c8d1a57a761ef94, { asChild: true, "aria-label": getSelectedValueName(selectedValue) }, !selectedValue ? (React__default.createElement("span", { "aria-hidden": true, className: "arc-Select-placeHolder" }, placeholder)) : (React__default.createElement("span", { className: "arc-Select-valueItem" }, getSelectedValueName(selectedValue)))),
|
|
2962
2563
|
React__default.createElement($cc7e05a45900e73f$export$f04a61298a47a40f, { className: "arc-Select-triggerIcon" },
|
|
2963
2564
|
React__default.createElement(Icon, { icon: BtIconChevronDown2Px_2, size: 20 }))),
|
|
2964
2565
|
React__default.createElement($cc7e05a45900e73f$export$602eac185826482c, { container: arcRootElement },
|