@raystack/apsara 0.10.5 → 0.10.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +221 -129
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +350 -258
- package/dist/index.js.map +1 -1
- package/dist/table/datatable.d.ts +3 -2
- package/dist/table/datatable.d.ts.map +1 -1
- package/dist/themprovider/index.d.ts +1 -1
- package/dist/themprovider/index.d.ts.map +1 -1
- package/dist/themprovider/theme.d.ts +5 -0
- package/dist/themprovider/theme.d.ts.map +1 -0
- package/dist/themprovider/types.d.ts +43 -0
- package/dist/themprovider/types.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import React__default, { createContext
|
|
2
|
+
import React__default, { createContext, useMemo, createElement, useContext, useRef, useEffect, useLayoutEffect, useCallback, forwardRef, Children, isValidElement, cloneElement, Fragment, useState, useReducer, memo as memo$1 } from 'react';
|
|
3
3
|
import * as $7SXl2$reactdom from 'react-dom';
|
|
4
4
|
import $7SXl2$reactdom__default, { flushSync, createPortal } from 'react-dom';
|
|
5
5
|
|
|
@@ -1383,7 +1383,7 @@ function _extends() {
|
|
|
1383
1383
|
/* -----------------------------------------------------------------------------------------------
|
|
1384
1384
|
* createContext
|
|
1385
1385
|
* ---------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$export$fd42f52fd3ae1109(rootComponentName, defaultContext) {
|
|
1386
|
-
const BaseContext = /*#__PURE__*/ createContext
|
|
1386
|
+
const BaseContext = /*#__PURE__*/ createContext(defaultContext);
|
|
1387
1387
|
const index = defaultContexts.length;
|
|
1388
1388
|
defaultContexts = [
|
|
1389
1389
|
...defaultContexts,
|
|
@@ -1416,7 +1416,7 @@ function _extends() {
|
|
|
1416
1416
|
* createScope
|
|
1417
1417
|
* ---------------------------------------------------------------------------------------------*/ const createScope = ()=>{
|
|
1418
1418
|
const scopeContexts = defaultContexts.map((defaultContext)=>{
|
|
1419
|
-
return /*#__PURE__*/ createContext
|
|
1419
|
+
return /*#__PURE__*/ createContext(defaultContext);
|
|
1420
1420
|
});
|
|
1421
1421
|
return function useScope(scope) {
|
|
1422
1422
|
const contexts = (scope === null || scope === void 0 ? void 0 : scope[scopeName]) || scopeContexts;
|
|
@@ -1478,7 +1478,7 @@ function _extends() {
|
|
|
1478
1478
|
* prop or avoid re-executing effects when passed as a dependency
|
|
1479
1479
|
*/ function $b1b2314f5f9a1d84$export$25bec8c6f54ee79a$1(callback) {
|
|
1480
1480
|
const callbackRef = useRef(callback);
|
|
1481
|
-
useEffect
|
|
1481
|
+
useEffect(()=>{
|
|
1482
1482
|
callbackRef.current = callback;
|
|
1483
1483
|
}); // https://github.com/facebook/react/issues/19240
|
|
1484
1484
|
return useMemo(()=>(...args)=>{
|
|
@@ -1621,7 +1621,7 @@ const $8927f6f2acc4f386$var$NODES$1 = [
|
|
|
1621
1621
|
const Node = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
1622
1622
|
const { asChild: asChild , ...primitiveProps } = props;
|
|
1623
1623
|
const Comp = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360$1 : node;
|
|
1624
|
-
useEffect
|
|
1624
|
+
useEffect(()=>{
|
|
1625
1625
|
window[Symbol.for('radix-ui')] = true;
|
|
1626
1626
|
}, []);
|
|
1627
1627
|
return /*#__PURE__*/ createElement(Comp, _extends({}, primitiveProps, {
|
|
@@ -1683,7 +1683,7 @@ const [$cddcb0b647441e34$var$createAvatarContext, $cddcb0b647441e34$export$90370
|
|
|
1683
1683
|
const [$cddcb0b647441e34$var$AvatarProvider, $cddcb0b647441e34$var$useAvatarContext] = $cddcb0b647441e34$var$createAvatarContext($cddcb0b647441e34$var$AVATAR_NAME);
|
|
1684
1684
|
const $cddcb0b647441e34$export$e2255cf6045e8d47 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
1685
1685
|
const { __scopeAvatar: __scopeAvatar , ...avatarProps } = props;
|
|
1686
|
-
const [imageLoadingStatus, setImageLoadingStatus] = useState
|
|
1686
|
+
const [imageLoadingStatus, setImageLoadingStatus] = useState('idle');
|
|
1687
1687
|
return /*#__PURE__*/ createElement($cddcb0b647441e34$var$AvatarProvider, {
|
|
1688
1688
|
scope: __scopeAvatar,
|
|
1689
1689
|
imageLoadingStatus: imageLoadingStatus,
|
|
@@ -1720,8 +1720,8 @@ const $cddcb0b647441e34$export$2cd8ae1985206fe8 = /*#__PURE__*/ forwardRef((prop
|
|
|
1720
1720
|
const $cddcb0b647441e34$export$69fffb6a9571fbfe = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
1721
1721
|
const { __scopeAvatar: __scopeAvatar , delayMs: delayMs , ...fallbackProps } = props;
|
|
1722
1722
|
const context = $cddcb0b647441e34$var$useAvatarContext($cddcb0b647441e34$var$FALLBACK_NAME, __scopeAvatar);
|
|
1723
|
-
const [canRender, setCanRender] = useState
|
|
1724
|
-
useEffect
|
|
1723
|
+
const [canRender, setCanRender] = useState(delayMs === undefined);
|
|
1724
|
+
useEffect(()=>{
|
|
1725
1725
|
if (delayMs !== undefined) {
|
|
1726
1726
|
const timerId = window.setTimeout(()=>setCanRender(true)
|
|
1727
1727
|
, delayMs);
|
|
@@ -1736,8 +1736,8 @@ const $cddcb0b647441e34$export$69fffb6a9571fbfe = /*#__PURE__*/ forwardRef((prop
|
|
|
1736
1736
|
})) : null;
|
|
1737
1737
|
});
|
|
1738
1738
|
/* -----------------------------------------------------------------------------------------------*/ function $cddcb0b647441e34$var$useImageLoadingStatus(src) {
|
|
1739
|
-
const [loadingStatus, setLoadingStatus] = useState
|
|
1740
|
-
useEffect
|
|
1739
|
+
const [loadingStatus, setLoadingStatus] = useState('idle');
|
|
1740
|
+
useEffect(()=>{
|
|
1741
1741
|
if (!src) {
|
|
1742
1742
|
setLoadingStatus('error');
|
|
1743
1743
|
return;
|
|
@@ -1953,11 +1953,11 @@ function $71cd76cc60e0454e$export$6f32135080cb4c3$1({ prop: prop , defaultProp:
|
|
|
1953
1953
|
];
|
|
1954
1954
|
}
|
|
1955
1955
|
function $71cd76cc60e0454e$var$useUncontrolledState$1({ defaultProp: defaultProp , onChange: onChange }) {
|
|
1956
|
-
const uncontrolledState = useState
|
|
1956
|
+
const uncontrolledState = useState(defaultProp);
|
|
1957
1957
|
const [value] = uncontrolledState;
|
|
1958
1958
|
const prevValueRef = useRef(value);
|
|
1959
1959
|
const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a$1(onChange);
|
|
1960
|
-
useEffect
|
|
1960
|
+
useEffect(()=>{
|
|
1961
1961
|
if (prevValueRef.current !== value) {
|
|
1962
1962
|
handleChange(value);
|
|
1963
1963
|
prevValueRef.current = value;
|
|
@@ -1989,7 +1989,7 @@ function $010c2913dbd2fe3d$export$5cae361ad82dce8b(value) {
|
|
|
1989
1989
|
}
|
|
1990
1990
|
|
|
1991
1991
|
function $db6c3485150b8e66$export$1ab7ae714698c4b8(element) {
|
|
1992
|
-
const [size, setSize] = useState
|
|
1992
|
+
const [size, setSize] = useState(undefined);
|
|
1993
1993
|
$9f79659886946c16$export$e5c5a5f917a5871c$1(()=>{
|
|
1994
1994
|
if (element) {
|
|
1995
1995
|
// provide size as early as possible
|
|
@@ -2059,7 +2059,7 @@ $921a889cee6df7e8$export$99c2b779aa4e8b8b$1.displayName = 'Presence';
|
|
|
2059
2059
|
/* -------------------------------------------------------------------------------------------------
|
|
2060
2060
|
* usePresence
|
|
2061
2061
|
* -----------------------------------------------------------------------------------------------*/ function $921a889cee6df7e8$var$usePresence$1(present) {
|
|
2062
|
-
const [node1, setNode] = useState
|
|
2062
|
+
const [node1, setNode] = useState();
|
|
2063
2063
|
const stylesRef = useRef({});
|
|
2064
2064
|
const prevPresentRef = useRef(present);
|
|
2065
2065
|
const prevAnimationNameRef = useRef('none');
|
|
@@ -2077,7 +2077,7 @@ $921a889cee6df7e8$export$99c2b779aa4e8b8b$1.displayName = 'Presence';
|
|
|
2077
2077
|
MOUNT: 'mounted'
|
|
2078
2078
|
}
|
|
2079
2079
|
});
|
|
2080
|
-
useEffect
|
|
2080
|
+
useEffect(()=>{
|
|
2081
2081
|
const currentAnimationName = $921a889cee6df7e8$var$getAnimationName$1(stylesRef.current);
|
|
2082
2082
|
prevAnimationNameRef.current = state === 'mounted' ? currentAnimationName : 'none';
|
|
2083
2083
|
}, [
|
|
@@ -2166,7 +2166,7 @@ const [$e698a72e93240346$var$createCheckboxContext, $e698a72e93240346$export$b56
|
|
|
2166
2166
|
const [$e698a72e93240346$var$CheckboxProvider, $e698a72e93240346$var$useCheckboxContext] = $e698a72e93240346$var$createCheckboxContext($e698a72e93240346$var$CHECKBOX_NAME);
|
|
2167
2167
|
const $e698a72e93240346$export$48513f6b9f8ce62d = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
2168
2168
|
const { __scopeCheckbox: __scopeCheckbox , name: name , checked: checkedProp , defaultChecked: defaultChecked , required: required , disabled: disabled , value: value = 'on' , onCheckedChange: onCheckedChange , ...checkboxProps } = props;
|
|
2169
|
-
const [button, setButton] = useState
|
|
2169
|
+
const [button, setButton] = useState(null);
|
|
2170
2170
|
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, (node)=>setButton(node)
|
|
2171
2171
|
);
|
|
2172
2172
|
const hasConsumerStoppedPropagationRef = useRef(false); // We set this to true by default so that events bubble to forms without JS (SSR)
|
|
@@ -2177,7 +2177,7 @@ const $e698a72e93240346$export$48513f6b9f8ce62d = /*#__PURE__*/ forwardRef((prop
|
|
|
2177
2177
|
onChange: onCheckedChange
|
|
2178
2178
|
});
|
|
2179
2179
|
const initialCheckedStateRef = useRef(checked);
|
|
2180
|
-
useEffect
|
|
2180
|
+
useEffect(()=>{
|
|
2181
2181
|
const form = button === null || button === void 0 ? void 0 : button.form;
|
|
2182
2182
|
if (form) {
|
|
2183
2183
|
const reset = ()=>setChecked(initialCheckedStateRef.current)
|
|
@@ -2257,7 +2257,7 @@ const $e698a72e93240346$export$59aad738f51d1c05 = /*#__PURE__*/ forwardRef((prop
|
|
|
2257
2257
|
const ref = useRef(null);
|
|
2258
2258
|
const prevChecked = $010c2913dbd2fe3d$export$5cae361ad82dce8b(checked);
|
|
2259
2259
|
const controlSize = $db6c3485150b8e66$export$1ab7ae714698c4b8(control); // Bubble checked change to parents (e.g form change event)
|
|
2260
|
-
useEffect
|
|
2260
|
+
useEffect(()=>{
|
|
2261
2261
|
const input = ref.current;
|
|
2262
2262
|
const inputProto = window.HTMLInputElement.prototype;
|
|
2263
2263
|
const descriptor = Object.getOwnPropertyDescriptor(inputProto, 'checked');
|
|
@@ -2678,7 +2678,7 @@ function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEven
|
|
|
2678
2678
|
/* -----------------------------------------------------------------------------------------------
|
|
2679
2679
|
* createContext
|
|
2680
2680
|
* ---------------------------------------------------------------------------------------------*/ function $c512c27ab02ef895$export$fd42f52fd3ae1109(rootComponentName, defaultContext) {
|
|
2681
|
-
const BaseContext = /*#__PURE__*/ createContext
|
|
2681
|
+
const BaseContext = /*#__PURE__*/ createContext(defaultContext);
|
|
2682
2682
|
const index = defaultContexts.length;
|
|
2683
2683
|
defaultContexts = [
|
|
2684
2684
|
...defaultContexts,
|
|
@@ -2711,7 +2711,7 @@ function $e42e1063c40fb3ef$export$b9ecd428b558ff10(originalEventHandler, ourEven
|
|
|
2711
2711
|
* createScope
|
|
2712
2712
|
* ---------------------------------------------------------------------------------------------*/ const createScope = ()=>{
|
|
2713
2713
|
const scopeContexts = defaultContexts.map((defaultContext)=>{
|
|
2714
|
-
return /*#__PURE__*/ createContext
|
|
2714
|
+
return /*#__PURE__*/ createContext(defaultContext);
|
|
2715
2715
|
});
|
|
2716
2716
|
return function useScope(scope) {
|
|
2717
2717
|
const contexts = (scope === null || scope === void 0 ? void 0 : scope[scopeName]) || scopeContexts;
|
|
@@ -2795,7 +2795,7 @@ function $1746a345f3d73bb7$export$f680877a34711e37$1(deterministicId) {
|
|
|
2795
2795
|
* prop or avoid re-executing effects when passed as a dependency
|
|
2796
2796
|
*/ function $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(callback) {
|
|
2797
2797
|
const callbackRef = useRef(callback);
|
|
2798
|
-
useEffect
|
|
2798
|
+
useEffect(()=>{
|
|
2799
2799
|
callbackRef.current = callback;
|
|
2800
2800
|
}); // https://github.com/facebook/react/issues/19240
|
|
2801
2801
|
return useMemo(()=>(...args)=>{
|
|
@@ -2831,11 +2831,11 @@ function $71cd76cc60e0454e$export$6f32135080cb4c3({ prop: prop , defaultProp: de
|
|
|
2831
2831
|
];
|
|
2832
2832
|
}
|
|
2833
2833
|
function $71cd76cc60e0454e$var$useUncontrolledState({ defaultProp: defaultProp , onChange: onChange }) {
|
|
2834
|
-
const uncontrolledState = useState
|
|
2834
|
+
const uncontrolledState = useState(defaultProp);
|
|
2835
2835
|
const [value] = uncontrolledState;
|
|
2836
2836
|
const prevValueRef = useRef(value);
|
|
2837
2837
|
const handleChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onChange);
|
|
2838
|
-
useEffect
|
|
2838
|
+
useEffect(()=>{
|
|
2839
2839
|
if (prevValueRef.current !== value) {
|
|
2840
2840
|
handleChange(value);
|
|
2841
2841
|
prevValueRef.current = value;
|
|
@@ -2944,7 +2944,7 @@ const $8927f6f2acc4f386$var$NODES = [
|
|
|
2944
2944
|
const Node = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
2945
2945
|
const { asChild: asChild , ...primitiveProps } = props;
|
|
2946
2946
|
const Comp = asChild ? $5e63c961fc1ce211$export$8c6ed5c666ac1360 : node;
|
|
2947
|
-
useEffect
|
|
2947
|
+
useEffect(()=>{
|
|
2948
2948
|
window[Symbol.for('radix-ui')] = true;
|
|
2949
2949
|
}, []);
|
|
2950
2950
|
return /*#__PURE__*/ createElement(Comp, _extends({}, primitiveProps, {
|
|
@@ -3003,7 +3003,7 @@ const $8927f6f2acc4f386$var$NODES = [
|
|
|
3003
3003
|
* Listens for when the escape key is down
|
|
3004
3004
|
*/ function $addc16e1bbe58fd0$export$3a72a57244d6e765$1(onEscapeKeyDownProp) {
|
|
3005
3005
|
const onEscapeKeyDown = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onEscapeKeyDownProp);
|
|
3006
|
-
useEffect
|
|
3006
|
+
useEffect(()=>{
|
|
3007
3007
|
const handleKeyDown = (event)=>{
|
|
3008
3008
|
if (event.key === 'Escape') onEscapeKeyDown(event);
|
|
3009
3009
|
};
|
|
@@ -3019,7 +3019,7 @@ const $5cb92bef7577960e$var$CONTEXT_UPDATE$1 = 'dismissableLayer.update';
|
|
|
3019
3019
|
const $5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE$1 = 'dismissableLayer.pointerDownOutside';
|
|
3020
3020
|
const $5cb92bef7577960e$var$FOCUS_OUTSIDE$1 = 'dismissableLayer.focusOutside';
|
|
3021
3021
|
let $5cb92bef7577960e$var$originalBodyPointerEvents$1;
|
|
3022
|
-
const $5cb92bef7577960e$var$DismissableLayerContext$1 = /*#__PURE__*/ createContext
|
|
3022
|
+
const $5cb92bef7577960e$var$DismissableLayerContext$1 = /*#__PURE__*/ createContext({
|
|
3023
3023
|
layers: new Set(),
|
|
3024
3024
|
layersWithOutsidePointerEventsDisabled: new Set(),
|
|
3025
3025
|
branches: new Set()
|
|
@@ -3027,8 +3027,8 @@ const $5cb92bef7577960e$var$DismissableLayerContext$1 = /*#__PURE__*/ createCont
|
|
|
3027
3027
|
const $5cb92bef7577960e$export$177fb62ff3ec1f22$1 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
3028
3028
|
const { disableOutsidePointerEvents: disableOutsidePointerEvents = false , onEscapeKeyDown: onEscapeKeyDown , onPointerDownOutside: onPointerDownOutside , onFocusOutside: onFocusOutside , onInteractOutside: onInteractOutside , onDismiss: onDismiss , ...layerProps } = props;
|
|
3029
3029
|
const context = useContext($5cb92bef7577960e$var$DismissableLayerContext$1);
|
|
3030
|
-
const [node1, setNode] = useState
|
|
3031
|
-
const [, force] = useState
|
|
3030
|
+
const [node1, setNode] = useState(null);
|
|
3031
|
+
const [, force] = useState({});
|
|
3032
3032
|
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, (node)=>setNode(node)
|
|
3033
3033
|
);
|
|
3034
3034
|
const layers = Array.from(context.layers);
|
|
@@ -3070,7 +3070,7 @@ const $5cb92bef7577960e$export$177fb62ff3ec1f22$1 = /*#__PURE__*/ forwardRef((pr
|
|
|
3070
3070
|
onDismiss();
|
|
3071
3071
|
}
|
|
3072
3072
|
});
|
|
3073
|
-
useEffect
|
|
3073
|
+
useEffect(()=>{
|
|
3074
3074
|
if (!node1) return;
|
|
3075
3075
|
if (disableOutsidePointerEvents) {
|
|
3076
3076
|
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
@@ -3094,7 +3094,7 @@ const $5cb92bef7577960e$export$177fb62ff3ec1f22$1 = /*#__PURE__*/ forwardRef((pr
|
|
|
3094
3094
|
* because a change to `disableOutsidePointerEvents` would remove this layer from the stack
|
|
3095
3095
|
* and add it to the end again so the layering order wouldn't be _creation order_.
|
|
3096
3096
|
* We only want them to be removed from context stacks when unmounted.
|
|
3097
|
-
*/ useEffect
|
|
3097
|
+
*/ useEffect(()=>{
|
|
3098
3098
|
return ()=>{
|
|
3099
3099
|
if (!node1) return;
|
|
3100
3100
|
context.layers.delete(node1);
|
|
@@ -3105,7 +3105,7 @@ const $5cb92bef7577960e$export$177fb62ff3ec1f22$1 = /*#__PURE__*/ forwardRef((pr
|
|
|
3105
3105
|
node1,
|
|
3106
3106
|
context
|
|
3107
3107
|
]);
|
|
3108
|
-
useEffect
|
|
3108
|
+
useEffect(()=>{
|
|
3109
3109
|
const handleUpdate = ()=>force({})
|
|
3110
3110
|
;
|
|
3111
3111
|
document.addEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE$1, handleUpdate);
|
|
@@ -3131,7 +3131,7 @@ const $5cb92bef7577960e$export$177fb62ff3ec1f22$1 = /*#__PURE__*/ forwardRef((pr
|
|
|
3131
3131
|
const handlePointerDownOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onPointerDownOutside);
|
|
3132
3132
|
const isPointerInsideReactTreeRef = useRef(false);
|
|
3133
3133
|
const handleClickRef = useRef(()=>{});
|
|
3134
|
-
useEffect
|
|
3134
|
+
useEffect(()=>{
|
|
3135
3135
|
const handlePointerDown = (event)=>{
|
|
3136
3136
|
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
3137
3137
|
const eventDetail = {
|
|
@@ -3197,7 +3197,7 @@ const $5cb92bef7577960e$export$177fb62ff3ec1f22$1 = /*#__PURE__*/ forwardRef((pr
|
|
|
3197
3197
|
*/ function $5cb92bef7577960e$var$useFocusOutside$1(onFocusOutside) {
|
|
3198
3198
|
const handleFocusOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onFocusOutside);
|
|
3199
3199
|
const isFocusInsideReactTreeRef = useRef(false);
|
|
3200
|
-
useEffect
|
|
3200
|
+
useEffect(()=>{
|
|
3201
3201
|
const handleFocus = (event)=>{
|
|
3202
3202
|
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
3203
3203
|
const eventDetail = {
|
|
@@ -3246,7 +3246,7 @@ const $d3863c46a17e8a28$var$EVENT_OPTIONS$1 = {
|
|
|
3246
3246
|
};
|
|
3247
3247
|
const $d3863c46a17e8a28$export$20e40289641fbbb6$1 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
3248
3248
|
const { loop: loop = false , trapped: trapped = false , onMountAutoFocus: onMountAutoFocusProp , onUnmountAutoFocus: onUnmountAutoFocusProp , ...scopeProps } = props;
|
|
3249
|
-
const [container1, setContainer] = useState
|
|
3249
|
+
const [container1, setContainer] = useState(null);
|
|
3250
3250
|
const onMountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onMountAutoFocusProp);
|
|
3251
3251
|
const onUnmountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a(onUnmountAutoFocusProp);
|
|
3252
3252
|
const lastFocusedElementRef = useRef(null);
|
|
@@ -3261,7 +3261,7 @@ const $d3863c46a17e8a28$export$20e40289641fbbb6$1 = /*#__PURE__*/ forwardRef((pr
|
|
|
3261
3261
|
this.paused = false;
|
|
3262
3262
|
}
|
|
3263
3263
|
}).current; // Takes care of trapping focus if focus is moved outside programmatically for example
|
|
3264
|
-
useEffect
|
|
3264
|
+
useEffect(()=>{
|
|
3265
3265
|
if (trapped) {
|
|
3266
3266
|
function handleFocusIn(event) {
|
|
3267
3267
|
if (focusScope.paused || !container1) return;
|
|
@@ -3289,7 +3289,7 @@ const $d3863c46a17e8a28$export$20e40289641fbbb6$1 = /*#__PURE__*/ forwardRef((pr
|
|
|
3289
3289
|
container1,
|
|
3290
3290
|
focusScope.paused
|
|
3291
3291
|
]);
|
|
3292
|
-
useEffect
|
|
3292
|
+
useEffect(()=>{
|
|
3293
3293
|
if (container1) {
|
|
3294
3294
|
$d3863c46a17e8a28$var$focusScopesStack$1.add(focusScope);
|
|
3295
3295
|
const previouslyFocusedElement = document.activeElement;
|
|
@@ -3514,7 +3514,7 @@ $921a889cee6df7e8$export$99c2b779aa4e8b8b.displayName = 'Presence';
|
|
|
3514
3514
|
/* -------------------------------------------------------------------------------------------------
|
|
3515
3515
|
* usePresence
|
|
3516
3516
|
* -----------------------------------------------------------------------------------------------*/ function $921a889cee6df7e8$var$usePresence(present) {
|
|
3517
|
-
const [node1, setNode] = useState
|
|
3517
|
+
const [node1, setNode] = useState();
|
|
3518
3518
|
const stylesRef = useRef({});
|
|
3519
3519
|
const prevPresentRef = useRef(present);
|
|
3520
3520
|
const prevAnimationNameRef = useRef('none');
|
|
@@ -3532,7 +3532,7 @@ $921a889cee6df7e8$export$99c2b779aa4e8b8b.displayName = 'Presence';
|
|
|
3532
3532
|
MOUNT: 'mounted'
|
|
3533
3533
|
}
|
|
3534
3534
|
});
|
|
3535
|
-
useEffect
|
|
3535
|
+
useEffect(()=>{
|
|
3536
3536
|
const currentAnimationName = $921a889cee6df7e8$var$getAnimationName(stylesRef.current);
|
|
3537
3537
|
prevAnimationNameRef.current = state === 'mounted' ? currentAnimationName : 'none';
|
|
3538
3538
|
}, [
|
|
@@ -3619,7 +3619,7 @@ $921a889cee6df7e8$export$99c2b779aa4e8b8b.displayName = 'Presence';
|
|
|
3619
3619
|
* Injects a pair of focus guards at the edges of the whole DOM tree
|
|
3620
3620
|
* to ensure `focusin` & `focusout` events can be caught consistently.
|
|
3621
3621
|
*/ function $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c$1() {
|
|
3622
|
-
useEffect
|
|
3622
|
+
useEffect(()=>{
|
|
3623
3623
|
var _edgeGuards$, _edgeGuards$2;
|
|
3624
3624
|
const edgeGuards = document.querySelectorAll('[data-radix-focus-guard]');
|
|
3625
3625
|
document.body.insertAdjacentElement('afterbegin', (_edgeGuards$ = edgeGuards[0]) !== null && _edgeGuards$ !== void 0 ? _edgeGuards$ : $3db38b7d1fb3fe6a$var$createFocusGuard$1());
|
|
@@ -3737,7 +3737,7 @@ function assignRef(ref, value) {
|
|
|
3737
3737
|
* @returns {MutableRefObject}
|
|
3738
3738
|
*/
|
|
3739
3739
|
function useCallbackRef(initialValue, callback) {
|
|
3740
|
-
var ref = useState
|
|
3740
|
+
var ref = useState(function () { return ({
|
|
3741
3741
|
// value
|
|
3742
3742
|
value: initialValue,
|
|
3743
3743
|
// last callback
|
|
@@ -4552,7 +4552,7 @@ const $5d3850c4d0b4e6c7$export$b6d9565de1e068cf$1 = /*#__PURE__*/ forwardRef((pr
|
|
|
4552
4552
|
const context = $5d3850c4d0b4e6c7$var$useDialogContext$1($5d3850c4d0b4e6c7$var$CONTENT_NAME$1, props.__scopeDialog);
|
|
4553
4553
|
const contentRef = useRef(null);
|
|
4554
4554
|
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05(forwardedRef, context.contentRef, contentRef); // aria-hide everything except the content (better supported equivalent to setting aria-modal)
|
|
4555
|
-
useEffect
|
|
4555
|
+
useEffect(()=>{
|
|
4556
4556
|
const content = contentRef.current;
|
|
4557
4557
|
if (content) return hideOthers(content);
|
|
4558
4558
|
}, []);
|
|
@@ -4802,7 +4802,7 @@ function $1746a345f3d73bb7$export$f680877a34711e37(deterministicId) {
|
|
|
4802
4802
|
* Listens for when the escape key is down
|
|
4803
4803
|
*/ function $addc16e1bbe58fd0$export$3a72a57244d6e765(onEscapeKeyDownProp, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
|
|
4804
4804
|
const onEscapeKeyDown = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a$1(onEscapeKeyDownProp);
|
|
4805
|
-
useEffect
|
|
4805
|
+
useEffect(()=>{
|
|
4806
4806
|
const handleKeyDown = (event)=>{
|
|
4807
4807
|
if (event.key === 'Escape') onEscapeKeyDown(event);
|
|
4808
4808
|
};
|
|
@@ -4819,7 +4819,7 @@ const $5cb92bef7577960e$var$CONTEXT_UPDATE = 'dismissableLayer.update';
|
|
|
4819
4819
|
const $5cb92bef7577960e$var$POINTER_DOWN_OUTSIDE = 'dismissableLayer.pointerDownOutside';
|
|
4820
4820
|
const $5cb92bef7577960e$var$FOCUS_OUTSIDE = 'dismissableLayer.focusOutside';
|
|
4821
4821
|
let $5cb92bef7577960e$var$originalBodyPointerEvents;
|
|
4822
|
-
const $5cb92bef7577960e$var$DismissableLayerContext = /*#__PURE__*/ createContext
|
|
4822
|
+
const $5cb92bef7577960e$var$DismissableLayerContext = /*#__PURE__*/ createContext({
|
|
4823
4823
|
layers: new Set(),
|
|
4824
4824
|
layersWithOutsidePointerEventsDisabled: new Set(),
|
|
4825
4825
|
branches: new Set()
|
|
@@ -4828,9 +4828,9 @@ const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ forwardRef((prop
|
|
|
4828
4828
|
var _node$ownerDocument;
|
|
4829
4829
|
const { disableOutsidePointerEvents: disableOutsidePointerEvents = false , onEscapeKeyDown: onEscapeKeyDown , onPointerDownOutside: onPointerDownOutside , onFocusOutside: onFocusOutside , onInteractOutside: onInteractOutside , onDismiss: onDismiss , ...layerProps } = props;
|
|
4830
4830
|
const context = useContext($5cb92bef7577960e$var$DismissableLayerContext);
|
|
4831
|
-
const [node1, setNode] = useState
|
|
4831
|
+
const [node1, setNode] = useState(null);
|
|
4832
4832
|
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;
|
|
4833
|
-
const [, force] = useState
|
|
4833
|
+
const [, force] = useState({});
|
|
4834
4834
|
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, (node)=>setNode(node)
|
|
4835
4835
|
);
|
|
4836
4836
|
const layers = Array.from(context.layers);
|
|
@@ -4872,7 +4872,7 @@ const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ forwardRef((prop
|
|
|
4872
4872
|
onDismiss();
|
|
4873
4873
|
}
|
|
4874
4874
|
}, ownerDocument);
|
|
4875
|
-
useEffect
|
|
4875
|
+
useEffect(()=>{
|
|
4876
4876
|
if (!node1) return;
|
|
4877
4877
|
if (disableOutsidePointerEvents) {
|
|
4878
4878
|
if (context.layersWithOutsidePointerEventsDisabled.size === 0) {
|
|
@@ -4897,7 +4897,7 @@ const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ forwardRef((prop
|
|
|
4897
4897
|
* because a change to `disableOutsidePointerEvents` would remove this layer from the stack
|
|
4898
4898
|
* and add it to the end again so the layering order wouldn't be _creation order_.
|
|
4899
4899
|
* We only want them to be removed from context stacks when unmounted.
|
|
4900
|
-
*/ useEffect
|
|
4900
|
+
*/ useEffect(()=>{
|
|
4901
4901
|
return ()=>{
|
|
4902
4902
|
if (!node1) return;
|
|
4903
4903
|
context.layers.delete(node1);
|
|
@@ -4908,7 +4908,7 @@ const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ forwardRef((prop
|
|
|
4908
4908
|
node1,
|
|
4909
4909
|
context
|
|
4910
4910
|
]);
|
|
4911
|
-
useEffect
|
|
4911
|
+
useEffect(()=>{
|
|
4912
4912
|
const handleUpdate = ()=>force({})
|
|
4913
4913
|
;
|
|
4914
4914
|
document.addEventListener($5cb92bef7577960e$var$CONTEXT_UPDATE, handleUpdate);
|
|
@@ -4934,7 +4934,7 @@ const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ forwardRef((prop
|
|
|
4934
4934
|
const handlePointerDownOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a$1(onPointerDownOutside);
|
|
4935
4935
|
const isPointerInsideReactTreeRef = useRef(false);
|
|
4936
4936
|
const handleClickRef = useRef(()=>{});
|
|
4937
|
-
useEffect
|
|
4937
|
+
useEffect(()=>{
|
|
4938
4938
|
const handlePointerDown = (event)=>{
|
|
4939
4939
|
if (event.target && !isPointerInsideReactTreeRef.current) {
|
|
4940
4940
|
const eventDetail = {
|
|
@@ -5001,7 +5001,7 @@ const $5cb92bef7577960e$export$177fb62ff3ec1f22 = /*#__PURE__*/ forwardRef((prop
|
|
|
5001
5001
|
*/ function $5cb92bef7577960e$var$useFocusOutside(onFocusOutside, ownerDocument = globalThis === null || globalThis === void 0 ? void 0 : globalThis.document) {
|
|
5002
5002
|
const handleFocusOutside = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a$1(onFocusOutside);
|
|
5003
5003
|
const isFocusInsideReactTreeRef = useRef(false);
|
|
5004
|
-
useEffect
|
|
5004
|
+
useEffect(()=>{
|
|
5005
5005
|
const handleFocus = (event)=>{
|
|
5006
5006
|
if (event.target && !isFocusInsideReactTreeRef.current) {
|
|
5007
5007
|
const eventDetail = {
|
|
@@ -5051,7 +5051,7 @@ const $d3863c46a17e8a28$var$EVENT_OPTIONS = {
|
|
|
5051
5051
|
};
|
|
5052
5052
|
const $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
5053
5053
|
const { loop: loop = false , trapped: trapped = false , onMountAutoFocus: onMountAutoFocusProp , onUnmountAutoFocus: onUnmountAutoFocusProp , ...scopeProps } = props;
|
|
5054
|
-
const [container1, setContainer] = useState
|
|
5054
|
+
const [container1, setContainer] = useState(null);
|
|
5055
5055
|
const onMountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a$1(onMountAutoFocusProp);
|
|
5056
5056
|
const onUnmountAutoFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a$1(onUnmountAutoFocusProp);
|
|
5057
5057
|
const lastFocusedElementRef = useRef(null);
|
|
@@ -5066,7 +5066,7 @@ const $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ forwardRef((prop
|
|
|
5066
5066
|
this.paused = false;
|
|
5067
5067
|
}
|
|
5068
5068
|
}).current; // Takes care of trapping focus if focus is moved outside programmatically for example
|
|
5069
|
-
useEffect
|
|
5069
|
+
useEffect(()=>{
|
|
5070
5070
|
if (trapped) {
|
|
5071
5071
|
function handleFocusIn(event) {
|
|
5072
5072
|
if (focusScope.paused || !container1) return;
|
|
@@ -5122,7 +5122,7 @@ const $d3863c46a17e8a28$export$20e40289641fbbb6 = /*#__PURE__*/ forwardRef((prop
|
|
|
5122
5122
|
container1,
|
|
5123
5123
|
focusScope.paused
|
|
5124
5124
|
]);
|
|
5125
|
-
useEffect
|
|
5125
|
+
useEffect(()=>{
|
|
5126
5126
|
if (container1) {
|
|
5127
5127
|
$d3863c46a17e8a28$var$focusScopesStack.add(focusScope);
|
|
5128
5128
|
const previouslyFocusedElement = document.activeElement;
|
|
@@ -5328,7 +5328,7 @@ const $f1701beae083dbae$export$602eac185826482c = /*#__PURE__*/ forwardRef((prop
|
|
|
5328
5328
|
* Injects a pair of focus guards at the edges of the whole DOM tree
|
|
5329
5329
|
* to ensure `focusin` & `focusout` events can be caught consistently.
|
|
5330
5330
|
*/ function $3db38b7d1fb3fe6a$export$b7ece24a22aeda8c() {
|
|
5331
|
-
useEffect
|
|
5331
|
+
useEffect(()=>{
|
|
5332
5332
|
var _edgeGuards$, _edgeGuards$2;
|
|
5333
5333
|
const edgeGuards = document.querySelectorAll('[data-radix-focus-guard]');
|
|
5334
5334
|
document.body.insertAdjacentElement('afterbegin', (_edgeGuards$ = edgeGuards[0]) !== null && _edgeGuards$ !== void 0 ? _edgeGuards$ : $3db38b7d1fb3fe6a$var$createFocusGuard());
|
|
@@ -5769,7 +5769,7 @@ const $5d3850c4d0b4e6c7$export$b6d9565de1e068cf = /*#__PURE__*/ forwardRef((prop
|
|
|
5769
5769
|
const context = $5d3850c4d0b4e6c7$var$useDialogContext($5d3850c4d0b4e6c7$var$CONTENT_NAME, props.__scopeDialog);
|
|
5770
5770
|
const contentRef = useRef(null);
|
|
5771
5771
|
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, context.contentRef, contentRef); // aria-hide everything except the content (better supported equivalent to setting aria-modal)
|
|
5772
|
-
useEffect
|
|
5772
|
+
useEffect(()=>{
|
|
5773
5773
|
const content = contentRef.current;
|
|
5774
5774
|
if (content) return hideOthers(content);
|
|
5775
5775
|
}, []);
|
|
@@ -6092,7 +6092,7 @@ function $e02a7d9cb1dc128c$export$c74125a8e3af6bb2(name) {
|
|
|
6092
6092
|
];
|
|
6093
6093
|
}
|
|
6094
6094
|
|
|
6095
|
-
const $f631663db3294ace$var$DirectionContext = /*#__PURE__*/ createContext
|
|
6095
|
+
const $f631663db3294ace$var$DirectionContext = /*#__PURE__*/ createContext(undefined);
|
|
6096
6096
|
/* -----------------------------------------------------------------------------------------------*/ function $f631663db3294ace$export$b39126d51d94e6f3(localDir) {
|
|
6097
6097
|
const globalDir = useContext($f631663db3294ace$var$DirectionContext);
|
|
6098
6098
|
return localDir || globalDir || 'ltr';
|
|
@@ -7676,7 +7676,7 @@ const arrow = options => {
|
|
|
7676
7676
|
};
|
|
7677
7677
|
};
|
|
7678
7678
|
|
|
7679
|
-
var index = typeof document !== 'undefined' ? useLayoutEffect : useEffect
|
|
7679
|
+
var index = typeof document !== 'undefined' ? useLayoutEffect : useEffect;
|
|
7680
7680
|
|
|
7681
7681
|
// Fork of `fast-deep-equal` that only does the comparisons we need and compares
|
|
7682
7682
|
// functions
|
|
@@ -7905,7 +7905,7 @@ const [$cf1ac5d9fe0e8206$var$createPopperContext, $cf1ac5d9fe0e8206$export$722aa
|
|
|
7905
7905
|
const [$cf1ac5d9fe0e8206$var$PopperProvider, $cf1ac5d9fe0e8206$var$usePopperContext] = $cf1ac5d9fe0e8206$var$createPopperContext($cf1ac5d9fe0e8206$var$POPPER_NAME);
|
|
7906
7906
|
const $cf1ac5d9fe0e8206$export$badac9ada3a0bdf9 = (props)=>{
|
|
7907
7907
|
const { __scopePopper: __scopePopper , children: children } = props;
|
|
7908
|
-
const [anchor, setAnchor] = useState
|
|
7908
|
+
const [anchor, setAnchor] = useState(null);
|
|
7909
7909
|
return /*#__PURE__*/ createElement($cf1ac5d9fe0e8206$var$PopperProvider, {
|
|
7910
7910
|
scope: __scopePopper,
|
|
7911
7911
|
anchor: anchor,
|
|
@@ -7920,7 +7920,7 @@ const $cf1ac5d9fe0e8206$export$ecd4e1ccab6ed6d = /*#__PURE__*/ forwardRef((props
|
|
|
7920
7920
|
const context = $cf1ac5d9fe0e8206$var$usePopperContext($cf1ac5d9fe0e8206$var$ANCHOR_NAME, __scopePopper);
|
|
7921
7921
|
const ref = useRef(null);
|
|
7922
7922
|
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, ref);
|
|
7923
|
-
useEffect
|
|
7923
|
+
useEffect(()=>{
|
|
7924
7924
|
// Consumer can anchor the popper to something that isn't
|
|
7925
7925
|
// a DOM node e.g. pointer position, so we override the
|
|
7926
7926
|
// `anchorRef` with their virtual ref in this case.
|
|
@@ -7938,10 +7938,10 @@ const $cf1ac5d9fe0e8206$export$bc4ae5855d3c4fc = /*#__PURE__*/ forwardRef((props
|
|
|
7938
7938
|
var _arrowSize$width, _arrowSize$height, _middlewareData$arrow, _middlewareData$arrow2, _middlewareData$arrow3, _middlewareData$trans, _middlewareData$trans2, _middlewareData$hide;
|
|
7939
7939
|
const { __scopePopper: __scopePopper , side: side = 'bottom' , sideOffset: sideOffset = 0 , align: align = 'center' , alignOffset: alignOffset = 0 , arrowPadding: arrowPadding = 0 , collisionBoundary: collisionBoundary = [] , collisionPadding: collisionPaddingProp = 0 , sticky: sticky = 'partial' , hideWhenDetached: hideWhenDetached = false , avoidCollisions: avoidCollisions = true , onPlaced: onPlaced , ...contentProps } = props;
|
|
7940
7940
|
const context = $cf1ac5d9fe0e8206$var$usePopperContext($cf1ac5d9fe0e8206$var$CONTENT_NAME, __scopePopper);
|
|
7941
|
-
const [content, setContent] = useState
|
|
7941
|
+
const [content, setContent] = useState(null);
|
|
7942
7942
|
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, (node)=>setContent(node)
|
|
7943
7943
|
);
|
|
7944
|
-
const [arrow$1, setArrow] = useState
|
|
7944
|
+
const [arrow$1, setArrow] = useState(null);
|
|
7945
7945
|
const arrowSize = $db6c3485150b8e66$export$1ab7ae714698c4b8(arrow$1);
|
|
7946
7946
|
const arrowWidth = (_arrowSize$width = arrowSize === null || arrowSize === void 0 ? void 0 : arrowSize.width) !== null && _arrowSize$width !== void 0 ? _arrowSize$width : 0;
|
|
7947
7947
|
const arrowHeight = (_arrowSize$height = arrowSize === null || arrowSize === void 0 ? void 0 : arrowSize.height) !== null && _arrowSize$height !== void 0 ? _arrowSize$height : 0;
|
|
@@ -8020,7 +8020,7 @@ const $cf1ac5d9fe0e8206$export$bc4ae5855d3c4fc = /*#__PURE__*/ forwardRef((props
|
|
|
8020
8020
|
const arrowX = (_middlewareData$arrow = middlewareData.arrow) === null || _middlewareData$arrow === void 0 ? void 0 : _middlewareData$arrow.x;
|
|
8021
8021
|
const arrowY = (_middlewareData$arrow2 = middlewareData.arrow) === null || _middlewareData$arrow2 === void 0 ? void 0 : _middlewareData$arrow2.y;
|
|
8022
8022
|
const cannotCenterArrow = ((_middlewareData$arrow3 = middlewareData.arrow) === null || _middlewareData$arrow3 === void 0 ? void 0 : _middlewareData$arrow3.centerOffset) !== 0;
|
|
8023
|
-
const [contentZIndex, setContentZIndex] = useState
|
|
8023
|
+
const [contentZIndex, setContentZIndex] = useState();
|
|
8024
8024
|
$9f79659886946c16$export$e5c5a5f917a5871c$1(()=>{
|
|
8025
8025
|
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
8026
8026
|
}, [
|
|
@@ -8152,12 +8152,12 @@ const $d7bdfb9eb0fdf311$export$8699f7c8af148338 = /*#__PURE__*/ forwardRef((prop
|
|
|
8152
8152
|
defaultProp: defaultCurrentTabStopId,
|
|
8153
8153
|
onChange: onCurrentTabStopIdChange
|
|
8154
8154
|
});
|
|
8155
|
-
const [isTabbingBackOut, setIsTabbingBackOut] = useState
|
|
8155
|
+
const [isTabbingBackOut, setIsTabbingBackOut] = useState(false);
|
|
8156
8156
|
const handleEntryFocus = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a$1(onEntryFocus);
|
|
8157
8157
|
const getItems = $d7bdfb9eb0fdf311$var$useCollection(__scopeRovingFocusGroup);
|
|
8158
8158
|
const isClickFocusRef = useRef(false);
|
|
8159
|
-
const [focusableItemsCount, setFocusableItemsCount] = useState
|
|
8160
|
-
useEffect
|
|
8159
|
+
const [focusableItemsCount, setFocusableItemsCount] = useState(0);
|
|
8160
|
+
useEffect(()=>{
|
|
8161
8161
|
const node = ref.current;
|
|
8162
8162
|
if (node) {
|
|
8163
8163
|
node.addEventListener($d7bdfb9eb0fdf311$var$ENTRY_FOCUS, handleEntryFocus);
|
|
@@ -8240,7 +8240,7 @@ const $d7bdfb9eb0fdf311$export$ab9df7c53fe8454 = /*#__PURE__*/ forwardRef((props
|
|
|
8240
8240
|
const isCurrentTabStop = context.currentTabStopId === id;
|
|
8241
8241
|
const getItems = $d7bdfb9eb0fdf311$var$useCollection(__scopeRovingFocusGroup);
|
|
8242
8242
|
const { onFocusableItemAdd: onFocusableItemAdd , onFocusableItemRemove: onFocusableItemRemove } = context;
|
|
8243
|
-
useEffect
|
|
8243
|
+
useEffect(()=>{
|
|
8244
8244
|
if (focusable) {
|
|
8245
8245
|
onFocusableItemAdd();
|
|
8246
8246
|
return ()=>onFocusableItemRemove()
|
|
@@ -8377,11 +8377,11 @@ const [$6cc32821e9371a1c$var$MenuRootProvider, $6cc32821e9371a1c$var$useMenuRoot
|
|
|
8377
8377
|
const $6cc32821e9371a1c$export$d9b273488cd8ce6f = (props)=>{
|
|
8378
8378
|
const { __scopeMenu: __scopeMenu , open: open = false , children: children , dir: dir , onOpenChange: onOpenChange , modal: modal = true } = props;
|
|
8379
8379
|
const popperScope = $6cc32821e9371a1c$var$usePopperScope(__scopeMenu);
|
|
8380
|
-
const [content, setContent] = useState
|
|
8380
|
+
const [content, setContent] = useState(null);
|
|
8381
8381
|
const isUsingKeyboardRef = useRef(false);
|
|
8382
8382
|
const handleOpenChange = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a$1(onOpenChange);
|
|
8383
8383
|
const direction = $f631663db3294ace$export$b39126d51d94e6f3(dir);
|
|
8384
|
-
useEffect
|
|
8384
|
+
useEffect(()=>{
|
|
8385
8385
|
// Capture phase ensures we set the boolean before any side effects execute
|
|
8386
8386
|
// in response to the key or pointer event as they might depend on this value.
|
|
8387
8387
|
const handleKeyDown = ()=>{
|
|
@@ -8480,7 +8480,7 @@ const $6cc32821e9371a1c$export$479f0f2f71193efe = /*#__PURE__*/ forwardRef((prop
|
|
|
8480
8480
|
const context = $6cc32821e9371a1c$var$useMenuContext($6cc32821e9371a1c$var$CONTENT_NAME, props.__scopeMenu);
|
|
8481
8481
|
const ref = useRef(null);
|
|
8482
8482
|
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, ref); // Hide everything from ARIA except the `MenuContent`
|
|
8483
|
-
useEffect
|
|
8483
|
+
useEffect(()=>{
|
|
8484
8484
|
const content = ref.current;
|
|
8485
8485
|
if (content) return hideOthers(content);
|
|
8486
8486
|
}, []);
|
|
@@ -8516,7 +8516,7 @@ const $6cc32821e9371a1c$var$MenuRootContentNonModal = /*#__PURE__*/ forwardRef((
|
|
|
8516
8516
|
const popperScope = $6cc32821e9371a1c$var$usePopperScope(__scopeMenu);
|
|
8517
8517
|
const rovingFocusGroupScope = $6cc32821e9371a1c$var$useRovingFocusGroupScope(__scopeMenu);
|
|
8518
8518
|
const getItems = $6cc32821e9371a1c$var$useCollection(__scopeMenu);
|
|
8519
|
-
const [currentItemId, setCurrentItemId] = useState
|
|
8519
|
+
const [currentItemId, setCurrentItemId] = useState(null);
|
|
8520
8520
|
const contentRef = useRef(null);
|
|
8521
8521
|
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, contentRef, context.onContentChange);
|
|
8522
8522
|
const timerRef = useRef(0);
|
|
@@ -8555,7 +8555,7 @@ const $6cc32821e9371a1c$var$MenuRootContentNonModal = /*#__PURE__*/ forwardRef((
|
|
|
8555
8555
|
*/ setTimeout(()=>newItem.focus()
|
|
8556
8556
|
);
|
|
8557
8557
|
};
|
|
8558
|
-
useEffect
|
|
8558
|
+
useEffect(()=>{
|
|
8559
8559
|
return ()=>window.clearTimeout(timerRef.current)
|
|
8560
8560
|
;
|
|
8561
8561
|
}, []); // Make sure the whole tree has focus guards as our `MenuContent` may be
|
|
@@ -8753,9 +8753,9 @@ const $6cc32821e9371a1c$export$2ce376c2cc3355c8 = /*#__PURE__*/ forwardRef((prop
|
|
|
8753
8753
|
const rovingFocusGroupScope = $6cc32821e9371a1c$var$useRovingFocusGroupScope(__scopeMenu);
|
|
8754
8754
|
const ref = useRef(null);
|
|
8755
8755
|
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, ref);
|
|
8756
|
-
const [isFocused, setIsFocused] = useState
|
|
8757
|
-
const [textContent, setTextContent] = useState
|
|
8758
|
-
useEffect
|
|
8756
|
+
const [isFocused, setIsFocused] = useState(false); // get the item's `.textContent` as default strategy for typeahead `textValue`
|
|
8757
|
+
const [textContent, setTextContent] = useState('');
|
|
8758
|
+
useEffect(()=>{
|
|
8759
8759
|
const menuItem = ref.current;
|
|
8760
8760
|
if (menuItem) {
|
|
8761
8761
|
var _menuItem$textContent;
|
|
@@ -9225,7 +9225,7 @@ const $cb5cc270b50c6fcd$export$5b6b19405a83ff9d = (props)=>{
|
|
|
9225
9225
|
const { __scopePopover: __scopePopover , children: children , open: openProp , defaultOpen: defaultOpen , onOpenChange: onOpenChange , modal: modal = false } = props;
|
|
9226
9226
|
const popperScope = $cb5cc270b50c6fcd$var$usePopperScope(__scopePopover);
|
|
9227
9227
|
const triggerRef = useRef(null);
|
|
9228
|
-
const [hasCustomAnchor, setHasCustomAnchor] = useState
|
|
9228
|
+
const [hasCustomAnchor, setHasCustomAnchor] = useState(false);
|
|
9229
9229
|
const [open = false, setOpen] = $71cd76cc60e0454e$export$6f32135080cb4c3$1({
|
|
9230
9230
|
prop: openProp,
|
|
9231
9231
|
defaultProp: defaultOpen,
|
|
@@ -9311,7 +9311,7 @@ const $cb5cc270b50c6fcd$export$d7e1f420b25549ff = /*#__PURE__*/ forwardRef((prop
|
|
|
9311
9311
|
const contentRef = useRef(null);
|
|
9312
9312
|
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, contentRef);
|
|
9313
9313
|
const isRightClickOutsideRef = useRef(false); // aria-hide everything except the content (better supported equivalent to setting aria-modal)
|
|
9314
|
-
useEffect
|
|
9314
|
+
useEffect(()=>{
|
|
9315
9315
|
const content = contentRef.current;
|
|
9316
9316
|
if (content) return hideOthers(content);
|
|
9317
9317
|
}, []);
|
|
@@ -9441,7 +9441,7 @@ const [$ce77a8961b41be9e$var$createRadioContext, $ce77a8961b41be9e$export$67d229
|
|
|
9441
9441
|
const [$ce77a8961b41be9e$var$RadioProvider, $ce77a8961b41be9e$var$useRadioContext] = $ce77a8961b41be9e$var$createRadioContext($ce77a8961b41be9e$var$RADIO_NAME);
|
|
9442
9442
|
const $ce77a8961b41be9e$export$d7b12c4107be0d61 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
9443
9443
|
const { __scopeRadio: __scopeRadio , name: name , checked: checked = false , required: required , disabled: disabled , value: value = 'on' , onCheck: onCheck , ...radioProps } = props;
|
|
9444
|
-
const [button, setButton] = useState
|
|
9444
|
+
const [button, setButton] = useState(null);
|
|
9445
9445
|
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, (node)=>setButton(node)
|
|
9446
9446
|
);
|
|
9447
9447
|
const hasConsumerStoppedPropagationRef = useRef(false); // We set this to true by default so that events bubble to forms without JS (SSR)
|
|
@@ -9504,7 +9504,7 @@ const $ce77a8961b41be9e$export$d35a9ffa9a04f9e7 = /*#__PURE__*/ forwardRef((prop
|
|
|
9504
9504
|
const ref = useRef(null);
|
|
9505
9505
|
const prevChecked = $010c2913dbd2fe3d$export$5cae361ad82dce8b(checked);
|
|
9506
9506
|
const controlSize = $db6c3485150b8e66$export$1ab7ae714698c4b8(control); // Bubble checked change to parents (e.g form change event)
|
|
9507
|
-
useEffect
|
|
9507
|
+
useEffect(()=>{
|
|
9508
9508
|
const input = ref.current;
|
|
9509
9509
|
const inputProto = window.HTMLInputElement.prototype;
|
|
9510
9510
|
const descriptor = Object.getOwnPropertyDescriptor(inputProto, 'checked');
|
|
@@ -9604,7 +9604,7 @@ const $f99a8c78507165f7$export$9f866c100ef519e4 = /*#__PURE__*/ forwardRef((prop
|
|
|
9604
9604
|
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, ref);
|
|
9605
9605
|
const checked = context.value === itemProps.value;
|
|
9606
9606
|
const isArrowKeyPressedRef = useRef(false);
|
|
9607
|
-
useEffect
|
|
9607
|
+
useEffect(()=>{
|
|
9608
9608
|
const handleKeyDown = (event)=>{
|
|
9609
9609
|
if ($f99a8c78507165f7$var$ARROW_KEYS.includes(event.key)) isArrowKeyPressedRef.current = true;
|
|
9610
9610
|
};
|
|
@@ -9698,15 +9698,15 @@ const [$57acba87d6e25586$var$createScrollAreaContext, $57acba87d6e25586$export$4
|
|
|
9698
9698
|
const [$57acba87d6e25586$var$ScrollAreaProvider, $57acba87d6e25586$var$useScrollAreaContext] = $57acba87d6e25586$var$createScrollAreaContext($57acba87d6e25586$var$SCROLL_AREA_NAME);
|
|
9699
9699
|
const $57acba87d6e25586$export$ccf8d8d7bbf3c2cc = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
9700
9700
|
const { __scopeScrollArea: __scopeScrollArea , type: type = 'hover' , dir: dir , scrollHideDelay: scrollHideDelay = 600 , ...scrollAreaProps } = props;
|
|
9701
|
-
const [scrollArea, setScrollArea] = useState
|
|
9702
|
-
const [viewport, setViewport] = useState
|
|
9703
|
-
const [content, setContent] = useState
|
|
9704
|
-
const [scrollbarX, setScrollbarX] = useState
|
|
9705
|
-
const [scrollbarY, setScrollbarY] = useState
|
|
9706
|
-
const [cornerWidth, setCornerWidth] = useState
|
|
9707
|
-
const [cornerHeight, setCornerHeight] = useState
|
|
9708
|
-
const [scrollbarXEnabled, setScrollbarXEnabled] = useState
|
|
9709
|
-
const [scrollbarYEnabled, setScrollbarYEnabled] = useState
|
|
9701
|
+
const [scrollArea, setScrollArea] = useState(null);
|
|
9702
|
+
const [viewport, setViewport] = useState(null);
|
|
9703
|
+
const [content, setContent] = useState(null);
|
|
9704
|
+
const [scrollbarX, setScrollbarX] = useState(null);
|
|
9705
|
+
const [scrollbarY, setScrollbarY] = useState(null);
|
|
9706
|
+
const [cornerWidth, setCornerWidth] = useState(0);
|
|
9707
|
+
const [cornerHeight, setCornerHeight] = useState(0);
|
|
9708
|
+
const [scrollbarXEnabled, setScrollbarXEnabled] = useState(false);
|
|
9709
|
+
const [scrollbarYEnabled, setScrollbarYEnabled] = useState(false);
|
|
9710
9710
|
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, (node)=>setScrollArea(node)
|
|
9711
9711
|
);
|
|
9712
9712
|
const direction = $f631663db3294ace$export$b39126d51d94e6f3(dir);
|
|
@@ -9790,7 +9790,7 @@ const $57acba87d6e25586$export$2fabd85d0eba3c57 = /*#__PURE__*/ forwardRef((prop
|
|
|
9790
9790
|
const context = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$SCROLLBAR_NAME, props.__scopeScrollArea);
|
|
9791
9791
|
const { onScrollbarXEnabledChange: onScrollbarXEnabledChange , onScrollbarYEnabledChange: onScrollbarYEnabledChange } = context;
|
|
9792
9792
|
const isHorizontal = props.orientation === 'horizontal';
|
|
9793
|
-
useEffect
|
|
9793
|
+
useEffect(()=>{
|
|
9794
9794
|
isHorizontal ? onScrollbarXEnabledChange(true) : onScrollbarYEnabledChange(true);
|
|
9795
9795
|
return ()=>{
|
|
9796
9796
|
isHorizontal ? onScrollbarXEnabledChange(false) : onScrollbarYEnabledChange(false);
|
|
@@ -9816,8 +9816,8 @@ const $57acba87d6e25586$export$2fabd85d0eba3c57 = /*#__PURE__*/ forwardRef((prop
|
|
|
9816
9816
|
/* -----------------------------------------------------------------------------------------------*/ const $57acba87d6e25586$var$ScrollAreaScrollbarHover = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
9817
9817
|
const { forceMount: forceMount , ...scrollbarProps } = props;
|
|
9818
9818
|
const context = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$SCROLLBAR_NAME, props.__scopeScrollArea);
|
|
9819
|
-
const [visible, setVisible] = useState
|
|
9820
|
-
useEffect
|
|
9819
|
+
const [visible, setVisible] = useState(false);
|
|
9820
|
+
useEffect(()=>{
|
|
9821
9821
|
const scrollArea = context.scrollArea;
|
|
9822
9822
|
let hideTimer = 0;
|
|
9823
9823
|
if (scrollArea) {
|
|
@@ -9873,7 +9873,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarScroll = /*#__PURE__*/ forwardRef
|
|
|
9873
9873
|
POINTER_ENTER: 'interacting'
|
|
9874
9874
|
}
|
|
9875
9875
|
});
|
|
9876
|
-
useEffect
|
|
9876
|
+
useEffect(()=>{
|
|
9877
9877
|
if (state === 'idle') {
|
|
9878
9878
|
const hideTimer = window.setTimeout(()=>send('HIDE')
|
|
9879
9879
|
, context.scrollHideDelay);
|
|
@@ -9885,7 +9885,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarScroll = /*#__PURE__*/ forwardRef
|
|
|
9885
9885
|
context.scrollHideDelay,
|
|
9886
9886
|
send
|
|
9887
9887
|
]);
|
|
9888
|
-
useEffect
|
|
9888
|
+
useEffect(()=>{
|
|
9889
9889
|
const viewport = context.viewport;
|
|
9890
9890
|
const scrollDirection = isHorizontal ? 'scrollLeft' : 'scrollTop';
|
|
9891
9891
|
if (viewport) {
|
|
@@ -9924,7 +9924,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarScroll = /*#__PURE__*/ forwardRef
|
|
|
9924
9924
|
const $57acba87d6e25586$var$ScrollAreaScrollbarAuto = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
9925
9925
|
const context = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$SCROLLBAR_NAME, props.__scopeScrollArea);
|
|
9926
9926
|
const { forceMount: forceMount , ...scrollbarProps } = props;
|
|
9927
|
-
const [visible, setVisible] = useState
|
|
9927
|
+
const [visible, setVisible] = useState(false);
|
|
9928
9928
|
const isHorizontal = props.orientation === 'horizontal';
|
|
9929
9929
|
const handleResize = $57acba87d6e25586$var$useDebounceCallback(()=>{
|
|
9930
9930
|
if (context.viewport) {
|
|
@@ -9948,7 +9948,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarAuto = /*#__PURE__*/ forwardRef((
|
|
|
9948
9948
|
const context = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$SCROLLBAR_NAME, props.__scopeScrollArea);
|
|
9949
9949
|
const thumbRef = useRef(null);
|
|
9950
9950
|
const pointerOffsetRef = useRef(0);
|
|
9951
|
-
const [sizes, setSizes] = useState
|
|
9951
|
+
const [sizes, setSizes] = useState({
|
|
9952
9952
|
content: 0,
|
|
9953
9953
|
viewport: 0,
|
|
9954
9954
|
scrollbar: {
|
|
@@ -10009,10 +10009,10 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarAuto = /*#__PURE__*/ forwardRef((
|
|
|
10009
10009
|
/* -----------------------------------------------------------------------------------------------*/ const $57acba87d6e25586$var$ScrollAreaScrollbarX = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
10010
10010
|
const { sizes: sizes , onSizesChange: onSizesChange , ...scrollbarProps } = props;
|
|
10011
10011
|
const context = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$SCROLLBAR_NAME, props.__scopeScrollArea);
|
|
10012
|
-
const [computedStyle, setComputedStyle] = useState
|
|
10012
|
+
const [computedStyle, setComputedStyle] = useState();
|
|
10013
10013
|
const ref = useRef(null);
|
|
10014
10014
|
const composeRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, ref, context.onScrollbarXChange);
|
|
10015
|
-
useEffect
|
|
10015
|
+
useEffect(()=>{
|
|
10016
10016
|
if (ref.current) setComputedStyle(getComputedStyle(ref.current));
|
|
10017
10017
|
}, [
|
|
10018
10018
|
ref
|
|
@@ -10056,10 +10056,10 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarAuto = /*#__PURE__*/ forwardRef((
|
|
|
10056
10056
|
const $57acba87d6e25586$var$ScrollAreaScrollbarY = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
10057
10057
|
const { sizes: sizes , onSizesChange: onSizesChange , ...scrollbarProps } = props;
|
|
10058
10058
|
const context = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$SCROLLBAR_NAME, props.__scopeScrollArea);
|
|
10059
|
-
const [computedStyle, setComputedStyle] = useState
|
|
10059
|
+
const [computedStyle, setComputedStyle] = useState();
|
|
10060
10060
|
const ref = useRef(null);
|
|
10061
10061
|
const composeRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, ref, context.onScrollbarYChange);
|
|
10062
|
-
useEffect
|
|
10062
|
+
useEffect(()=>{
|
|
10063
10063
|
if (ref.current) setComputedStyle(getComputedStyle(ref.current));
|
|
10064
10064
|
}, [
|
|
10065
10065
|
ref
|
|
@@ -10105,7 +10105,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarY = /*#__PURE__*/ forwardRef((pro
|
|
|
10105
10105
|
const $57acba87d6e25586$var$ScrollAreaScrollbarImpl = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
10106
10106
|
const { __scopeScrollArea: __scopeScrollArea , sizes: sizes , hasThumb: hasThumb , onThumbChange: onThumbChange , onThumbPointerUp: onThumbPointerUp , onThumbPointerDown: onThumbPointerDown , onThumbPositionChange: onThumbPositionChange , onDragScroll: onDragScroll , onWheelScroll: onWheelScroll , onResize: onResize , ...scrollbarProps } = props;
|
|
10107
10107
|
const context = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$SCROLLBAR_NAME, __scopeScrollArea);
|
|
10108
|
-
const [scrollbar, setScrollbar] = useState
|
|
10108
|
+
const [scrollbar, setScrollbar] = useState(null);
|
|
10109
10109
|
const composeRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, (node)=>setScrollbar(node)
|
|
10110
10110
|
);
|
|
10111
10111
|
const rectRef = useRef(null);
|
|
@@ -10128,7 +10128,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarImpl = /*#__PURE__*/ forwardRef((
|
|
|
10128
10128
|
/**
|
|
10129
10129
|
* We bind wheel event imperatively so we can switch off passive
|
|
10130
10130
|
* mode for document wheel event to allow it to be prevented
|
|
10131
|
-
*/ useEffect
|
|
10131
|
+
*/ useEffect(()=>{
|
|
10132
10132
|
const handleWheel = (event)=>{
|
|
10133
10133
|
const element = event.target;
|
|
10134
10134
|
const isScrollbarWheel = scrollbar === null || scrollbar === void 0 ? void 0 : scrollbar.contains(element);
|
|
@@ -10149,7 +10149,7 @@ const $57acba87d6e25586$var$ScrollAreaScrollbarImpl = /*#__PURE__*/ forwardRef((
|
|
|
10149
10149
|
]);
|
|
10150
10150
|
/**
|
|
10151
10151
|
* Update thumb position on sizes change
|
|
10152
|
-
*/ useEffect
|
|
10152
|
+
*/ useEffect(handleThumbPositionChange, [
|
|
10153
10153
|
sizes,
|
|
10154
10154
|
handleThumbPositionChange
|
|
10155
10155
|
]);
|
|
@@ -10216,7 +10216,7 @@ const $57acba87d6e25586$var$ScrollAreaThumbImpl = /*#__PURE__*/ forwardRef((prop
|
|
|
10216
10216
|
removeUnlinkedScrollListenerRef.current = undefined;
|
|
10217
10217
|
}
|
|
10218
10218
|
}, 100);
|
|
10219
|
-
useEffect
|
|
10219
|
+
useEffect(()=>{
|
|
10220
10220
|
const viewport = scrollAreaContext.viewport;
|
|
10221
10221
|
if (viewport) {
|
|
10222
10222
|
/**
|
|
@@ -10279,8 +10279,8 @@ const $57acba87d6e25586$export$56969d565df7cc4b = /*#__PURE__*/ forwardRef((prop
|
|
|
10279
10279
|
/* -----------------------------------------------------------------------------------------------*/ const $57acba87d6e25586$var$ScrollAreaCornerImpl = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
10280
10280
|
const { __scopeScrollArea: __scopeScrollArea , ...cornerProps } = props;
|
|
10281
10281
|
const context = $57acba87d6e25586$var$useScrollAreaContext($57acba87d6e25586$var$CORNER_NAME, __scopeScrollArea);
|
|
10282
|
-
const [width1, setWidth] = useState
|
|
10283
|
-
const [height1, setHeight] = useState
|
|
10282
|
+
const [width1, setWidth] = useState(0);
|
|
10283
|
+
const [height1, setHeight] = useState(0);
|
|
10284
10284
|
const hasSize = Boolean(width1 && height1);
|
|
10285
10285
|
$57acba87d6e25586$var$useResizeObserver(context.scrollbarX, ()=>{
|
|
10286
10286
|
var _context$scrollbarX;
|
|
@@ -10398,7 +10398,7 @@ const $57acba87d6e25586$var$addUnlinkedScrollListener = (node, handler = ()=>{})
|
|
|
10398
10398
|
function $57acba87d6e25586$var$useDebounceCallback(callback, delay) {
|
|
10399
10399
|
const handleCallback = $b1b2314f5f9a1d84$export$25bec8c6f54ee79a$1(callback);
|
|
10400
10400
|
const debounceTimerRef = useRef(0);
|
|
10401
|
-
useEffect
|
|
10401
|
+
useEffect(()=>()=>window.clearTimeout(debounceTimerRef.current)
|
|
10402
10402
|
, []);
|
|
10403
10403
|
return useCallback(()=>{
|
|
10404
10404
|
window.clearTimeout(debounceTimerRef.current);
|
|
@@ -10491,9 +10491,9 @@ const [$cc7e05a45900e73f$var$SelectNativeOptionsProvider, $cc7e05a45900e73f$var$
|
|
|
10491
10491
|
const $cc7e05a45900e73f$export$ef9b1a59e592288f = (props)=>{
|
|
10492
10492
|
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;
|
|
10493
10493
|
const popperScope = $cc7e05a45900e73f$var$usePopperScope(__scopeSelect);
|
|
10494
|
-
const [trigger, setTrigger] = useState
|
|
10495
|
-
const [valueNode, setValueNode] = useState
|
|
10496
|
-
const [valueNodeHasChildren, setValueNodeHasChildren] = useState
|
|
10494
|
+
const [trigger, setTrigger] = useState(null);
|
|
10495
|
+
const [valueNode, setValueNode] = useState(null);
|
|
10496
|
+
const [valueNodeHasChildren, setValueNodeHasChildren] = useState(false);
|
|
10497
10497
|
const direction = $f631663db3294ace$export$b39126d51d94e6f3(dir);
|
|
10498
10498
|
const [open = false, setOpen] = $71cd76cc60e0454e$export$6f32135080cb4c3$1({
|
|
10499
10499
|
prop: openProp,
|
|
@@ -10507,7 +10507,7 @@ const $cc7e05a45900e73f$export$ef9b1a59e592288f = (props)=>{
|
|
|
10507
10507
|
});
|
|
10508
10508
|
const triggerPointerDownPosRef = useRef(null); // We set this to true by default so that events bubble to forms without JS (SSR)
|
|
10509
10509
|
const isFormControl = trigger ? Boolean(trigger.closest('form')) : true;
|
|
10510
|
-
const [nativeOptionsSet, setNativeOptionsSet] = useState
|
|
10510
|
+
const [nativeOptionsSet, setNativeOptionsSet] = useState(new Set()); // The native `select` only associates the correct default value if the corresponding
|
|
10511
10511
|
// `option` is rendered as a child **at the same time** as itself.
|
|
10512
10512
|
// Because it might take a few renders for our items to gather the information to build
|
|
10513
10513
|
// the native `option`(s), we generate a key on the `select` to make sure React re-builds it
|
|
@@ -10681,7 +10681,7 @@ const $cc7e05a45900e73f$export$b2af6c9944296213 = (props)=>{
|
|
|
10681
10681
|
* -----------------------------------------------------------------------------------------------*/ const $cc7e05a45900e73f$var$CONTENT_NAME = 'SelectContent';
|
|
10682
10682
|
const $cc7e05a45900e73f$export$c973a4b3cb86a03d = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
10683
10683
|
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$CONTENT_NAME, props.__scopeSelect);
|
|
10684
|
-
const [fragment, setFragment] = useState
|
|
10684
|
+
const [fragment, setFragment] = useState(); // setting the fragment in `useLayoutEffect` as `DocumentFragment` doesn't exist on the server
|
|
10685
10685
|
$9f79659886946c16$export$e5c5a5f917a5871c$1(()=>{
|
|
10686
10686
|
setFragment(new DocumentFragment());
|
|
10687
10687
|
}, []);
|
|
@@ -10707,16 +10707,16 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ forwardRef((props,
|
|
|
10707
10707
|
side , sideOffset: sideOffset , align: align , alignOffset: alignOffset , arrowPadding: arrowPadding , collisionBoundary: collisionBoundary , collisionPadding: collisionPadding , sticky: sticky , hideWhenDetached: hideWhenDetached , avoidCollisions: avoidCollisions , //
|
|
10708
10708
|
...contentProps } = props;
|
|
10709
10709
|
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$CONTENT_NAME, __scopeSelect);
|
|
10710
|
-
const [content, setContent] = useState
|
|
10711
|
-
const [viewport, setViewport] = useState
|
|
10710
|
+
const [content, setContent] = useState(null);
|
|
10711
|
+
const [viewport, setViewport] = useState(null);
|
|
10712
10712
|
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, (node)=>setContent(node)
|
|
10713
10713
|
);
|
|
10714
|
-
const [selectedItem, setSelectedItem] = useState
|
|
10715
|
-
const [selectedItemText, setSelectedItemText] = useState
|
|
10714
|
+
const [selectedItem, setSelectedItem] = useState(null);
|
|
10715
|
+
const [selectedItemText, setSelectedItemText] = useState(null);
|
|
10716
10716
|
const getItems = $cc7e05a45900e73f$var$useCollection(__scopeSelect);
|
|
10717
|
-
const [isPositioned, setIsPositioned] = useState
|
|
10717
|
+
const [isPositioned, setIsPositioned] = useState(false);
|
|
10718
10718
|
const firstValidItemFoundRef = useRef(false); // aria-hide everything except the content (better supported equivalent to setting aria-modal)
|
|
10719
|
-
useEffect
|
|
10719
|
+
useEffect(()=>{
|
|
10720
10720
|
if (content) return hideOthers(content);
|
|
10721
10721
|
}, [
|
|
10722
10722
|
content
|
|
@@ -10753,7 +10753,7 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ forwardRef((props,
|
|
|
10753
10753
|
content
|
|
10754
10754
|
]); // Since this is not dependent on layout, we want to ensure this runs at the same time as
|
|
10755
10755
|
// other effects across components. Hence why we don't call `focusSelectedItem` inside `position`.
|
|
10756
|
-
useEffect
|
|
10756
|
+
useEffect(()=>{
|
|
10757
10757
|
if (isPositioned) focusSelectedItem();
|
|
10758
10758
|
}, [
|
|
10759
10759
|
isPositioned,
|
|
@@ -10761,7 +10761,7 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ forwardRef((props,
|
|
|
10761
10761
|
]); // prevent selecting items on `pointerup` in some cases after opening from `pointerdown`
|
|
10762
10762
|
// and close on `pointerup` outside.
|
|
10763
10763
|
const { onOpenChange: onOpenChange , triggerPointerDownPosRef: triggerPointerDownPosRef } = context;
|
|
10764
|
-
useEffect
|
|
10764
|
+
useEffect(()=>{
|
|
10765
10765
|
if (content) {
|
|
10766
10766
|
let pointerMoveDelta = {
|
|
10767
10767
|
x: 0,
|
|
@@ -10801,7 +10801,7 @@ const $cc7e05a45900e73f$var$SelectContentImpl = /*#__PURE__*/ forwardRef((props,
|
|
|
10801
10801
|
onOpenChange,
|
|
10802
10802
|
triggerPointerDownPosRef
|
|
10803
10803
|
]);
|
|
10804
|
-
useEffect
|
|
10804
|
+
useEffect(()=>{
|
|
10805
10805
|
const close = ()=>onOpenChange(false)
|
|
10806
10806
|
;
|
|
10807
10807
|
window.addEventListener('blur', close);
|
|
@@ -10958,8 +10958,8 @@ const $cc7e05a45900e73f$var$SelectItemAlignedPosition = /*#__PURE__*/ forwardRef
|
|
|
10958
10958
|
const { __scopeSelect: __scopeSelect , onPlaced: onPlaced , ...popperProps } = props;
|
|
10959
10959
|
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$CONTENT_NAME, __scopeSelect);
|
|
10960
10960
|
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$CONTENT_NAME, __scopeSelect);
|
|
10961
|
-
const [contentWrapper, setContentWrapper] = useState
|
|
10962
|
-
const [content, setContent] = useState
|
|
10961
|
+
const [contentWrapper, setContentWrapper] = useState(null);
|
|
10962
|
+
const [content, setContent] = useState(null);
|
|
10963
10963
|
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, (node)=>setContent(node)
|
|
10964
10964
|
);
|
|
10965
10965
|
const getItems = $cc7e05a45900e73f$var$useCollection(__scopeSelect);
|
|
@@ -11062,7 +11062,7 @@ const $cc7e05a45900e73f$var$SelectItemAlignedPosition = /*#__PURE__*/ forwardRef
|
|
|
11062
11062
|
, [
|
|
11063
11063
|
position
|
|
11064
11064
|
]); // copy z-index from content to wrapper
|
|
11065
|
-
const [contentZIndex, setContentZIndex] = useState
|
|
11065
|
+
const [contentZIndex, setContentZIndex] = useState();
|
|
11066
11066
|
$9f79659886946c16$export$e5c5a5f917a5871c$1(()=>{
|
|
11067
11067
|
if (content) setContentZIndex(window.getComputedStyle(content).zIndex);
|
|
11068
11068
|
}, [
|
|
@@ -11166,8 +11166,8 @@ const $cc7e05a45900e73f$export$13ef48a934230896 = /*#__PURE__*/ forwardRef((prop
|
|
|
11166
11166
|
const context = $cc7e05a45900e73f$var$useSelectContext($cc7e05a45900e73f$var$ITEM_NAME, __scopeSelect);
|
|
11167
11167
|
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$ITEM_NAME, __scopeSelect);
|
|
11168
11168
|
const isSelected = context.value === value;
|
|
11169
|
-
const [textValue, setTextValue] = useState
|
|
11170
|
-
const [isFocused, setIsFocused] = useState
|
|
11169
|
+
const [textValue, setTextValue] = useState(textValueProp !== null && textValueProp !== void 0 ? textValueProp : '');
|
|
11170
|
+
const [isFocused, setIsFocused] = useState(false);
|
|
11171
11171
|
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, (node)=>{
|
|
11172
11172
|
var _contentContext$itemR;
|
|
11173
11173
|
return (_contentContext$itemR = contentContext.itemRefCallback) === null || _contentContext$itemR === void 0 ? void 0 : _contentContext$itemR.call(contentContext, node, value, disabled);
|
|
@@ -11248,7 +11248,7 @@ const $cc7e05a45900e73f$export$3572fb0fb821ff49 = /*#__PURE__*/ forwardRef((prop
|
|
|
11248
11248
|
const contentContext = $cc7e05a45900e73f$var$useSelectContentContext($cc7e05a45900e73f$var$ITEM_TEXT_NAME, __scopeSelect);
|
|
11249
11249
|
const itemContext = $cc7e05a45900e73f$var$useSelectItemContext($cc7e05a45900e73f$var$ITEM_TEXT_NAME, __scopeSelect);
|
|
11250
11250
|
const nativeOptionsContext = $cc7e05a45900e73f$var$useSelectNativeOptionsContext($cc7e05a45900e73f$var$ITEM_TEXT_NAME, __scopeSelect);
|
|
11251
|
-
const [itemTextNode, setItemTextNode] = useState
|
|
11251
|
+
const [itemTextNode, setItemTextNode] = useState(null);
|
|
11252
11252
|
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, (node)=>setItemTextNode(node)
|
|
11253
11253
|
, itemContext.onItemTextChange, (node)=>{
|
|
11254
11254
|
var _contentContext$itemT;
|
|
@@ -11306,7 +11306,7 @@ const $cc7e05a45900e73f$export$eba4b1df07cb1d3 = /*#__PURE__*/ forwardRef((props
|
|
|
11306
11306
|
const ref = useRef(null);
|
|
11307
11307
|
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, ref);
|
|
11308
11308
|
const prevValue = $010c2913dbd2fe3d$export$5cae361ad82dce8b(value); // Bubble value change to parents (e.g form change event)
|
|
11309
|
-
useEffect
|
|
11309
|
+
useEffect(()=>{
|
|
11310
11310
|
const select = ref.current;
|
|
11311
11311
|
const selectProto = window.HTMLSelectElement.prototype;
|
|
11312
11312
|
const descriptor = Object.getOwnPropertyDescriptor(selectProto, 'value');
|
|
@@ -11361,7 +11361,7 @@ function $cc7e05a45900e73f$var$useTypeaheadSearch(onSearchChange) {
|
|
|
11361
11361
|
searchRef.current = '';
|
|
11362
11362
|
window.clearTimeout(timerRef.current);
|
|
11363
11363
|
}, []);
|
|
11364
|
-
useEffect
|
|
11364
|
+
useEffect(()=>{
|
|
11365
11365
|
return ()=>window.clearTimeout(timerRef.current)
|
|
11366
11366
|
;
|
|
11367
11367
|
}, []);
|
|
@@ -11610,7 +11610,7 @@ const [$6be4966fd9bbc698$var$createSwitchContext, $6be4966fd9bbc698$export$cf7f5
|
|
|
11610
11610
|
const [$6be4966fd9bbc698$var$SwitchProvider, $6be4966fd9bbc698$var$useSwitchContext] = $6be4966fd9bbc698$var$createSwitchContext($6be4966fd9bbc698$var$SWITCH_NAME);
|
|
11611
11611
|
const $6be4966fd9bbc698$export$b5d5cf8927ab7262 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
|
|
11612
11612
|
const { __scopeSwitch: __scopeSwitch , name: name , checked: checkedProp , defaultChecked: defaultChecked , required: required , disabled: disabled , value: value = 'on' , onCheckedChange: onCheckedChange , ...switchProps } = props;
|
|
11613
|
-
const [button, setButton] = useState
|
|
11613
|
+
const [button, setButton] = useState(null);
|
|
11614
11614
|
const composedRefs = $6ed0406888f73fc4$export$c7b2cbe3552a0d05$1(forwardedRef, (node)=>setButton(node)
|
|
11615
11615
|
);
|
|
11616
11616
|
const hasConsumerStoppedPropagationRef = useRef(false); // We set this to true by default so that events bubble to forms without JS (SSR)
|
|
@@ -11677,7 +11677,7 @@ const $6be4966fd9bbc698$export$4d07bf653ea69106 = /*#__PURE__*/ forwardRef((prop
|
|
|
11677
11677
|
const ref = useRef(null);
|
|
11678
11678
|
const prevChecked = $010c2913dbd2fe3d$export$5cae361ad82dce8b(checked);
|
|
11679
11679
|
const controlSize = $db6c3485150b8e66$export$1ab7ae714698c4b8(control); // Bubble checked change to parents (e.g form change event)
|
|
11680
|
-
useEffect
|
|
11680
|
+
useEffect(()=>{
|
|
11681
11681
|
const input = ref.current;
|
|
11682
11682
|
const inputProto = window.HTMLInputElement.prototype;
|
|
11683
11683
|
const descriptor = Object.getOwnPropertyDescriptor(inputProto, 'checked');
|
|
@@ -15174,7 +15174,7 @@ function useReactTable(options) {
|
|
|
15174
15174
|
return tableRef.current;
|
|
15175
15175
|
}
|
|
15176
15176
|
|
|
15177
|
-
const TableContext = createContext
|
|
15177
|
+
const TableContext = createContext(null);
|
|
15178
15178
|
|
|
15179
15179
|
const useTable = () => {
|
|
15180
15180
|
const ctx = useContext(TableContext);
|
|
@@ -15307,7 +15307,7 @@ const TableDetailContainer = ({ children, ...props }) => {
|
|
|
15307
15307
|
};
|
|
15308
15308
|
|
|
15309
15309
|
const useTableColumn = () => {
|
|
15310
|
-
const [columns, setColumns] = useState
|
|
15310
|
+
const [columns, setColumns] = useState([]);
|
|
15311
15311
|
const addFilterColumn = useCallback((column) => {
|
|
15312
15312
|
const uniqeColumns = new Set([...columns, column]);
|
|
15313
15313
|
setColumns(Array.from(uniqeColumns));
|
|
@@ -15365,7 +15365,7 @@ const Table = Object.assign(TableRoot, {
|
|
|
15365
15365
|
Caption: TableCaption,
|
|
15366
15366
|
});
|
|
15367
15367
|
|
|
15368
|
-
function DataTableRoot({ columns, data, emptyState, children, ...props }) {
|
|
15368
|
+
function DataTableRoot({ columns, data, emptyState, children, parentStyle, ...props }) {
|
|
15369
15369
|
const convertedChildren = Children.toArray(children);
|
|
15370
15370
|
const header = convertedChildren.find((child) => child.type === DataTableToolbar) || jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {});
|
|
15371
15371
|
const footer = convertedChildren.find((child) => child.type === DataTableFooter) || jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {});
|
|
@@ -15409,7 +15409,7 @@ function DataTableRoot({ columns, data, emptyState, children, ...props }) {
|
|
|
15409
15409
|
resetColumns,
|
|
15410
15410
|
onGlobalFilterChange: setGlobalFilter,
|
|
15411
15411
|
onChange: () => ({}),
|
|
15412
|
-
}, children: [jsxRuntimeExports.jsxs(Flex, { direction: "column", className: styles$4.datatable, children: [header, jsxRuntimeExports.jsxs(Flex, { children: [jsxRuntimeExports.jsxs(Table, { ...props, children: [jsxRuntimeExports.jsx(Table.Header, { children: table.getHeaderGroups().map((headerGroup) => (jsxRuntimeExports.jsx(Table.Row, { children: headerGroup.headers.map((header) => {
|
|
15412
|
+
}, children: [jsxRuntimeExports.jsxs(Flex, { direction: "column", className: styles$4.datatable, children: [header, jsxRuntimeExports.jsxs(Flex, { style: parentStyle, children: [jsxRuntimeExports.jsxs(Table, { ...props, children: [jsxRuntimeExports.jsx(Table.Header, { children: table.getHeaderGroups().map((headerGroup) => (jsxRuntimeExports.jsx(Table.Row, { children: headerGroup.headers.map((header) => {
|
|
15413
15413
|
return (jsxRuntimeExports.jsx(Table.Head, { children: jsxRuntimeExports.jsxs(Text, { className: styles$4.head, children: [header.isPlaceholder
|
|
15414
15414
|
? null
|
|
15415
15415
|
: flexRender(header.column.columnDef.header, header.getContext()), {
|
|
@@ -15537,7 +15537,7 @@ const $69cb30bb0017df05$export$bd905d70e8fd2ebb = /*#__PURE__*/ forwardRef((prop
|
|
|
15537
15537
|
const contentId = $69cb30bb0017df05$var$makeContentId(context.baseId, value);
|
|
15538
15538
|
const isSelected = value === context.value;
|
|
15539
15539
|
const isMountAnimationPreventedRef = useRef(isSelected);
|
|
15540
|
-
useEffect
|
|
15540
|
+
useEffect(()=>{
|
|
15541
15541
|
const rAF = requestAnimationFrame(()=>isMountAnimationPreventedRef.current = false
|
|
15542
15542
|
);
|
|
15543
15543
|
return ()=>cancelAnimationFrame(rAF)
|
|
@@ -15602,136 +15602,228 @@ const Tabs = Object.assign(TabsRoot, {
|
|
|
15602
15602
|
List: TabsList,
|
|
15603
15603
|
});
|
|
15604
15604
|
|
|
15605
|
-
const
|
|
15606
|
-
const
|
|
15607
|
-
|
|
15608
|
-
|
|
15609
|
-
|
|
15610
|
-
|
|
15611
|
-
|
|
15612
|
-
|
|
15613
|
-
|
|
15614
|
-
|
|
15615
|
-
};
|
|
15616
|
-
|
|
15617
|
-
|
|
15618
|
-
|
|
15619
|
-
|
|
15620
|
-
|
|
15621
|
-
|
|
15622
|
-
|
|
15623
|
-
|
|
15624
|
-
|
|
15625
|
-
|
|
15626
|
-
|
|
15627
|
-
|
|
15628
|
-
|
|
15629
|
-
|
|
15630
|
-
|
|
15631
|
-
|
|
15632
|
-
|
|
15633
|
-
|
|
15634
|
-
|
|
15635
|
-
|
|
15636
|
-
|
|
15637
|
-
|
|
15638
|
-
const saveThemePreference = (newTheme) => {
|
|
15639
|
-
try {
|
|
15640
|
-
if (typeof newTheme === "string")
|
|
15641
|
-
window.localStorage.setItem(themeLocalStorageKey, newTheme);
|
|
15642
|
-
}
|
|
15643
|
-
catch (e) {
|
|
15644
|
-
console.warn(e);
|
|
15645
|
-
}
|
|
15646
|
-
};
|
|
15647
|
-
const getSavedThemePreference = () => {
|
|
15648
|
-
try {
|
|
15649
|
-
const savedMode = window.localStorage.getItem(themeLocalStorageKey);
|
|
15650
|
-
// If the user has explicitly chosen a colour mode,
|
|
15651
|
-
// let's use it. Otherwise, this value will be null.
|
|
15652
|
-
return isValidThemePreference(savedMode) ? savedMode : null;
|
|
15653
|
-
}
|
|
15654
|
-
catch (e) {
|
|
15655
|
-
// When Chrome in incognito, localStorage cannot be accessed
|
|
15656
|
-
console.warn(e);
|
|
15657
|
-
return null;
|
|
15658
|
-
}
|
|
15659
|
-
};
|
|
15660
|
-
|
|
15661
|
-
const { createContext, useState, useEffect } = React__default;
|
|
15662
|
-
const defaultThemeName = "dark";
|
|
15663
|
-
const initialValues = {
|
|
15664
|
-
themeName: defaultThemeName,
|
|
15665
|
-
themePreference: defaultThemeName,
|
|
15666
|
-
setTheme: () => { },
|
|
15667
|
-
};
|
|
15668
|
-
const ApsaraThemeContext = createContext(initialValues);
|
|
15669
|
-
ApsaraThemeContext.displayName = "ApsaraThemeContext ";
|
|
15670
|
-
const useTheme = () => {
|
|
15671
|
-
const [themePreference, setThemePreference] = useState(defaultThemeName);
|
|
15672
|
-
const [themeName, setThemeName] = useState(defaultThemeName);
|
|
15673
|
-
const [osTheme, setOsTheme] = useState(getMediaTheme());
|
|
15674
|
-
// in the future this should prefer auto if no saved
|
|
15675
|
-
useEffect(() => {
|
|
15676
|
-
const initialTheme = getSavedThemePreference();
|
|
15677
|
-
if (isValidThemePreference(initialTheme)) {
|
|
15678
|
-
setThemePreference(initialTheme);
|
|
15605
|
+
const colorSchemes = ["light", "dark"];
|
|
15606
|
+
const MEDIA = "(prefers-color-scheme: dark)";
|
|
15607
|
+
const isServer = typeof window === "undefined";
|
|
15608
|
+
const ThemeContext = createContext(undefined);
|
|
15609
|
+
const defaultContext = { setTheme: (_) => { }, themes: [] };
|
|
15610
|
+
const useTheme = () => useContext(ThemeContext) ?? defaultContext;
|
|
15611
|
+
const ThemeProvider = (props) => {
|
|
15612
|
+
const context = useContext(ThemeContext);
|
|
15613
|
+
// Ignore nested context providers, just passthrough children
|
|
15614
|
+
if (context)
|
|
15615
|
+
return jsxRuntimeExports.jsx(Fragment, { children: props.children });
|
|
15616
|
+
return jsxRuntimeExports.jsx(Theme$1, { ...props });
|
|
15617
|
+
};
|
|
15618
|
+
const defaultThemes = ["light", "dark"];
|
|
15619
|
+
const Theme$1 = ({ forcedTheme, disableTransitionOnChange = false, enableSystem = true, enableColorScheme = true, storageKey = "theme", themes = defaultThemes, defaultTheme = enableSystem ? "system" : "light", attribute = "data-theme", value, children, nonce, }) => {
|
|
15620
|
+
const [theme, setThemeState] = useState(() => getTheme(storageKey, defaultTheme));
|
|
15621
|
+
const [resolvedTheme, setResolvedTheme] = useState(() => getTheme(storageKey));
|
|
15622
|
+
const attrs = !value ? themes : Object.values(value);
|
|
15623
|
+
const applyTheme = useCallback((theme) => {
|
|
15624
|
+
let resolved = theme;
|
|
15625
|
+
if (!resolved)
|
|
15626
|
+
return;
|
|
15627
|
+
// If theme is system, resolve it before setting theme
|
|
15628
|
+
if (theme === "system" && enableSystem) {
|
|
15629
|
+
resolved = getSystemTheme();
|
|
15630
|
+
}
|
|
15631
|
+
const name = value ? value[resolved] : resolved;
|
|
15632
|
+
const enable = disableTransitionOnChange ? disableAnimation() : null;
|
|
15633
|
+
const d = document.documentElement;
|
|
15634
|
+
if (attribute === "class") {
|
|
15635
|
+
d.classList.remove(...attrs);
|
|
15636
|
+
if (name)
|
|
15637
|
+
d.classList.add(name);
|
|
15679
15638
|
}
|
|
15680
15639
|
else {
|
|
15681
|
-
|
|
15640
|
+
if (name) {
|
|
15641
|
+
d.setAttribute(attribute, name);
|
|
15642
|
+
}
|
|
15643
|
+
else {
|
|
15644
|
+
d.removeAttribute(attribute);
|
|
15645
|
+
}
|
|
15646
|
+
}
|
|
15647
|
+
if (enableColorScheme) {
|
|
15648
|
+
const fallback = colorSchemes.includes(defaultTheme)
|
|
15649
|
+
? defaultTheme
|
|
15650
|
+
: null;
|
|
15651
|
+
const colorScheme = colorSchemes.includes(resolved) ? resolved : fallback;
|
|
15652
|
+
// @ts-ignore
|
|
15653
|
+
d.style.colorScheme = colorScheme;
|
|
15682
15654
|
}
|
|
15655
|
+
enable?.();
|
|
15683
15656
|
}, []);
|
|
15657
|
+
const setTheme = useCallback((theme) => {
|
|
15658
|
+
setThemeState(theme);
|
|
15659
|
+
// Save to storage
|
|
15660
|
+
try {
|
|
15661
|
+
localStorage.setItem(storageKey, theme);
|
|
15662
|
+
}
|
|
15663
|
+
catch (e) {
|
|
15664
|
+
// Unsupported
|
|
15665
|
+
}
|
|
15666
|
+
}, [forcedTheme]);
|
|
15667
|
+
const handleMediaQuery = useCallback((e) => {
|
|
15668
|
+
const resolved = getSystemTheme(e);
|
|
15669
|
+
setResolvedTheme(resolved);
|
|
15670
|
+
if (theme === "system" && enableSystem && !forcedTheme) {
|
|
15671
|
+
applyTheme("system");
|
|
15672
|
+
}
|
|
15673
|
+
}, [theme, forcedTheme]);
|
|
15674
|
+
// Always listen to System preference
|
|
15675
|
+
useEffect(() => {
|
|
15676
|
+
const media = window.matchMedia(MEDIA);
|
|
15677
|
+
// Intentionally use deprecated listener methods to support iOS & old browsers
|
|
15678
|
+
media.addListener(handleMediaQuery);
|
|
15679
|
+
handleMediaQuery(media);
|
|
15680
|
+
return () => media.removeListener(handleMediaQuery);
|
|
15681
|
+
}, [handleMediaQuery]);
|
|
15682
|
+
// localStorage event handling
|
|
15683
|
+
useEffect(() => {
|
|
15684
|
+
const handleStorage = (e) => {
|
|
15685
|
+
if (e.key !== storageKey) {
|
|
15686
|
+
return;
|
|
15687
|
+
}
|
|
15688
|
+
// If default theme set, use it if localstorage === null (happens on local storage manual deletion)
|
|
15689
|
+
const theme = e.newValue || defaultTheme;
|
|
15690
|
+
setTheme(theme);
|
|
15691
|
+
};
|
|
15692
|
+
window.addEventListener("storage", handleStorage);
|
|
15693
|
+
return () => window.removeEventListener("storage", handleStorage);
|
|
15694
|
+
}, [setTheme]);
|
|
15695
|
+
// Whenever theme or forcedTheme changes, apply it
|
|
15684
15696
|
useEffect(() => {
|
|
15685
|
-
|
|
15686
|
-
|
|
15697
|
+
// @ts-ignore
|
|
15698
|
+
applyTheme(forcedTheme ?? theme);
|
|
15699
|
+
}, [forcedTheme, theme]);
|
|
15700
|
+
const providerValue = useMemo(() => ({
|
|
15701
|
+
theme,
|
|
15702
|
+
setTheme,
|
|
15703
|
+
forcedTheme,
|
|
15704
|
+
resolvedTheme: theme === "system" ? resolvedTheme : theme,
|
|
15705
|
+
themes: enableSystem ? [...themes, "system"] : themes,
|
|
15706
|
+
systemTheme: (enableSystem ? resolvedTheme : undefined),
|
|
15707
|
+
}), [theme, setTheme, forcedTheme, resolvedTheme, enableSystem, themes]);
|
|
15708
|
+
return (jsxRuntimeExports.jsxs(ThemeContext.Provider, { value: providerValue, children: [jsxRuntimeExports.jsx(ThemeScript, { ...{
|
|
15709
|
+
forcedTheme,
|
|
15710
|
+
disableTransitionOnChange,
|
|
15711
|
+
enableSystem,
|
|
15712
|
+
enableColorScheme,
|
|
15713
|
+
storageKey,
|
|
15714
|
+
themes,
|
|
15715
|
+
defaultTheme,
|
|
15716
|
+
attribute,
|
|
15717
|
+
value,
|
|
15718
|
+
children,
|
|
15719
|
+
attrs,
|
|
15720
|
+
nonce,
|
|
15721
|
+
} }), children] }));
|
|
15722
|
+
};
|
|
15723
|
+
const ThemeScript = memo$1(({ forcedTheme, storageKey, attribute, enableSystem, enableColorScheme, defaultTheme, value, attrs, nonce, }) => {
|
|
15724
|
+
const defaultSystem = defaultTheme === "system";
|
|
15725
|
+
// Code-golfing the amount of characters in the script
|
|
15726
|
+
const optimization = (() => {
|
|
15727
|
+
if (attribute === "class") {
|
|
15728
|
+
const removeClasses = `c.remove(${attrs
|
|
15729
|
+
.map((t) => `'${t}'`)
|
|
15730
|
+
.join(",")})`;
|
|
15731
|
+
return `var d=document.documentElement,c=d.classList;${removeClasses};`;
|
|
15687
15732
|
}
|
|
15688
15733
|
else {
|
|
15689
|
-
|
|
15734
|
+
return `var d=document.documentElement,n='${attribute}',s='setAttribute';`;
|
|
15690
15735
|
}
|
|
15691
|
-
}
|
|
15692
|
-
|
|
15693
|
-
|
|
15694
|
-
|
|
15695
|
-
setThemeName(osTheme ?? defaultThemeName);
|
|
15736
|
+
})();
|
|
15737
|
+
const fallbackColorScheme = (() => {
|
|
15738
|
+
if (!enableColorScheme) {
|
|
15739
|
+
return "";
|
|
15696
15740
|
}
|
|
15697
|
-
|
|
15698
|
-
|
|
15699
|
-
|
|
15700
|
-
|
|
15701
|
-
|
|
15702
|
-
}
|
|
15703
|
-
|
|
15704
|
-
|
|
15705
|
-
|
|
15706
|
-
|
|
15707
|
-
|
|
15708
|
-
|
|
15709
|
-
|
|
15710
|
-
|
|
15711
|
-
|
|
15712
|
-
|
|
15713
|
-
|
|
15714
|
-
|
|
15715
|
-
|
|
15716
|
-
|
|
15741
|
+
const fallback = colorSchemes.includes(defaultTheme)
|
|
15742
|
+
? defaultTheme
|
|
15743
|
+
: null;
|
|
15744
|
+
if (fallback) {
|
|
15745
|
+
return `if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${defaultTheme}'`;
|
|
15746
|
+
}
|
|
15747
|
+
else {
|
|
15748
|
+
return `if(e==='light'||e==='dark')d.style.colorScheme=e`;
|
|
15749
|
+
}
|
|
15750
|
+
})();
|
|
15751
|
+
const updateDOM = (name, literal = false, setColorScheme = true) => {
|
|
15752
|
+
const resolvedName = value ? value[name] : name;
|
|
15753
|
+
const val = literal ? name + `|| ''` : `'${resolvedName}'`;
|
|
15754
|
+
let text = "";
|
|
15755
|
+
// MUCH faster to set colorScheme alongside HTML attribute/class
|
|
15756
|
+
// as it only incurs 1 style recalculation rather than 2
|
|
15757
|
+
// This can save over 250ms of work for pages with big DOM
|
|
15758
|
+
if (enableColorScheme &&
|
|
15759
|
+
setColorScheme &&
|
|
15760
|
+
!literal &&
|
|
15761
|
+
colorSchemes.includes(name)) {
|
|
15762
|
+
text += `d.style.colorScheme = '${name}';`;
|
|
15763
|
+
}
|
|
15764
|
+
if (attribute === "class") {
|
|
15765
|
+
if (literal || resolvedName) {
|
|
15766
|
+
text += `c.add(${val})`;
|
|
15767
|
+
}
|
|
15768
|
+
else {
|
|
15769
|
+
text += `null`;
|
|
15770
|
+
}
|
|
15771
|
+
}
|
|
15772
|
+
else {
|
|
15773
|
+
if (resolvedName) {
|
|
15774
|
+
text += `d[s](n,${val})`;
|
|
15775
|
+
}
|
|
15776
|
+
}
|
|
15777
|
+
return text;
|
|
15717
15778
|
};
|
|
15718
|
-
|
|
15719
|
-
|
|
15720
|
-
|
|
15721
|
-
|
|
15722
|
-
|
|
15723
|
-
|
|
15724
|
-
|
|
15725
|
-
|
|
15726
|
-
}
|
|
15727
|
-
function
|
|
15728
|
-
|
|
15729
|
-
|
|
15730
|
-
|
|
15779
|
+
const scriptSrc = (() => {
|
|
15780
|
+
if (forcedTheme) {
|
|
15781
|
+
return `!function(){${optimization}${updateDOM(forcedTheme)}}()`;
|
|
15782
|
+
}
|
|
15783
|
+
if (enableSystem) {
|
|
15784
|
+
return `!function(){try{${optimization}var e=localStorage.getItem('${storageKey}');if('system'===e||(!e&&${defaultSystem})){var t='${MEDIA}',m=window.matchMedia(t);if(m.media!==t||m.matches){${updateDOM("dark")}}else{${updateDOM("light")}}}else if(e){${value ? `var x=${JSON.stringify(value)};` : ""}${updateDOM(value ? `x[e]` : "e", true)}}${!defaultSystem
|
|
15785
|
+
? `else{` + updateDOM(defaultTheme, false, false) + "}"
|
|
15786
|
+
: ""}${fallbackColorScheme}}catch(e){}}()`;
|
|
15787
|
+
}
|
|
15788
|
+
return `!function(){try{${optimization}var e=localStorage.getItem('${storageKey}');if(e){${value ? `var x=${JSON.stringify(value)};` : ""}${updateDOM(value ? `x[e]` : "e", true)}}else{${updateDOM(defaultTheme, false, false)};}${fallbackColorScheme}}catch(t){}}();`;
|
|
15789
|
+
})();
|
|
15790
|
+
return (jsxRuntimeExports.jsx("script", { nonce: nonce, dangerouslySetInnerHTML: { __html: scriptSrc } }));
|
|
15791
|
+
},
|
|
15792
|
+
// Never re-render this component
|
|
15793
|
+
() => true);
|
|
15794
|
+
// Helpers
|
|
15795
|
+
const getTheme = (key, fallback) => {
|
|
15796
|
+
if (isServer)
|
|
15797
|
+
return undefined;
|
|
15798
|
+
let theme;
|
|
15799
|
+
try {
|
|
15800
|
+
theme = localStorage.getItem(key) || undefined;
|
|
15731
15801
|
}
|
|
15732
|
-
|
|
15733
|
-
|
|
15734
|
-
}
|
|
15802
|
+
catch (e) {
|
|
15803
|
+
// Unsupported
|
|
15804
|
+
}
|
|
15805
|
+
return theme || fallback;
|
|
15806
|
+
};
|
|
15807
|
+
const disableAnimation = () => {
|
|
15808
|
+
const css = document.createElement("style");
|
|
15809
|
+
css.appendChild(document.createTextNode(`*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`));
|
|
15810
|
+
document.head.appendChild(css);
|
|
15811
|
+
return () => {
|
|
15812
|
+
// Force restyle
|
|
15813
|
+
(() => window.getComputedStyle(document.body))();
|
|
15814
|
+
// Wait for next tick before removing
|
|
15815
|
+
setTimeout(() => {
|
|
15816
|
+
document.head.removeChild(css);
|
|
15817
|
+
}, 1);
|
|
15818
|
+
};
|
|
15819
|
+
};
|
|
15820
|
+
const getSystemTheme = (e) => {
|
|
15821
|
+
if (!e)
|
|
15822
|
+
e = window.matchMedia(MEDIA);
|
|
15823
|
+
const isDark = e.matches;
|
|
15824
|
+
const systemTheme = isDark ? "dark" : "light";
|
|
15825
|
+
return systemTheme;
|
|
15826
|
+
};
|
|
15735
15827
|
|
|
15736
15828
|
var Theme;
|
|
15737
15829
|
(function (Theme) {
|
|
@@ -15739,11 +15831,11 @@ var Theme;
|
|
|
15739
15831
|
Theme["LIGHT"] = "light";
|
|
15740
15832
|
})(Theme || (Theme = {}));
|
|
15741
15833
|
function ThemeSwitcher({ size = 30, ...props }) {
|
|
15742
|
-
const {
|
|
15834
|
+
const { theme, setTheme } = useTheme();
|
|
15743
15835
|
const onClickHandler = () => {
|
|
15744
|
-
setTheme(
|
|
15836
|
+
setTheme(theme === Theme.DARK ? Theme.LIGHT : Theme.DARK);
|
|
15745
15837
|
};
|
|
15746
|
-
return (jsxRuntimeExports.jsx(Box, { ...props, children:
|
|
15838
|
+
return (jsxRuntimeExports.jsx(Box, { ...props, children: theme === Theme.DARK ? (jsxRuntimeExports.jsx(SunIcon, { width: size, height: size, onClick: onClickHandler })) : (jsxRuntimeExports.jsx(MoonIcon, { width: size, height: size, onClick: onClickHandler })) }));
|
|
15747
15839
|
}
|
|
15748
15840
|
|
|
15749
15841
|
var styles = {"title":"title-module_title__r78X4","title-small":"title-module_title-small__aS4B3","title-medium":"title-module_title-medium__e8yQc","title-large":"title-module_title-large__TVRRL"};
|
|
@@ -15764,5 +15856,5 @@ function Title({ children, className, size, ...props }) {
|
|
|
15764
15856
|
return (jsxRuntimeExports.jsx("span", { className: title({ size, className }), ...props, children: children }));
|
|
15765
15857
|
}
|
|
15766
15858
|
|
|
15767
|
-
export {
|
|
15859
|
+
export { Avatar, badge$1 as Badge, Body, Box, Button, Checkbox, Command, Container, DataTable, Dialog, Display, DropdownMenu, EmptyState, Flex, Grid, Headline, Image, InputField, Label, Link, Popover, Radio, ScrollArea, Select, Separator, Sheet, Sidebar, Switch, Table, Tabs, Text, TextField, ThemeProvider, ThemeSwitcher, Title, useTable, useTheme };
|
|
15768
15860
|
//# sourceMappingURL=index.js.map
|