@sanity/ui 2.8.5 → 2.8.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +48 -0
- package/dist/index.d.ts +48 -0
- package/dist/index.esm.js +154 -82
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +154 -82
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +154 -82
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/core/components/autocomplete/autocomplete.tsx +2 -0
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +1 -0
- package/src/core/components/dialog/dialog.tsx +3 -0
- package/src/core/components/dialog/dialogProvider.tsx +2 -0
- package/src/core/components/hotkeys/hotkeys.tsx +1 -0
- package/src/core/components/menu/menu.tsx +21 -20
- package/src/core/components/menu/menuButton.tsx +2 -5
- package/src/core/components/menu/menuDivider.ts +1 -0
- package/src/core/components/menu/menuGroup.tsx +19 -17
- package/src/core/components/menu/menuItem.tsx +1 -0
- package/src/core/components/menu/useMenuController.ts +13 -23
- package/src/core/components/skeleton/skeleton.tsx +1 -0
- package/src/core/components/skeleton/textSkeleton.tsx +4 -0
- package/src/core/components/tab/tab.tsx +1 -0
- package/src/core/components/tab/tabList.tsx +1 -0
- package/src/core/components/tab/tabPanel.tsx +1 -0
- package/src/core/components/toast/styles.ts +1 -1
- package/src/core/components/toast/toast.tsx +2 -0
- package/src/core/components/toast/toastProvider.tsx +2 -0
- package/src/core/components/tree/tree.tsx +1 -2
- package/src/core/components/tree/treeItem.tsx +1 -0
- package/src/core/hooks/useClickOutsideEvent.ts +2 -4
- package/src/core/primitives/_selectable/selectable.tsx +1 -0
- package/src/core/primitives/avatar/avatar.tsx +1 -0
- package/src/core/primitives/avatar/avatarCounter.tsx +1 -0
- package/src/core/primitives/avatar/avatarStack.tsx +1 -0
- package/src/core/primitives/badge/badge.tsx +1 -0
- package/src/core/primitives/box/box.tsx +1 -0
- package/src/core/primitives/button/button.tsx +1 -0
- package/src/core/primitives/card/card.tsx +1 -0
- package/src/core/primitives/checkbox/checkbox.tsx +1 -0
- package/src/core/primitives/code/code.tsx +1 -0
- package/src/core/primitives/container/container.tsx +1 -0
- package/src/core/primitives/flex/flex.tsx +1 -0
- package/src/core/primitives/grid/grid.tsx +1 -0
- package/src/core/primitives/heading/heading.tsx +1 -0
- package/src/core/primitives/inline/inline.tsx +1 -0
- package/src/core/primitives/kbd/kbd.tsx +1 -0
- package/src/core/primitives/label/label.tsx +1 -0
- package/src/core/primitives/popover/popover.tsx +1 -2
- package/src/core/primitives/popover/popoverCard.tsx +1 -2
- package/src/core/primitives/radio/radio.tsx +1 -0
- package/src/core/primitives/select/select.tsx +1 -0
- package/src/core/primitives/spinner/spinner.tsx +1 -0
- package/src/core/primitives/stack/stack.tsx +1 -0
- package/src/core/primitives/switch/switch.tsx +1 -0
- package/src/core/primitives/text/text.tsx +1 -0
- package/src/core/primitives/textArea/textArea.tsx +1 -0
- package/src/core/primitives/textInput/textInput.tsx +1 -0
- package/src/core/primitives/tooltip/tooltip.tsx +1 -0
- package/src/core/primitives/tooltip/tooltipCard.tsx +1 -2
- package/src/core/primitives/tooltip/tooltipDelayGroup/tooltipDelayGroupProvider.tsx +2 -0
- package/src/core/theme/themeColorProvider.tsx +2 -0
- package/src/core/theme/themeProvider.tsx +2 -0
- package/src/core/utils/arrow/arrow.tsx +1 -0
- package/src/core/utils/boundaryElement/boundaryElementProvider.tsx +2 -0
- package/src/core/utils/conditionalWrapper/conditionalWrapper.tsx +2 -0
- package/src/core/utils/elementQuery/elementQuery.tsx +1 -0
- package/src/core/utils/layer/layer.tsx +1 -0
- package/src/core/utils/layer/layerProvider.tsx +2 -0
- package/src/core/utils/portal/portal.ts +2 -0
- package/src/core/utils/portal/portalProvider.tsx +2 -0
- package/src/core/utils/srOnly/srOnly.tsx +1 -0
- package/src/core/utils/virtualList/virtualList.tsx +1 -0
package/dist/index.esm.js
CHANGED
|
@@ -178,10 +178,10 @@ function useClickOutsideEvent(listener, elementsArg = () => EMPTY_ARRAY, boundar
|
|
|
178
178
|
const target = evt.target;
|
|
179
179
|
if (!(target instanceof Node))
|
|
180
180
|
return;
|
|
181
|
-
const resolvedBoundaryElement =
|
|
181
|
+
const resolvedBoundaryElement = boundaryElement == null ? void 0 : boundaryElement();
|
|
182
182
|
if (resolvedBoundaryElement && !resolvedBoundaryElement.contains(target))
|
|
183
183
|
return;
|
|
184
|
-
const elements =
|
|
184
|
+
const elements = elementsArg().flat();
|
|
185
185
|
for (const el of elements)
|
|
186
186
|
if (el && (target === el || el.contains(target)))
|
|
187
187
|
return;
|
|
@@ -585,6 +585,7 @@ function ThemeProvider(props) {
|
|
|
585
585
|
} : null, [rootTheme, scheme, tone]), theme = useMemo(() => rootTheme ? getScopedTheme(rootTheme, scheme, tone) : null, [scheme, rootTheme, tone]);
|
|
586
586
|
return theme ? /* @__PURE__ */ jsx(ThemeContext.Provider, { value: themeContext, children: /* @__PURE__ */ jsx(ThemeProvider$1, { theme, children }) }) : /* @__PURE__ */ jsx("pre", { children: 'ThemeProvider: no "theme" property provided' });
|
|
587
587
|
}
|
|
588
|
+
ThemeProvider.displayName = "ThemeProvider";
|
|
588
589
|
function useRootTheme() {
|
|
589
590
|
const value = useContext(ThemeContext);
|
|
590
591
|
if (!value)
|
|
@@ -595,6 +596,7 @@ function ThemeColorProvider(props) {
|
|
|
595
596
|
const { children, scheme, tone } = props, root = useRootTheme();
|
|
596
597
|
return /* @__PURE__ */ jsx(ThemeProvider, { scheme: scheme || root.scheme, theme: root.theme, tone, children });
|
|
597
598
|
}
|
|
599
|
+
ThemeColorProvider.displayName = "ThemeColorProvider";
|
|
598
600
|
function useTheme() {
|
|
599
601
|
return useTheme$1();
|
|
600
602
|
}
|
|
@@ -1274,7 +1276,9 @@ const Root$C = styled.div(responsiveLabelFont, responsiveTextAlignStyle, labelBa
|
|
|
1274
1276
|
children
|
|
1275
1277
|
}
|
|
1276
1278
|
);
|
|
1277
|
-
})
|
|
1279
|
+
});
|
|
1280
|
+
Label.displayName = "ForwardRef(Label)";
|
|
1281
|
+
const avatarStyle = {
|
|
1278
1282
|
root: avatarRootStyle,
|
|
1279
1283
|
arrow: avatarArrowStyle,
|
|
1280
1284
|
bgStroke: avatarBgStrokeStyle,
|
|
@@ -1502,6 +1506,7 @@ const Root$B = styled.div(
|
|
|
1502
1506
|
}
|
|
1503
1507
|
);
|
|
1504
1508
|
});
|
|
1509
|
+
Avatar.displayName = "ForwardRef(Avatar)";
|
|
1505
1510
|
function _responsiveAvatarCounterSizeStyle(props) {
|
|
1506
1511
|
const { avatar, media } = getTheme_v2(props.theme);
|
|
1507
1512
|
return _responsive(media, props.$size, (size2) => {
|
|
@@ -1542,7 +1547,9 @@ const Root$A = styled.div(
|
|
|
1542
1547
|
[size2]
|
|
1543
1548
|
);
|
|
1544
1549
|
return /* @__PURE__ */ jsx(Root$A, { $size: size2, "data-ui": "AvatarCounter", ref, children: /* @__PURE__ */ jsx(Label, { as: "span", size: fontSize2, weight: "medium", children: count }) });
|
|
1545
|
-
})
|
|
1550
|
+
});
|
|
1551
|
+
AvatarCounter.displayName = "ForwardRef(AvatarCounter)";
|
|
1552
|
+
const BASE_STYLES = css`
|
|
1546
1553
|
white-space: nowrap;
|
|
1547
1554
|
|
|
1548
1555
|
& > div {
|
|
@@ -1582,7 +1589,9 @@ const Root$z = styled.div(responsiveAvatarStackSizeStyle, avatarStackStyle), Ava
|
|
|
1582
1589
|
len !== 0 && extraCount > 1 && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(AvatarCounter, { count: extraCount, size: size2 }) }),
|
|
1583
1590
|
visibleChildren.map((child, childIndex) => /* @__PURE__ */ jsx("div", { children: cloneElement(child, { size: size2 }) }, String(childIndex)))
|
|
1584
1591
|
] });
|
|
1585
|
-
})
|
|
1592
|
+
});
|
|
1593
|
+
AvatarStack.displayName = "ForwardRef(AvatarStack)";
|
|
1594
|
+
const Root$y = styled.div(
|
|
1586
1595
|
boxStyle,
|
|
1587
1596
|
flexItemStyle,
|
|
1588
1597
|
responsiveBoxStyle,
|
|
@@ -1656,6 +1665,7 @@ const Root$z = styled.div(responsiveAvatarStackSizeStyle, avatarStackStyle), Ava
|
|
|
1656
1665
|
}
|
|
1657
1666
|
);
|
|
1658
1667
|
});
|
|
1668
|
+
Box.displayName = "ForwardRef(Box)";
|
|
1659
1669
|
function textBaseStyle(props) {
|
|
1660
1670
|
const { $accent, $muted } = props, { font } = getTheme_v2(props.theme);
|
|
1661
1671
|
return css`
|
|
@@ -1756,6 +1766,7 @@ const Root$x = styled.div(
|
|
|
1756
1766
|
}
|
|
1757
1767
|
);
|
|
1758
1768
|
});
|
|
1769
|
+
Text.displayName = "ForwardRef(Text)";
|
|
1759
1770
|
function badgeStyle(props) {
|
|
1760
1771
|
const { $tone } = props;
|
|
1761
1772
|
return {
|
|
@@ -1795,7 +1806,9 @@ const Root$w = styled(Box)(
|
|
|
1795
1806
|
children: /* @__PURE__ */ jsx(Text, { size: fontSize2, children })
|
|
1796
1807
|
}
|
|
1797
1808
|
);
|
|
1798
|
-
})
|
|
1809
|
+
});
|
|
1810
|
+
Badge.displayName = "ForwardRef(Badge)";
|
|
1811
|
+
const Root$v = styled(Box)(
|
|
1799
1812
|
flexItemStyle,
|
|
1800
1813
|
responsiveFlexStyle
|
|
1801
1814
|
), Flex = forwardRef(function(props, ref) {
|
|
@@ -1814,7 +1827,9 @@ const Root$w = styled(Box)(
|
|
|
1814
1827
|
ref
|
|
1815
1828
|
}
|
|
1816
1829
|
);
|
|
1817
|
-
})
|
|
1830
|
+
});
|
|
1831
|
+
Flex.displayName = "ForwardRef(Flex)";
|
|
1832
|
+
const rotate$1 = keyframes`
|
|
1818
1833
|
from {
|
|
1819
1834
|
transform: rotate(0deg);
|
|
1820
1835
|
}
|
|
@@ -1829,6 +1844,7 @@ const Root$w = styled(Box)(
|
|
|
1829
1844
|
`, Spinner = forwardRef(function(props, ref) {
|
|
1830
1845
|
return /* @__PURE__ */ jsx(Root$u, { "data-ui": "Spinner", ...props, ref, children: /* @__PURE__ */ jsx(SpinnerIcon, {}) });
|
|
1831
1846
|
});
|
|
1847
|
+
Spinner.displayName = "ForwardRef(Spinner)";
|
|
1832
1848
|
function _cardColorStyle(base, color, checkered = !1) {
|
|
1833
1849
|
return {
|
|
1834
1850
|
// from base
|
|
@@ -2082,6 +2098,7 @@ const Root$t = styled.button(responsiveRadiusStyle, buttonBaseStyles, buttonColo
|
|
|
2082
2098
|
}
|
|
2083
2099
|
);
|
|
2084
2100
|
});
|
|
2101
|
+
Button.displayName = "ForwardRef(Button)";
|
|
2085
2102
|
function cardStyle(props) {
|
|
2086
2103
|
return [cardBaseStyle(props), cardColorStyle(props)];
|
|
2087
2104
|
}
|
|
@@ -2255,6 +2272,7 @@ const Root$s = styled(Box)(responsiveBorderStyle, responsiveRadiusStyle, respons
|
|
|
2255
2272
|
}
|
|
2256
2273
|
) });
|
|
2257
2274
|
});
|
|
2275
|
+
Card.displayName = "ForwardRef(Card)";
|
|
2258
2276
|
function checkboxBaseStyles() {
|
|
2259
2277
|
return css`
|
|
2260
2278
|
position: relative;
|
|
@@ -2410,6 +2428,7 @@ const Root$r = styled.div(checkboxBaseStyles), Input$5 = styled.input(inputEleme
|
|
|
2410
2428
|
] })
|
|
2411
2429
|
] });
|
|
2412
2430
|
});
|
|
2431
|
+
Checkbox.displayName = "ForwardRef(Checkbox)";
|
|
2413
2432
|
function codeSyntaxHighlightingStyle({ theme }) {
|
|
2414
2433
|
const {
|
|
2415
2434
|
color: { syntax: color }
|
|
@@ -2488,7 +2507,9 @@ const Root$q = styled.pre(codeBaseStyle, responsiveCodeFontStyle), Code = forwar
|
|
|
2488
2507
|
!(language && registered) && /* @__PURE__ */ jsx("code", { children }),
|
|
2489
2508
|
language && registered && /* @__PURE__ */ jsx(Refractor, { inline: !0, language, value: String(children) })
|
|
2490
2509
|
] });
|
|
2491
|
-
})
|
|
2510
|
+
});
|
|
2511
|
+
Code.displayName = "ForwardRef(Code)";
|
|
2512
|
+
const BASE_STYLE$1 = {
|
|
2492
2513
|
width: "100%",
|
|
2493
2514
|
margin: "0 auto"
|
|
2494
2515
|
};
|
|
@@ -2516,7 +2537,9 @@ const Root$p = styled(Box)(
|
|
|
2516
2537
|
ref
|
|
2517
2538
|
}
|
|
2518
2539
|
);
|
|
2519
|
-
})
|
|
2540
|
+
});
|
|
2541
|
+
Container.displayName = "ForwardRef(Container)";
|
|
2542
|
+
const Root$o = styled(Box)(responsiveGridStyle), Grid = forwardRef(function(props, ref) {
|
|
2520
2543
|
const { as, autoRows, autoCols, autoFlow, columns, gap, gapX, gapY, rows, children, ...restProps } = props;
|
|
2521
2544
|
return /* @__PURE__ */ jsx(
|
|
2522
2545
|
Root$o,
|
|
@@ -2538,6 +2561,7 @@ const Root$p = styled(Box)(
|
|
|
2538
2561
|
}
|
|
2539
2562
|
);
|
|
2540
2563
|
});
|
|
2564
|
+
Grid.displayName = "ForwardRef(Grid)";
|
|
2541
2565
|
function headingBaseStyle(props) {
|
|
2542
2566
|
const { $accent, $muted } = props, { font } = getTheme_v2(props.theme);
|
|
2543
2567
|
return css`
|
|
@@ -2625,6 +2649,7 @@ const Root$n = styled.div(headingBaseStyle, responsiveTextAlignStyle, responsive
|
|
|
2625
2649
|
}
|
|
2626
2650
|
);
|
|
2627
2651
|
});
|
|
2652
|
+
Heading.displayName = "ForwardRef(Heading)";
|
|
2628
2653
|
function inlineBaseStyle() {
|
|
2629
2654
|
return {
|
|
2630
2655
|
lineHeight: 0,
|
|
@@ -2664,6 +2689,7 @@ const Root$m = styled(Box)(inlineBaseStyle, inlineSpaceStyle), Inline = forwardR
|
|
|
2664
2689
|
}
|
|
2665
2690
|
);
|
|
2666
2691
|
});
|
|
2692
|
+
Inline.displayName = "ForwardRef(Inline)";
|
|
2667
2693
|
function kbdStyle() {
|
|
2668
2694
|
return css`
|
|
2669
2695
|
--card-bg-color: var(--card-kbd-bg-color);
|
|
@@ -2684,7 +2710,9 @@ function kbdStyle() {
|
|
|
2684
2710
|
const Root$l = styled.kbd(responsiveRadiusStyle, kbdStyle), KBD = forwardRef(function(props, ref) {
|
|
2685
2711
|
const { children, fontSize: fontSize2 = 0, padding = 1, radius = 2, ...restProps } = props;
|
|
2686
2712
|
return /* @__PURE__ */ jsx(Root$l, { "data-ui": "KBD", ...restProps, $radius: useArrayProp(radius), ref, children: /* @__PURE__ */ jsx(Box, { as: "span", padding, children: /* @__PURE__ */ jsx(Text, { as: "span", size: fontSize2, weight: "semibold", children }) }) });
|
|
2687
|
-
})
|
|
2713
|
+
});
|
|
2714
|
+
KBD.displayName = "ForwardRef(KBD)";
|
|
2715
|
+
const origin = {
|
|
2688
2716
|
name: "@sanity/ui/origin",
|
|
2689
2717
|
fn({ middlewareData, placement, rects }) {
|
|
2690
2718
|
var _a, _b;
|
|
@@ -2825,7 +2853,9 @@ const Root$k = styled.div(
|
|
|
2825
2853
|
/* @__PURE__ */ jsx(StrokePath, { d: strokePath, mask: "url(#stroke-mask)", strokeWidth: strokeWidth * 2 }),
|
|
2826
2854
|
/* @__PURE__ */ jsx(ShapePath, { d: fillPath })
|
|
2827
2855
|
] }) });
|
|
2828
|
-
})
|
|
2856
|
+
});
|
|
2857
|
+
Arrow.displayName = "ForwardRef(Arrow)";
|
|
2858
|
+
const BoundaryElementContext = createGlobalScopedContext(
|
|
2829
2859
|
"@sanity/ui/context/boundaryElement",
|
|
2830
2860
|
null
|
|
2831
2861
|
);
|
|
@@ -2833,6 +2863,7 @@ function BoundaryElementProvider(props) {
|
|
|
2833
2863
|
const { children, element } = props, value = useMemo(() => ({ version: 0, element }), [element]);
|
|
2834
2864
|
return /* @__PURE__ */ jsx(BoundaryElementContext.Provider, { value, children });
|
|
2835
2865
|
}
|
|
2866
|
+
BoundaryElementProvider.displayName = "BoundaryElementProvider";
|
|
2836
2867
|
function isRecord(value) {
|
|
2837
2868
|
return !!(value && typeof value == "object" && !Array.isArray(value));
|
|
2838
2869
|
}
|
|
@@ -2853,6 +2884,7 @@ function ConditionalWrapper({
|
|
|
2853
2884
|
}) {
|
|
2854
2885
|
return condition ? wrapper(children) : children;
|
|
2855
2886
|
}
|
|
2887
|
+
ConditionalWrapper.displayName = "ConditionalWrapper";
|
|
2856
2888
|
function findMaxBreakpoints(media, width) {
|
|
2857
2889
|
const ret = [];
|
|
2858
2890
|
for (let i = 0; i < media.length; i += 1)
|
|
@@ -2886,6 +2918,7 @@ const ElementQuery = forwardRef(function(props, forwardedRef) {
|
|
|
2886
2918
|
}
|
|
2887
2919
|
);
|
|
2888
2920
|
});
|
|
2921
|
+
ElementQuery.displayName = "ForwardRef(ElementQuery)";
|
|
2889
2922
|
var __defProp = Object.defineProperty, __defNormalProp = (obj, key2, value) => key2 in obj ? __defProp(obj, key2, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key2] = value, __publicField = (obj, key2, value) => __defNormalProp(obj, key2 + "", value);
|
|
2890
2923
|
class ErrorBoundary extends Component {
|
|
2891
2924
|
constructor() {
|
|
@@ -3036,6 +3069,7 @@ function LayerProvider(props) {
|
|
|
3036
3069
|
);
|
|
3037
3070
|
return /* @__PURE__ */ jsx(LayerContext.Provider, { value, children });
|
|
3038
3071
|
}
|
|
3072
|
+
LayerProvider.displayName = "LayerProvider";
|
|
3039
3073
|
const Root$j = styled.div({ position: "relative" }), LayerChildren = forwardRef(function(props, forwardedRef) {
|
|
3040
3074
|
const { children, onActivate, onFocus, style = EMPTY_RECORD, ...restProps } = props, { zIndex, isTopLayer } = useLayer(), lastFocusedRef = useRef(null), ref = useRef(null), isTopLayerRef = useRef(isTopLayer);
|
|
3041
3075
|
useImperativeHandle(forwardedRef, () => ref.current), useEffect(() => {
|
|
@@ -3053,7 +3087,9 @@ const Root$j = styled.div({ position: "relative" }), LayerChildren = forwardRef(
|
|
|
3053
3087
|
}), Layer = forwardRef(function(props, ref) {
|
|
3054
3088
|
const { children, zOffset = 1, ...restProps } = props;
|
|
3055
3089
|
return /* @__PURE__ */ jsx(LayerProvider, { zOffset, children: /* @__PURE__ */ jsx(LayerChildren, { ...restProps, ref, children }) });
|
|
3056
|
-
})
|
|
3090
|
+
});
|
|
3091
|
+
Layer.displayName = "ForwardRef(Layer)";
|
|
3092
|
+
const key = "@sanity/ui/context/portal", elementKey = Symbol.for(`${key}/element`);
|
|
3057
3093
|
globalScope[elementKey] = null;
|
|
3058
3094
|
const defaultContextValue = {
|
|
3059
3095
|
version: 0,
|
|
@@ -3075,6 +3111,7 @@ function Portal(props) {
|
|
|
3075
3111
|
const { children, __unstable_name: name } = props, portal = usePortal(), portalElement = (name ? portal.elements && portal.elements[name] : portal.element) || ((_a = portal.elements) == null ? void 0 : _a.default);
|
|
3076
3112
|
return portalElement ? createPortal(children, portalElement) : null;
|
|
3077
3113
|
}
|
|
3114
|
+
Portal.displayName = "Portal";
|
|
3078
3115
|
function PortalProvider(props) {
|
|
3079
3116
|
const { boundaryElement, children, element, __unstable_elements: elementsProp } = props, elements = useUnique(elementsProp), fallbackElement = useSyncExternalStore(
|
|
3080
3117
|
emptySubscribe,
|
|
@@ -3088,6 +3125,7 @@ function PortalProvider(props) {
|
|
|
3088
3125
|
}), [boundaryElement, element, elements, fallbackElement]);
|
|
3089
3126
|
return /* @__PURE__ */ jsx(PortalContext.Provider, { value, children });
|
|
3090
3127
|
}
|
|
3128
|
+
PortalProvider.displayName = "PortalProvider";
|
|
3091
3129
|
const emptySubscribe = () => () => {
|
|
3092
3130
|
};
|
|
3093
3131
|
function useUnique(value) {
|
|
@@ -3110,7 +3148,9 @@ const Root$i = styled.div`
|
|
|
3110
3148
|
`, SrOnly = forwardRef(function(props, ref) {
|
|
3111
3149
|
const { as, children } = props;
|
|
3112
3150
|
return /* @__PURE__ */ jsx(Root$i, { "aria-hidden": !0, as, "data-ui": "SrOnly", ref, children });
|
|
3113
|
-
})
|
|
3151
|
+
});
|
|
3152
|
+
SrOnly.displayName = "ForwardRef(SrOnly)";
|
|
3153
|
+
const Root$h = styled.div`
|
|
3114
3154
|
position: relative;
|
|
3115
3155
|
`, ItemWrapper = styled.div`
|
|
3116
3156
|
position: absolute;
|
|
@@ -3159,7 +3199,9 @@ const Root$i = styled.div`
|
|
|
3159
3199
|
return /* @__PURE__ */ jsx(ItemWrapper, { style: { top: itemIndex * (itemHeight + space[gap]) }, children: node }, key2);
|
|
3160
3200
|
}), [fromIndex, gap, getItemKey, itemHeight, items, renderItem, space, toIndex]), wrapperStyle = useMemo(() => ({ height }), [height]);
|
|
3161
3201
|
return /* @__PURE__ */ jsx(Root$h, { as, "data-ui": "VirtualList", ...restProps, ref, children: /* @__PURE__ */ jsx("div", { ref: wrapperRef, style: wrapperStyle, children }) });
|
|
3162
|
-
})
|
|
3202
|
+
});
|
|
3203
|
+
VirtualList.displayName = "ForwardRef(VirtualList)";
|
|
3204
|
+
const DEFAULT_POPOVER_DISTANCE = 4, DEFAULT_POPOVER_PADDING = 4, DEFAULT_POPOVER_ARROW_WIDTH = 19, DEFAULT_POPOVER_ARROW_HEIGHT = 8, DEFAULT_POPOVER_ARROW_RADIUS = 2, DEFAULT_POPOVER_MARGINS = [0, 0, 0, 0], DEFAULT_FALLBACK_PLACEMENTS$1 = {
|
|
3163
3205
|
top: ["bottom", "left", "right"],
|
|
3164
3206
|
"top-start": ["bottom-start", "left-start", "right-start"],
|
|
3165
3207
|
"top-end": ["bottom-end", "left-end", "right-end"],
|
|
@@ -3302,7 +3344,7 @@ const MotionCard$1 = styled(motion(Card))`
|
|
|
3302
3344
|
);
|
|
3303
3345
|
})
|
|
3304
3346
|
);
|
|
3305
|
-
PopoverCard.displayName = "PopoverCard";
|
|
3347
|
+
PopoverCard.displayName = "Memo(ForwardRef(PopoverCard))";
|
|
3306
3348
|
const Popover = memo(
|
|
3307
3349
|
forwardRef(function(props, forwardedRef) {
|
|
3308
3350
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
@@ -3486,7 +3528,7 @@ const Popover = memo(
|
|
|
3486
3528
|
] });
|
|
3487
3529
|
})
|
|
3488
3530
|
);
|
|
3489
|
-
Popover.displayName = "Popover";
|
|
3531
|
+
Popover.displayName = "Memo(ForwardRef(Popover))";
|
|
3490
3532
|
function radioBaseStyle() {
|
|
3491
3533
|
return css`
|
|
3492
3534
|
position: relative;
|
|
@@ -3616,6 +3658,7 @@ const Root$g = styled.div(radioBaseStyle), Input$4 = styled.input(inputElementSt
|
|
|
3616
3658
|
/* @__PURE__ */ jsx("span", {})
|
|
3617
3659
|
] });
|
|
3618
3660
|
});
|
|
3661
|
+
Radio.displayName = "ForwardRef(Radio)";
|
|
3619
3662
|
function rootStyle() {
|
|
3620
3663
|
return css`
|
|
3621
3664
|
position: relative;
|
|
@@ -3783,7 +3826,9 @@ const selectStyle = {
|
|
|
3783
3826
|
),
|
|
3784
3827
|
/* @__PURE__ */ jsx(IconBox, { padding, children: /* @__PURE__ */ jsx(Text, { size: fontSize2, children: /* @__PURE__ */ jsx(ChevronDownIcon, {}) }) })
|
|
3785
3828
|
] });
|
|
3786
|
-
})
|
|
3829
|
+
});
|
|
3830
|
+
Select.displayName = "ForwardRef(Select)";
|
|
3831
|
+
const BASE_STYLE = {
|
|
3787
3832
|
"&&:not([hidden])": {
|
|
3788
3833
|
display: "grid"
|
|
3789
3834
|
},
|
|
@@ -3816,6 +3861,7 @@ const Root$e = styled(Box)(stackBaseStyle, responsiveStackSpaceStyle), Stack = f
|
|
|
3816
3861
|
}
|
|
3817
3862
|
);
|
|
3818
3863
|
});
|
|
3864
|
+
Stack.displayName = "ForwardRef(Stack)";
|
|
3819
3865
|
function switchBaseStyles() {
|
|
3820
3866
|
return css`
|
|
3821
3867
|
position: relative;
|
|
@@ -3982,7 +4028,9 @@ const Root$d = styled.span(switchBaseStyles), Input$2 = styled.input(switchInput
|
|
|
3982
4028
|
/* @__PURE__ */ jsx(Thumb, { $checked: checked, $indeterminate: indeterminate })
|
|
3983
4029
|
] })
|
|
3984
4030
|
] });
|
|
3985
|
-
})
|
|
4031
|
+
});
|
|
4032
|
+
Switch.displayName = "ForwardRef(Switch)";
|
|
4033
|
+
const Root$c = styled.span(textInputRootStyle), InputRoot$1 = styled.span`
|
|
3986
4034
|
flex: 1;
|
|
3987
4035
|
min-width: 0;
|
|
3988
4036
|
display: block;
|
|
@@ -4040,7 +4088,9 @@ const Root$d = styled.span(switchBaseStyles), Input$2 = styled.input(switchInput
|
|
|
4040
4088
|
}
|
|
4041
4089
|
)
|
|
4042
4090
|
] }) });
|
|
4043
|
-
})
|
|
4091
|
+
});
|
|
4092
|
+
TextArea.displayName = "ForwardRef(TextArea)";
|
|
4093
|
+
const CLEAR_BUTTON_BOX_STYLE = { zIndex: 2 }, Root$b = styled(Card).attrs({ forwardedAs: "span" })(textInputRootStyle), InputRoot = styled.span`
|
|
4044
4094
|
flex: 1;
|
|
4045
4095
|
min-width: 0;
|
|
4046
4096
|
display: block;
|
|
@@ -4240,6 +4290,7 @@ const Root$d = styled.span(switchBaseStyles), Input$2 = styled.input(switchInput
|
|
|
4240
4290
|
suffixNode
|
|
4241
4291
|
] });
|
|
4242
4292
|
});
|
|
4293
|
+
TextInput.displayName = "ForwardRef(TextInput)";
|
|
4243
4294
|
function useDelayedState(initialState) {
|
|
4244
4295
|
const [state, setState] = useState(initialState), delayedAction = useRef(), onStateChange = useCallback((nextState, delay) => {
|
|
4245
4296
|
const action = () => {
|
|
@@ -4333,7 +4384,7 @@ const DEFAULT_TOOLTIP_ARROW_WIDTH = 15, DEFAULT_TOOLTIP_ARROW_HEIGHT = 6, DEFAUL
|
|
|
4333
4384
|
);
|
|
4334
4385
|
})
|
|
4335
4386
|
);
|
|
4336
|
-
TooltipCard.displayName = "TooltipCard";
|
|
4387
|
+
TooltipCard.displayName = "Memo(ForwardRef(TooltipCard))";
|
|
4337
4388
|
const TooltipDelayGroupContext = createGlobalScopedContext(
|
|
4338
4389
|
"@sanity/ui/context/tooltipDelayGroup",
|
|
4339
4390
|
null
|
|
@@ -4356,6 +4407,7 @@ function TooltipDelayGroupProvider(props) {
|
|
|
4356
4407
|
);
|
|
4357
4408
|
return /* @__PURE__ */ jsx(TooltipDelayGroupContext.Provider, { value, children });
|
|
4358
4409
|
}
|
|
4410
|
+
TooltipDelayGroupProvider.displayName = "TooltipDelayGroupProvider";
|
|
4359
4411
|
const Root$a = styled(Layer)`
|
|
4360
4412
|
pointer-events: none;
|
|
4361
4413
|
`, Tooltip = forwardRef(function(props, forwardedRef) {
|
|
@@ -4555,6 +4607,7 @@ const Root$a = styled(Layer)`
|
|
|
4555
4607
|
child
|
|
4556
4608
|
] });
|
|
4557
4609
|
});
|
|
4610
|
+
Tooltip.displayName = "ForwardRef(Tooltip)";
|
|
4558
4611
|
function useCloseOnMouseLeave({
|
|
4559
4612
|
handleIsOpenChange,
|
|
4560
4613
|
referenceElement,
|
|
@@ -4970,7 +5023,9 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
4970
5023
|
]
|
|
4971
5024
|
}
|
|
4972
5025
|
);
|
|
4973
|
-
})
|
|
5026
|
+
});
|
|
5027
|
+
InnerAutocomplete.displayName = "ForwardRef(Autocomplete)";
|
|
5028
|
+
const Autocomplete = InnerAutocomplete, Root$8 = styled.ol`
|
|
4974
5029
|
margin: 0;
|
|
4975
5030
|
padding: 0;
|
|
4976
5031
|
display: flex;
|
|
@@ -5024,6 +5079,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
5024
5079
|
/* @__PURE__ */ jsx(Box, { as: "li", children: item })
|
|
5025
5080
|
] }, itemIndex)) });
|
|
5026
5081
|
});
|
|
5082
|
+
Breadcrumbs.displayName = "ForwardRef(Breadcrumbs)";
|
|
5027
5083
|
function dialogStyle({ theme }) {
|
|
5028
5084
|
const { color } = getTheme_v2(theme);
|
|
5029
5085
|
return {
|
|
@@ -5171,7 +5227,9 @@ const Root$7 = styled(Layer)(responsivePaddingStyle, dialogStyle, responsiveDial
|
|
|
5171
5227
|
/* @__PURE__ */ jsx(DialogContent, { flex: 1, ref: contentRef, tabIndex: -1, children }),
|
|
5172
5228
|
footer && /* @__PURE__ */ jsx(DialogFooter, { children: footer })
|
|
5173
5229
|
] }) }) });
|
|
5174
|
-
})
|
|
5230
|
+
});
|
|
5231
|
+
DialogCard.displayName = "ForwardRef(DialogCard)";
|
|
5232
|
+
const Dialog = forwardRef(function(props, ref) {
|
|
5175
5233
|
var _a;
|
|
5176
5234
|
const dialog = useDialog(), { layer } = useTheme_v2(), {
|
|
5177
5235
|
__unstable_autoFocus: autoFocus = !0,
|
|
@@ -5268,6 +5326,7 @@ const Root$7 = styled(Layer)(responsivePaddingStyle, dialogStyle, responsiveDial
|
|
|
5268
5326
|
}
|
|
5269
5327
|
) });
|
|
5270
5328
|
});
|
|
5329
|
+
Dialog.displayName = "ForwardRef(Dialog)";
|
|
5271
5330
|
function DialogProvider(props) {
|
|
5272
5331
|
const { children, position, zOffset } = props, contextValue = useMemo(
|
|
5273
5332
|
() => ({
|
|
@@ -5279,6 +5338,7 @@ function DialogProvider(props) {
|
|
|
5279
5338
|
);
|
|
5280
5339
|
return /* @__PURE__ */ jsx(DialogContext.Provider, { value: contextValue, children });
|
|
5281
5340
|
}
|
|
5341
|
+
DialogProvider.displayName = "DialogProvider";
|
|
5282
5342
|
const Root$6 = styled.kbd`
|
|
5283
5343
|
font: inherit;
|
|
5284
5344
|
padding: 1px;
|
|
@@ -5293,7 +5353,9 @@ const Root$6 = styled.kbd`
|
|
|
5293
5353
|
`, Hotkeys = forwardRef(function(props, ref) {
|
|
5294
5354
|
const { fontSize: fontSize2, keys, padding, radius, space: spaceProp = 0.5, ...restProps } = props, space = useArrayProp(spaceProp);
|
|
5295
5355
|
return !keys || keys.length === 0 ? /* @__PURE__ */ jsx(Fragment, {}) : /* @__PURE__ */ jsx(Root$6, { "data-ui": "Hotkeys", ...restProps, ref, children: /* @__PURE__ */ jsx(Inline, { as: "span", space, children: keys.map((key2, i) => /* @__PURE__ */ jsx(Key, { fontSize: fontSize2, padding, radius, children: key2 }, i)) }) });
|
|
5296
|
-
})
|
|
5356
|
+
});
|
|
5357
|
+
Hotkeys.displayName = "ForwardRef(Hotkeys)";
|
|
5358
|
+
const MenuContext = createGlobalScopedContext(
|
|
5297
5359
|
"@sanity/ui/context/menu",
|
|
5298
5360
|
null
|
|
5299
5361
|
);
|
|
@@ -5334,13 +5396,13 @@ function _sortElements(rootElement, elements) {
|
|
|
5334
5396
|
elements.sort(_sort);
|
|
5335
5397
|
}
|
|
5336
5398
|
function useMenuController(props) {
|
|
5337
|
-
const { onKeyDown, originElement, shouldFocus } = props, elementsRef = useRef([]), [
|
|
5399
|
+
const { onKeyDown, originElement, shouldFocus, rootElementRef } = props, elementsRef = useRef([]), [activeIndex, _setActiveIndex] = useState(-1), activeIndexRef = useRef(activeIndex), activeElement = useMemo(() => elementsRef.current[activeIndex] || null, [activeIndex]), mounted = !!rootElementRef.current, setActiveIndex = useCallback((nextActiveIndex) => {
|
|
5338
5400
|
_setActiveIndex(nextActiveIndex), activeIndexRef.current = nextActiveIndex;
|
|
5339
5401
|
}, []), mount = useCallback(
|
|
5340
5402
|
(element, selected) => {
|
|
5341
5403
|
if (!element) return () => {
|
|
5342
5404
|
};
|
|
5343
|
-
if (elementsRef.current.indexOf(element) === -1 && (elementsRef.current.push(element), _sortElements(
|
|
5405
|
+
if (elementsRef.current.indexOf(element) === -1 && (elementsRef.current.push(element), _sortElements(rootElementRef.current, elementsRef.current)), selected) {
|
|
5344
5406
|
const selectedIndex = elementsRef.current.indexOf(element);
|
|
5345
5407
|
setActiveIndex(selectedIndex);
|
|
5346
5408
|
}
|
|
@@ -5349,7 +5411,7 @@ function useMenuController(props) {
|
|
|
5349
5411
|
idx > -1 && elementsRef.current.splice(idx, 1);
|
|
5350
5412
|
};
|
|
5351
5413
|
},
|
|
5352
|
-
[
|
|
5414
|
+
[rootElementRef, setActiveIndex]
|
|
5353
5415
|
), handleKeyDown = useCallback(
|
|
5354
5416
|
(event) => {
|
|
5355
5417
|
if (event.key === "Tab") {
|
|
@@ -5404,44 +5466,40 @@ function useMenuController(props) {
|
|
|
5404
5466
|
},
|
|
5405
5467
|
[setActiveIndex]
|
|
5406
5468
|
), handleItemMouseLeave = useCallback(() => {
|
|
5407
|
-
|
|
5408
|
-
|
|
5469
|
+
var _a;
|
|
5470
|
+
setActiveIndex(-2), (_a = rootElementRef.current) == null || _a.focus();
|
|
5471
|
+
}, [rootElementRef, setActiveIndex]);
|
|
5409
5472
|
return useEffect(() => {
|
|
5410
5473
|
if (!mounted) return;
|
|
5411
|
-
const rafId =
|
|
5412
|
-
|
|
5413
|
-
if (_activeIndex === -1) {
|
|
5474
|
+
const rafId = requestAnimationFrame(() => {
|
|
5475
|
+
if (activeIndex === -1) {
|
|
5414
5476
|
if (shouldFocus === "first") {
|
|
5415
5477
|
const el = _getFocusableElements(elementsRef.current)[0];
|
|
5416
5478
|
if (el) {
|
|
5417
5479
|
const currentIndex = elementsRef.current.indexOf(el);
|
|
5418
|
-
setActiveIndex(currentIndex)
|
|
5480
|
+
setActiveIndex(currentIndex);
|
|
5419
5481
|
}
|
|
5420
5482
|
}
|
|
5421
5483
|
if (shouldFocus === "last") {
|
|
5422
5484
|
const focusableElements = _getFocusableElements(elementsRef.current), el = focusableElements[focusableElements.length - 1];
|
|
5423
5485
|
if (el) {
|
|
5424
5486
|
const currentIndex = elementsRef.current.indexOf(el);
|
|
5425
|
-
setActiveIndex(currentIndex)
|
|
5487
|
+
setActiveIndex(currentIndex);
|
|
5426
5488
|
}
|
|
5427
5489
|
}
|
|
5428
5490
|
return;
|
|
5429
5491
|
}
|
|
5430
|
-
const element = elementsRef.current[
|
|
5492
|
+
const element = elementsRef.current[activeIndex] || null;
|
|
5431
5493
|
element == null || element.focus();
|
|
5432
5494
|
});
|
|
5433
|
-
return () =>
|
|
5434
|
-
window.cancelAnimationFrame(rafId);
|
|
5435
|
-
};
|
|
5495
|
+
return () => cancelAnimationFrame(rafId);
|
|
5436
5496
|
}, [activeIndex, mounted, setActiveIndex, shouldFocus]), {
|
|
5437
5497
|
activeElement,
|
|
5438
5498
|
activeIndex,
|
|
5439
5499
|
handleItemMouseEnter,
|
|
5440
5500
|
handleItemMouseLeave,
|
|
5441
5501
|
handleKeyDown,
|
|
5442
|
-
mount
|
|
5443
|
-
rootElement,
|
|
5444
|
-
setRootElement
|
|
5502
|
+
mount
|
|
5445
5503
|
};
|
|
5446
5504
|
}
|
|
5447
5505
|
const Root$5 = styled(Box)`
|
|
@@ -5473,34 +5531,23 @@ const Root$5 = styled(Box)`
|
|
|
5473
5531
|
handleItemMouseEnter,
|
|
5474
5532
|
handleItemMouseLeave,
|
|
5475
5533
|
handleKeyDown,
|
|
5476
|
-
mount
|
|
5477
|
-
|
|
5478
|
-
setRootElement
|
|
5479
|
-
} = useMenuController({ onKeyDown, originElement, shouldFocus }), handleRefChange = useCallback(
|
|
5534
|
+
mount
|
|
5535
|
+
} = useMenuController({ onKeyDown, originElement, shouldFocus, rootElementRef: ref }), unregisterElementRef = useRef(null), handleRefChange = useCallback(
|
|
5480
5536
|
(el) => {
|
|
5481
|
-
|
|
5537
|
+
unregisterElementRef.current && (unregisterElementRef.current(), unregisterElementRef.current = null), ref.current = el, ref.current && registerElement && (unregisterElementRef.current = registerElement(ref.current));
|
|
5482
5538
|
},
|
|
5483
|
-
[
|
|
5539
|
+
[registerElement]
|
|
5484
5540
|
);
|
|
5485
5541
|
useEffect(() => {
|
|
5486
5542
|
onItemSelect && onItemSelect(activeIndex);
|
|
5487
|
-
}, [activeIndex, onItemSelect]),
|
|
5488
|
-
useCallback(
|
|
5489
|
-
(event) => isTopLayer && onClickOutside && onClickOutside(event),
|
|
5490
|
-
[isTopLayer, onClickOutside]
|
|
5491
|
-
),
|
|
5492
|
-
[rootElement]
|
|
5493
|
-
), useGlobalKeyDown(
|
|
5543
|
+
}, [activeIndex, onItemSelect]), useClickOutsideEvent(isTopLayer && onClickOutside, () => [ref.current]), useGlobalKeyDown(
|
|
5494
5544
|
useCallback(
|
|
5495
5545
|
(event) => {
|
|
5496
5546
|
isTopLayer && event.key === "Escape" && (event.stopPropagation(), onEscape && onEscape());
|
|
5497
5547
|
},
|
|
5498
5548
|
[isTopLayer, onEscape]
|
|
5499
5549
|
)
|
|
5500
|
-
)
|
|
5501
|
-
if (!(!rootElement || !registerElement))
|
|
5502
|
-
return registerElement(rootElement);
|
|
5503
|
-
}, [registerElement, rootElement]);
|
|
5550
|
+
);
|
|
5504
5551
|
const value = useMemo(
|
|
5505
5552
|
() => ({
|
|
5506
5553
|
version: 0,
|
|
@@ -5542,7 +5589,9 @@ const Root$5 = styled(Box)`
|
|
|
5542
5589
|
children: /* @__PURE__ */ jsx(Stack, { space, children })
|
|
5543
5590
|
}
|
|
5544
5591
|
) });
|
|
5545
|
-
})
|
|
5592
|
+
});
|
|
5593
|
+
Menu.displayName = "ForwardRef(Menu)";
|
|
5594
|
+
const MenuButton = forwardRef(function(props, forwardedRef) {
|
|
5546
5595
|
const {
|
|
5547
5596
|
__unstable_disableRestoreFocusOnClose: disableRestoreFocusOnClose = !1,
|
|
5548
5597
|
boundaryElement: deprecated_boundaryElement,
|
|
@@ -5607,9 +5656,7 @@ const Root$5 = styled(Box)`
|
|
|
5607
5656
|
[menuElements]
|
|
5608
5657
|
), handleItemClick = useCallback(() => {
|
|
5609
5658
|
setOpen(!1), !disableRestoreFocusOnClose && buttonElement && buttonElement.focus();
|
|
5610
|
-
}, [buttonElement, disableRestoreFocusOnClose]), registerElement = useCallback((el) => (setChildMenuElements((els) => els.concat([el])), () =>
|
|
5611
|
-
setChildMenuElements((els) => els.filter((_el) => _el !== el));
|
|
5612
|
-
}), []), menuProps = useMemo(
|
|
5659
|
+
}, [buttonElement, disableRestoreFocusOnClose]), registerElement = useCallback((el) => (setChildMenuElements((els) => els.concat([el])), () => setChildMenuElements((els) => els.filter((_el) => _el !== el))), []), menuProps = useMemo(
|
|
5613
5660
|
() => ({
|
|
5614
5661
|
"aria-labelledby": id,
|
|
5615
5662
|
onBlurCapture: handleBlur,
|
|
@@ -5676,12 +5723,15 @@ const Root$5 = styled(Box)`
|
|
|
5676
5723
|
]
|
|
5677
5724
|
);
|
|
5678
5725
|
return /* @__PURE__ */ jsx(Popover, { "data-ui": "MenuButton__popover", ...popoverProps, content: menu, open, children: button || /* @__PURE__ */ jsx(Fragment, {}) });
|
|
5679
|
-
})
|
|
5726
|
+
});
|
|
5727
|
+
MenuButton.displayName = "ForwardRef(MenuButton)";
|
|
5728
|
+
const MenuDivider = styled.hr`
|
|
5680
5729
|
height: 1px;
|
|
5681
5730
|
border: 0;
|
|
5682
5731
|
background: var(--card-hairline-soft-color);
|
|
5683
5732
|
margin: 0;
|
|
5684
5733
|
`;
|
|
5734
|
+
MenuDivider.displayName = "MenuDivider";
|
|
5685
5735
|
function selectableBaseStyle() {
|
|
5686
5736
|
return css`
|
|
5687
5737
|
background-color: inherit;
|
|
@@ -5783,6 +5833,7 @@ const Selectable = styled(Box)(
|
|
|
5783
5833
|
selectableBaseStyle,
|
|
5784
5834
|
selectableColorStyle
|
|
5785
5835
|
);
|
|
5836
|
+
Selectable.displayName = "Selectable";
|
|
5786
5837
|
function useMenu() {
|
|
5787
5838
|
const value = useContext(MenuContext);
|
|
5788
5839
|
if (!value)
|
|
@@ -5813,7 +5864,7 @@ function MenuGroup(props) {
|
|
|
5813
5864
|
onItemClick,
|
|
5814
5865
|
onItemMouseEnter = menu.onMouseEnter,
|
|
5815
5866
|
registerElement
|
|
5816
|
-
} = menu, [rootElement, setRootElement] = useState(null), [open, setOpen] = useState(!1),
|
|
5867
|
+
} = menu, [rootElement, setRootElement] = useState(null), [open, setOpen] = useState(!1), [shouldFocus, setShouldFocus] = useState(null), active = !!activeElement && activeElement === rootElement, [withinMenu, setWithinMenu] = useState(!1), handleMouseEnter = useCallback(
|
|
5817
5868
|
(event) => {
|
|
5818
5869
|
setWithinMenu(!1), onItemMouseEnter(event), setOpen(!0);
|
|
5819
5870
|
},
|
|
@@ -5827,19 +5878,21 @@ function MenuGroup(props) {
|
|
|
5827
5878
|
[rootElement]
|
|
5828
5879
|
), handleClick = useCallback(
|
|
5829
5880
|
(event) => {
|
|
5830
|
-
onClick
|
|
5831
|
-
shouldFocusRef.current = null;
|
|
5832
|
-
});
|
|
5881
|
+
onClick == null || onClick(event), setShouldFocus("first"), setOpen(!0);
|
|
5833
5882
|
},
|
|
5834
5883
|
[onClick]
|
|
5835
5884
|
), handleChildItemClick = useCallback(() => {
|
|
5836
|
-
setOpen(!1), onItemClick
|
|
5885
|
+
setOpen(!1), onItemClick == null || onItemClick();
|
|
5837
5886
|
}, [onItemClick]), handleMenuMouseEnter = useCallback(() => setWithinMenu(!0), []);
|
|
5838
5887
|
useEffect(() => mount(rootElement), [mount, rootElement]), useEffect(() => {
|
|
5839
5888
|
active || setOpen(!1);
|
|
5840
5889
|
}, [active]), useEffect(() => {
|
|
5841
5890
|
open || setWithinMenu(!1);
|
|
5842
|
-
}, [open])
|
|
5891
|
+
}, [open]), useEffect(() => {
|
|
5892
|
+
if (!shouldFocus) return;
|
|
5893
|
+
const rafId = requestAnimationFrame(() => setShouldFocus(null));
|
|
5894
|
+
return () => cancelAnimationFrame(rafId);
|
|
5895
|
+
}, [shouldFocus]);
|
|
5843
5896
|
const childMenu = /* @__PURE__ */ jsx(
|
|
5844
5897
|
Menu,
|
|
5845
5898
|
{
|
|
@@ -5849,15 +5902,13 @@ function MenuGroup(props) {
|
|
|
5849
5902
|
onKeyDown: handleMenuKeyDown,
|
|
5850
5903
|
onMouseEnter: handleMenuMouseEnter,
|
|
5851
5904
|
registerElement,
|
|
5852
|
-
shouldFocus
|
|
5905
|
+
shouldFocus,
|
|
5853
5906
|
children
|
|
5854
5907
|
}
|
|
5855
5908
|
), handleKeyDown = useCallback((event) => {
|
|
5856
5909
|
const target = event.currentTarget;
|
|
5857
5910
|
if (document.activeElement === target && event.key === "ArrowRight") {
|
|
5858
|
-
|
|
5859
|
-
shouldFocusRef.current = null;
|
|
5860
|
-
});
|
|
5911
|
+
setShouldFocus("first"), setOpen(!0), setWithinMenu(!0);
|
|
5861
5912
|
return;
|
|
5862
5913
|
}
|
|
5863
5914
|
}, []);
|
|
@@ -5891,6 +5942,7 @@ function MenuGroup(props) {
|
|
|
5891
5942
|
}
|
|
5892
5943
|
) });
|
|
5893
5944
|
}
|
|
5945
|
+
MenuGroup.displayName = "MenuGroup";
|
|
5894
5946
|
const MenuItem = forwardRef(function(props, forwardedRef) {
|
|
5895
5947
|
const {
|
|
5896
5948
|
as = "button",
|
|
@@ -5988,7 +6040,9 @@ const MenuItem = forwardRef(function(props, forwardedRef) {
|
|
|
5988
6040
|
]
|
|
5989
6041
|
}
|
|
5990
6042
|
);
|
|
5991
|
-
})
|
|
6043
|
+
});
|
|
6044
|
+
MenuItem.displayName = "ForwardRef(MenuItem)";
|
|
6045
|
+
const keyframe = keyframes`
|
|
5992
6046
|
0% {
|
|
5993
6047
|
background-position: 100%;
|
|
5994
6048
|
}
|
|
@@ -6048,7 +6102,9 @@ const MenuItem = forwardRef(function(props, forwardedRef) {
|
|
|
6048
6102
|
ref
|
|
6049
6103
|
}
|
|
6050
6104
|
);
|
|
6051
|
-
})
|
|
6105
|
+
});
|
|
6106
|
+
Skeleton.displayName = "ForwardRef(Skeleton)";
|
|
6107
|
+
const Root$3 = styled(Skeleton)((props) => {
|
|
6052
6108
|
const { $size, $style } = props, { font, media } = getTheme_v2(props.theme), fontStyle = font[$style];
|
|
6053
6109
|
return _responsive(media, $size, (sizeIndex) => {
|
|
6054
6110
|
const fontSize2 = fontStyle.sizes[sizeIndex];
|
|
@@ -6057,16 +6113,24 @@ const MenuItem = forwardRef(function(props, forwardedRef) {
|
|
|
6057
6113
|
}), TextSkeleton = forwardRef(function(props, ref) {
|
|
6058
6114
|
const { size: size2 = 2, ...restProps } = props, $size = useArrayProp(size2);
|
|
6059
6115
|
return /* @__PURE__ */ jsx(Root$3, { ...restProps, $size, ref, $style: "text" });
|
|
6060
|
-
})
|
|
6116
|
+
});
|
|
6117
|
+
TextSkeleton.displayName = "ForwardRef(TextSkeleton)";
|
|
6118
|
+
const LabelSkeleton = forwardRef(function(props, ref) {
|
|
6061
6119
|
const { size: size2 = 2, ...restProps } = props, $size = useArrayProp(size2);
|
|
6062
6120
|
return /* @__PURE__ */ jsx(Root$3, { ...restProps, $size, ref, $style: "label" });
|
|
6063
|
-
})
|
|
6121
|
+
});
|
|
6122
|
+
LabelSkeleton.displayName = "ForwardRef(LabelSkeleton)";
|
|
6123
|
+
const HeadingSkeleton = forwardRef(function(props, ref) {
|
|
6064
6124
|
const { size: size2 = 2, ...restProps } = props, $size = useArrayProp(size2);
|
|
6065
6125
|
return /* @__PURE__ */ jsx(Root$3, { ...restProps, $size, ref, $style: "heading" });
|
|
6066
|
-
})
|
|
6126
|
+
});
|
|
6127
|
+
HeadingSkeleton.displayName = "ForwardRef(HeadingSkeleton)";
|
|
6128
|
+
const CodeSkeleton = forwardRef(function(props, ref) {
|
|
6067
6129
|
const { size: size2 = 2, ...restProps } = props, $size = useArrayProp(size2);
|
|
6068
6130
|
return /* @__PURE__ */ jsx(Root$3, { ...restProps, $size, ref, $style: "code" });
|
|
6069
|
-
})
|
|
6131
|
+
});
|
|
6132
|
+
CodeSkeleton.displayName = "ForwardRef(CodeSkeleton)";
|
|
6133
|
+
const CustomButton = styled(Button)`
|
|
6070
6134
|
max-width: 100%;
|
|
6071
6135
|
`, Tab = forwardRef(function(props, forwardedRef) {
|
|
6072
6136
|
const {
|
|
@@ -6118,6 +6182,7 @@ const MenuItem = forwardRef(function(props, forwardedRef) {
|
|
|
6118
6182
|
}
|
|
6119
6183
|
);
|
|
6120
6184
|
});
|
|
6185
|
+
Tab.displayName = "ForwardRef(Tab)";
|
|
6121
6186
|
function _isReactElement(node) {
|
|
6122
6187
|
return !!node;
|
|
6123
6188
|
}
|
|
@@ -6154,7 +6219,9 @@ const CustomInline = styled(Inline)`
|
|
|
6154
6219
|
children: tabs
|
|
6155
6220
|
}
|
|
6156
6221
|
);
|
|
6157
|
-
})
|
|
6222
|
+
});
|
|
6223
|
+
TabList.displayName = "ForwardRef(TabList)";
|
|
6224
|
+
const TabPanel = forwardRef(function(props, ref) {
|
|
6158
6225
|
const { flex, ...restProps } = props;
|
|
6159
6226
|
return /* @__PURE__ */ jsx(
|
|
6160
6227
|
Box,
|
|
@@ -6168,7 +6235,9 @@ const CustomInline = styled(Inline)`
|
|
|
6168
6235
|
children: props.children
|
|
6169
6236
|
}
|
|
6170
6237
|
);
|
|
6171
|
-
})
|
|
6238
|
+
});
|
|
6239
|
+
TabPanel.displayName = "ForwardRef(TabPanel)";
|
|
6240
|
+
const TextBox = styled(Flex)`
|
|
6172
6241
|
overflow-x: auto;
|
|
6173
6242
|
`, loadingAnimation = keyframes`
|
|
6174
6243
|
0% {
|
|
@@ -6176,7 +6245,7 @@ const CustomInline = styled(Inline)`
|
|
|
6176
6245
|
}
|
|
6177
6246
|
100% {
|
|
6178
6247
|
width: 100%;
|
|
6179
|
-
}
|
|
6248
|
+
}
|
|
6180
6249
|
`, LOADING_BAR_HEIGHT = 2;
|
|
6181
6250
|
function rootStyles(props) {
|
|
6182
6251
|
const { color } = getTheme_v2$1(props.theme), loadingBarColor = color.button.default[props.tone].enabled.bg;
|
|
@@ -6262,6 +6331,7 @@ function Toast(props) {
|
|
|
6262
6331
|
}
|
|
6263
6332
|
);
|
|
6264
6333
|
}
|
|
6334
|
+
Toast.displayName = "Toast";
|
|
6265
6335
|
function useMounted() {
|
|
6266
6336
|
return useSyncExternalStore(
|
|
6267
6337
|
subscribe,
|
|
@@ -6368,6 +6438,7 @@ function ToastProvider(props) {
|
|
|
6368
6438
|
)) }) }) }) })
|
|
6369
6439
|
] });
|
|
6370
6440
|
}
|
|
6441
|
+
ToastProvider.displayName = "ToastProvider";
|
|
6371
6442
|
function useToast() {
|
|
6372
6443
|
const value = useContext(ToastContext);
|
|
6373
6444
|
if (!value)
|
|
@@ -6556,7 +6627,7 @@ const TreeContext = createGlobalScopedContext(
|
|
|
6556
6627
|
) });
|
|
6557
6628
|
})
|
|
6558
6629
|
);
|
|
6559
|
-
Tree.displayName = "Tree";
|
|
6630
|
+
Tree.displayName = "Memo(ForwardRef(Tree))";
|
|
6560
6631
|
function treeItemRootStyle() {
|
|
6561
6632
|
return css`
|
|
6562
6633
|
&[role='none'] > [role='treeitem'] {
|
|
@@ -6775,6 +6846,7 @@ const TreeGroup = memo(function(props) {
|
|
|
6775
6846
|
}
|
|
6776
6847
|
);
|
|
6777
6848
|
});
|
|
6849
|
+
TreeItem.displayName = "Memo(TreeItem)";
|
|
6778
6850
|
export {
|
|
6779
6851
|
Arrow,
|
|
6780
6852
|
Autocomplete,
|