@sanity/ui 3.0.0-static.26 → 3.0.0-static.27
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/_chunks-cjs/_visual-editing.cjs +197 -197
- package/dist/_chunks-cjs/_visual-editing.cjs.map +1 -1
- package/dist/_chunks-es/_visual-editing.js +199 -199
- package/dist/_chunks-es/_visual-editing.js.map +1 -1
- package/dist/_visual-editing.d.cts +1 -0
- package/dist/_visual-editing.d.ts +1 -0
- package/dist/css.cjs +1 -1
- package/dist/css.d.cts +1 -1
- package/dist/css.d.ts +1 -1
- package/dist/css.js +1 -1
- package/dist/index.cjs +141 -141
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +143 -143
- package/dist/index.js.map +1 -1
- package/dist/theme.cjs +2605 -1075
- package/dist/theme.cjs.map +1 -1
- package/dist/theme.d.cts +1 -1
- package/dist/theme.d.ts +1 -1
- package/dist/theme.js +2689 -1159
- package/dist/theme.js.map +1 -1
- package/dist/ui.css +1 -1
- package/exports/_visual-editing.ts +1 -1
- package/package.json +13 -26
- package/src/core/components/dialog/dialog.tsx +2 -9
- package/src/core/components/dialog/dialogCard.tsx +2 -1
- package/src/core/components/index.ts +1 -0
- package/src/core/components/menu/menu.tsx +1 -2
- package/src/core/components/toast/toastLayer.tsx +1 -2
- package/src/core/components/toast/toastProvider.tsx +1 -1
- package/src/core/{utils → components}/virtualList/__workshop__/index.ts +1 -1
- package/src/core/primitives/badge/badge.tsx +2 -1
- package/src/core/primitives/index.ts +3 -0
- package/src/core/{utils → primitives}/layer/__workshop__/index.ts +1 -1
- package/src/core/primitives/popover/__workshop__/SidePanelStory.tsx +1 -0
- package/src/core/primitives/popover/popover.tsx +2 -1
- package/src/core/primitives/popover/popoverLayer.tsx +2 -1
- package/src/core/primitives/stack/stack.tsx +1 -0
- package/src/core/primitives/switch/switch.tsx +1 -1
- package/src/core/primitives/tooltip/tooltip.tsx +2 -1
- package/src/core/primitives/tooltip/tooltipLayer.tsx +2 -1
- package/src/core/utils/getElementRef.ts +1 -0
- package/src/core/utils/index.ts +0 -4
- package/src/css/primitives/avatar/avatar.css.ts +5 -0
- package/src/css/primitives/badge/badge.css.ts +2 -1
- package/src/css/primitives/label/label.css.ts +1 -0
- package/src/css/props/width/types.ts +1 -1
- package/src/css/props/width/width.css.ts +3 -0
- package/src/theme/v2/build/buildTheme.test.ts +8 -8
- package/src/theme/v2/build/buildTheme.ts +32 -7
- /package/src/core/{utils → components}/virtualList/__workshop__/changingProps.tsx +0 -0
- /package/src/core/{utils → components}/virtualList/__workshop__/elementScroll.tsx +0 -0
- /package/src/core/{utils → components}/virtualList/__workshop__/infiniteList.tsx +0 -0
- /package/src/core/{utils → components}/virtualList/__workshop__/windowScrolll.tsx +0 -0
- /package/src/core/{utils → components}/virtualList/index.ts +0 -0
- /package/src/core/{utils → components}/virtualList/virtualList.tsx +0 -0
- /package/src/core/{utils → primitives}/arrow/arrow.tsx +0 -0
- /package/src/core/{utils → primitives}/arrow/cmds.ts +0 -0
- /package/src/core/{utils → primitives}/arrow/index.ts +0 -0
- /package/src/core/{utils → primitives}/layer/__workshop__/_debug.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/__workshop__/multipleRoots.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/__workshop__/nested.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/__workshop__/responsiveZOffset.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/getLayerContext.test.ts +0 -0
- /package/src/core/{utils → primitives}/layer/getLayerContext.ts +0 -0
- /package/src/core/{utils → primitives}/layer/index.ts +0 -0
- /package/src/core/{utils → primitives}/layer/layer.test.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/layer.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/layerCard.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/layerContext.ts +0 -0
- /package/src/core/{utils → primitives}/layer/layerProvider.tsx +0 -0
- /package/src/core/{utils → primitives}/layer/types.ts +0 -0
- /package/src/core/{utils → primitives}/layer/useLayer.ts +0 -0
- /package/src/core/{utils → primitives}/srOnly/index.ts +0 -0
- /package/src/core/{utils → primitives}/srOnly/srOnly.tsx +0 -0
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createColorTheme as createColorTheme$1, hexToRgb as hexToRgb$1, hslToRgb as hslToRgb$1, multiply as multiply$1, parseColor as parseColor$1, rgbToHex as rgbToHex$1, rgbToHsl as rgbToHsl$1, rgba as rgba$1, screen as screen$1 } from "@sanity/ui/theme";
|
|
2
|
-
import { isHTMLAnchorElement, isHTMLInputElement, isHTMLButtonElement, isHTMLSelectElement, isHTMLTextAreaElement, isHTMLElement, _getArrayProp, EMPTY_ARRAY, useElementSize, useResponsiveProp, Box, Text, useCustomValidity, BoundaryElementContext, Code,
|
|
2
|
+
import { isHTMLAnchorElement, isHTMLInputElement, isHTMLButtonElement, isHTMLSelectElement, isHTMLTextAreaElement, isHTMLElement, _getArrayProp, EMPTY_ARRAY, useElementSize, useResponsiveProp, Box, Text, useCustomValidity, BoundaryElementContext, Code, useDelayedState, TooltipDelayGroupContext, _isEnterToClickElement, Card, EMPTY_RECORD, Button, Stack, Popover, TextInput, AnimatedSpinnerIcon, useClickOutsideEvent, Flex, containsOrEqualsElement, usePortal, useBoundaryElement, useLayer, useGlobalKeyDown, createGlobalScopedContext, usePrefersReducedMotion, Portal, Z_OFFSETS, Layer, Grid, LayerProvider, isRecord, Selectable, _ResizeObserver } from "./_chunks-es/_visual-editing.js";
|
|
3
3
|
import { Arrow, CardProvider, DEFAULT_ARROW_ELEMENT, DEFAULT_BOX_ELEMENT, DEFAULT_BUTTON_ELEMENT, DEFAULT_CARD_ELEMENT, DEFAULT_CODE_ELEMENT, DEFAULT_ELEMENT_QUERY_ELEMENT, DEFAULT_FLEX_ELEMENT, DEFAULT_GRID_ELEMENT, DEFAULT_HOTKEYS_ELEMENT, DEFAULT_KBD_ELEMENT, DEFAULT_LAYER_ELEMENT, DEFAULT_MENU_DIVIDER_ELEMENT, DEFAULT_MENU_ELEMENT, DEFAULT_MENU_GROUP_ELEMENT, DEFAULT_MENU_ITEM_ELEMENT, DEFAULT_POPOVER_ELEMENT, DEFAULT_SPINNER_ELEMENT, DEFAULT_STACK_ELEMENT, DEFAULT_TAB_ELEMENT, DEFAULT_TAB_LIST_ELEMENT, DEFAULT_TEXT_ELEMENT, DEFAULT_TEXT_INPUT_ELEMENT, DEFAULT_TOOLTIP_ELEMENT, ElementQuery, Hotkeys, KBD, Menu, MenuDivider, MenuGroup, MenuItem, PortalProvider, Spinner, Tab, TabList, ThemeColorProvider, ThemeProvider, Tooltip, _elementSizeObserver, _getResponsiveProp, useCard, useMatchMedia, useMediaIndex, usePrefersDark, useRootTheme, useTheme, useTheme_v2, useTooltipDelayGroup } from "./_chunks-es/_visual-editing.js";
|
|
4
4
|
import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
|
|
5
5
|
import { CheckmarkIcon, RemoveIcon, ChevronDownIcon, CloseIcon, ToggleArrowRightIcon } from "@sanity/icons";
|
|
6
6
|
import { useState, useRef, useEffect, useImperativeHandle, Children, isValidElement, Fragment, cloneElement, Component, useReducer, useCallback, useMemo, useContext, useSyncExternalStore, startTransition, memo, useId } from "react";
|
|
7
7
|
import { c } from "react-compiler-runtime";
|
|
8
|
-
import { label, textOverflow, avatar, avatarArrow, avatarInitials, avatarImage, avatarImageOutline, avatarCounter, avatarStack, badge, checkbox, checkboxInput, checkboxPresentation, container as container$1, heading,
|
|
8
|
+
import { label, textOverflow, avatar, avatarArrow, avatarInitials, avatarImage, avatarImageOutline, avatarCounter, avatarStack, badge, checkbox, checkboxInput, checkboxPresentation, container as container$1, heading, radio, radioInput, radioPresentation, select, _inputElement, selectPresentation, srOnly, _switch, _switchElement, _switchPresentation, _switchTrack, _switchThumb, textArea, _inputPresentation, breadcrumbs, dialogCard, dialogLayout, dialogHeader, dialogContent, dialogFooter, dialog, dialogContainer, skeleton, codeSkeleton, headingSkeleton, labelSkeleton, textSkeleton, toast, toastLayer, treeItem, vars } from "@sanity/ui/css";
|
|
9
9
|
import { px, rem } from "@sanity/ui/css";
|
|
10
10
|
import { motion, AnimatePresence } from "framer-motion";
|
|
11
11
|
const createColorTheme = createColorTheme$1, hexToRgb = hexToRgb$1, hslToRgb = hslToRgb$1, multiply = multiply$1, parseColor = parseColor$1, rgbToHex = rgbToHex$1, rgbToHsl = rgbToHsl$1, rgba = rgba$1, screen = screen$1;
|
|
@@ -313,7 +313,7 @@ function Badge(props) {
|
|
|
313
313
|
let t7;
|
|
314
314
|
$[12] !== children || $[13] !== fontSize ? (t7 = /* @__PURE__ */ jsx(Text, { size: fontSize, children }), $[12] = children, $[13] = fontSize, $[14] = t7) : t7 = $[14];
|
|
315
315
|
let t8;
|
|
316
|
-
return $[15] !== as || $[16] !== padding || $[17] !== radius || $[18] !== rest || $[19] !== t6 || $[20] !== t7 ? (t8 = /* @__PURE__ */ jsx(Box, { "data-ui": "Badge", ...rest, as, className: t6, display: "
|
|
316
|
+
return $[15] !== as || $[16] !== padding || $[17] !== radius || $[18] !== rest || $[19] !== t6 || $[20] !== t7 ? (t8 = /* @__PURE__ */ jsx(Box, { "data-ui": "Badge", ...rest, as, className: t6, display: "flex", maxWidth: "fill", padding, radius, width: "min", children: t7 }), $[15] = as, $[16] = padding, $[17] = radius, $[18] = rest, $[19] = t6, $[20] = t7, $[21] = t8) : t8 = $[21], t8;
|
|
317
317
|
}
|
|
318
318
|
const DEFAULT_CHECKBOX_ELEMENT = "input";
|
|
319
319
|
function Checkbox(props) {
|
|
@@ -470,145 +470,6 @@ class ErrorBoundary extends Component {
|
|
|
470
470
|
return this.props.children;
|
|
471
471
|
}
|
|
472
472
|
}
|
|
473
|
-
const DEFAULT_SR_ONLY_ELEMENT = "span";
|
|
474
|
-
function SrOnly(props) {
|
|
475
|
-
const $ = c(12), t0 = props;
|
|
476
|
-
let children, className, rest, t1;
|
|
477
|
-
$[0] !== t0 ? ({
|
|
478
|
-
as: t1,
|
|
479
|
-
children,
|
|
480
|
-
className,
|
|
481
|
-
...rest
|
|
482
|
-
} = t0, $[0] = t0, $[1] = children, $[2] = className, $[3] = rest, $[4] = t1) : (children = $[1], className = $[2], rest = $[3], t1 = $[4]);
|
|
483
|
-
const Element2 = t1 === void 0 ? DEFAULT_SR_ONLY_ELEMENT : t1;
|
|
484
|
-
let t2;
|
|
485
|
-
$[5] !== className ? (t2 = srOnly({
|
|
486
|
-
className
|
|
487
|
-
}), $[5] = className, $[6] = t2) : t2 = $[6];
|
|
488
|
-
let t3;
|
|
489
|
-
return $[7] !== Element2 || $[8] !== children || $[9] !== rest || $[10] !== t2 ? (t3 = /* @__PURE__ */ jsx(Element2, { "data-ui": "SrOnly", ...rest, "aria-hidden": !0, className: t2, children }), $[7] = Element2, $[8] = children, $[9] = rest, $[10] = t2, $[11] = t3) : t3 = $[11], t3;
|
|
490
|
-
}
|
|
491
|
-
const DEFAULT_VIRTUAL_LIST_ELEMENT = "div";
|
|
492
|
-
function VirtualList(props) {
|
|
493
|
-
const $ = c(58), t0 = props;
|
|
494
|
-
let forwardedRef, getItemKey, onChange, renderItem, rest, t1, t2, t3;
|
|
495
|
-
$[0] !== t0 ? ({
|
|
496
|
-
as: t1,
|
|
497
|
-
gap: t2,
|
|
498
|
-
getItemKey,
|
|
499
|
-
items: t3,
|
|
500
|
-
onChange,
|
|
501
|
-
renderItem,
|
|
502
|
-
ref: forwardedRef,
|
|
503
|
-
...rest
|
|
504
|
-
} = t0, $[0] = t0, $[1] = forwardedRef, $[2] = getItemKey, $[3] = onChange, $[4] = renderItem, $[5] = rest, $[6] = t1, $[7] = t2, $[8] = t3) : (forwardedRef = $[1], getItemKey = $[2], onChange = $[3], renderItem = $[4], rest = $[5], t1 = $[6], t2 = $[7], t3 = $[8]);
|
|
505
|
-
const as = t1 === void 0 ? DEFAULT_VIRTUAL_LIST_ELEMENT : t1, gap = t2 === void 0 ? 0 : t2;
|
|
506
|
-
let t4;
|
|
507
|
-
$[9] !== t3 ? (t4 = t3 === void 0 ? [] : t3, $[9] = t3, $[10] = t4) : t4 = $[10];
|
|
508
|
-
const items = t4, ref = useRef(null), wrapperRef = useRef(null), [scrollTop, setScrollTop] = useState(0), [scrollHeight, setScrollHeight] = useState(0), [itemHeight, setItemHeight] = useState(-1), [gapValue, setGapValue] = useState(0);
|
|
509
|
-
let t5;
|
|
510
|
-
$[11] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => ref.current, $[11] = t5) : t5 = $[11], useImperativeHandle(forwardedRef, t5);
|
|
511
|
-
let t6, t7;
|
|
512
|
-
$[12] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => {
|
|
513
|
-
if (!ref.current)
|
|
514
|
-
return;
|
|
515
|
-
const scrollEl = findScrollable(ref.current.parentNode);
|
|
516
|
-
if (scrollEl) {
|
|
517
|
-
if (!(scrollEl instanceof HTMLElement))
|
|
518
|
-
return;
|
|
519
|
-
const handleScroll = () => {
|
|
520
|
-
setScrollTop(scrollEl.scrollTop);
|
|
521
|
-
};
|
|
522
|
-
scrollEl.addEventListener("scroll", handleScroll, {
|
|
523
|
-
passive: !0
|
|
524
|
-
});
|
|
525
|
-
const ro = new _ResizeObserver((entries) => {
|
|
526
|
-
setScrollHeight(entries[0].contentRect.height);
|
|
527
|
-
});
|
|
528
|
-
return ro.observe(scrollEl), handleScroll(), () => {
|
|
529
|
-
scrollEl.removeEventListener("scroll", handleScroll), ro.unobserve(scrollEl), ro.disconnect();
|
|
530
|
-
};
|
|
531
|
-
}
|
|
532
|
-
const handleScroll_0 = () => {
|
|
533
|
-
setScrollTop(window.scrollY);
|
|
534
|
-
}, handleResize = () => {
|
|
535
|
-
setScrollHeight(window.innerHeight);
|
|
536
|
-
};
|
|
537
|
-
return window.addEventListener("scroll", handleScroll_0, {
|
|
538
|
-
passive: !0
|
|
539
|
-
}), window.addEventListener("resize", handleResize), setScrollHeight(window.innerHeight), handleScroll_0(), () => {
|
|
540
|
-
window.removeEventListener("scroll", handleScroll_0), window.removeEventListener("resize", handleResize);
|
|
541
|
-
};
|
|
542
|
-
}, t7 = [], $[12] = t6, $[13] = t7) : (t6 = $[12], t7 = $[13]), useEffect(t6, t7);
|
|
543
|
-
const len = items.length, height = itemHeight ? len * (itemHeight + gapValue) - gapValue : 0, fromIndex = height ? Math.max(Math.floor(scrollTop / height * len) - 2, 0) : 0, toIndex = height ? Math.ceil((scrollTop + scrollHeight) / height * len) + 1 : 0;
|
|
544
|
-
let t8, t9;
|
|
545
|
-
$[14] !== fromIndex || $[15] !== gapValue || $[16] !== itemHeight || $[17] !== onChange || $[18] !== scrollHeight || $[19] !== scrollTop || $[20] !== toIndex ? (t8 = () => {
|
|
546
|
-
onChange?.({
|
|
547
|
-
fromIndex,
|
|
548
|
-
gap: gapValue,
|
|
549
|
-
itemHeight,
|
|
550
|
-
scrollHeight,
|
|
551
|
-
scrollTop,
|
|
552
|
-
toIndex
|
|
553
|
-
});
|
|
554
|
-
}, t9 = [fromIndex, gapValue, itemHeight, onChange, scrollHeight, scrollTop, toIndex], $[14] = fromIndex, $[15] = gapValue, $[16] = itemHeight, $[17] = onChange, $[18] = scrollHeight, $[19] = scrollTop, $[20] = toIndex, $[21] = t8, $[22] = t9) : (t8 = $[21], t9 = $[22]), useEffect(t8, t9);
|
|
555
|
-
let t10;
|
|
556
|
-
bb0: {
|
|
557
|
-
if (!renderItem || items.length === 0) {
|
|
558
|
-
t10 = null;
|
|
559
|
-
break bb0;
|
|
560
|
-
}
|
|
561
|
-
if (itemHeight === -1) {
|
|
562
|
-
let t113;
|
|
563
|
-
$[23] === Symbol.for("react.memo_cache_sentinel") ? (t113 = (el) => el ? setItemHeight(el.offsetHeight) : void 0, $[23] = t113) : t113 = $[23];
|
|
564
|
-
let t122;
|
|
565
|
-
$[24] !== items[0] || $[25] !== renderItem ? (t122 = renderItem(items[0]), $[24] = items[0], $[25] = renderItem, $[26] = t122) : t122 = $[26];
|
|
566
|
-
let t132;
|
|
567
|
-
$[27] !== t122 ? (t132 = /* @__PURE__ */ jsx(Box, { ref: t113, insetTop: 0, insetLeft: 0, insetRight: 0, position: "absolute", children: t122 }, 0), $[27] = t122, $[28] = t132) : t132 = $[28];
|
|
568
|
-
let t142;
|
|
569
|
-
$[29] === Symbol.for("react.memo_cache_sentinel") ? (t142 = (el_0) => el_0 ? setGapValue(el_0.offsetHeight) : void 0, $[29] = t142) : t142 = $[29];
|
|
570
|
-
const t15 = vars.space[gap];
|
|
571
|
-
let t16;
|
|
572
|
-
$[30] !== t15 ? (t16 = /* @__PURE__ */ jsx("div", { ref: t142, style: {
|
|
573
|
-
height: t15
|
|
574
|
-
} }), $[30] = t15, $[31] = t16) : t16 = $[31];
|
|
575
|
-
let t17;
|
|
576
|
-
$[32] !== t132 || $[33] !== t16 ? (t17 = [/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
577
|
-
t132,
|
|
578
|
-
t16
|
|
579
|
-
] })], $[32] = t132, $[33] = t16, $[34] = t17) : t17 = $[34], t10 = t17;
|
|
580
|
-
break bb0;
|
|
581
|
-
}
|
|
582
|
-
let t112;
|
|
583
|
-
if ($[35] !== fromIndex || $[36] !== gapValue || $[37] !== getItemKey || $[38] !== itemHeight || $[39] !== items || $[40] !== renderItem || $[41] !== toIndex) {
|
|
584
|
-
let t122;
|
|
585
|
-
$[43] !== fromIndex || $[44] !== gapValue || $[45] !== getItemKey || $[46] !== itemHeight || $[47] !== renderItem ? (t122 = (item, _itemIndex) => {
|
|
586
|
-
const itemIndex = fromIndex + _itemIndex, node = renderItem(item), key = getItemKey ? getItemKey(item, itemIndex) : itemIndex;
|
|
587
|
-
return /* @__PURE__ */ jsx(Box, { insetLeft: 0, insetRight: 0, position: "absolute", style: {
|
|
588
|
-
top: itemIndex * (itemHeight + gapValue) - gapValue
|
|
589
|
-
}, children: node }, key);
|
|
590
|
-
}, $[43] = fromIndex, $[44] = gapValue, $[45] = getItemKey, $[46] = itemHeight, $[47] = renderItem, $[48] = t122) : t122 = $[48], t112 = items.slice(fromIndex, toIndex).map(t122), $[35] = fromIndex, $[36] = gapValue, $[37] = getItemKey, $[38] = itemHeight, $[39] = items, $[40] = renderItem, $[41] = toIndex, $[42] = t112;
|
|
591
|
-
} else
|
|
592
|
-
t112 = $[42];
|
|
593
|
-
t10 = t112;
|
|
594
|
-
}
|
|
595
|
-
const children = t10;
|
|
596
|
-
let t11, t12;
|
|
597
|
-
$[49] !== height ? (t12 = {
|
|
598
|
-
height
|
|
599
|
-
}, $[49] = height, $[50] = t12) : t12 = $[50], t11 = t12;
|
|
600
|
-
const wrapperStyle = t11;
|
|
601
|
-
let t13;
|
|
602
|
-
$[51] !== children || $[52] !== wrapperStyle ? (t13 = /* @__PURE__ */ jsx("div", { ref: wrapperRef, style: wrapperStyle, children }), $[51] = children, $[52] = wrapperStyle, $[53] = t13) : t13 = $[53];
|
|
603
|
-
let t14;
|
|
604
|
-
return $[54] !== as || $[55] !== rest || $[56] !== t13 ? (t14 = /* @__PURE__ */ jsx(Box, { "data-ui": "VirtualList", ...rest, as, position: "relative", ref, children: t13 }), $[54] = as, $[55] = rest, $[56] = t13, $[57] = t14) : t14 = $[57], t14;
|
|
605
|
-
}
|
|
606
|
-
function findScrollable(parentNode) {
|
|
607
|
-
let _scrollEl = parentNode;
|
|
608
|
-
for (; _scrollEl && !_isScrollable(_scrollEl); )
|
|
609
|
-
_scrollEl = _scrollEl.parentNode;
|
|
610
|
-
return _scrollEl;
|
|
611
|
-
}
|
|
612
473
|
const DEFAULT_RADIO_ELEMENT = "input";
|
|
613
474
|
function Radio(props) {
|
|
614
475
|
const $ = c(25), t0 = props;
|
|
@@ -693,6 +554,24 @@ function Select(props) {
|
|
|
693
554
|
t16
|
|
694
555
|
] }), $[34] = t12, $[35] = t16, $[36] = t9, $[37] = t17) : t17 = $[37], t17;
|
|
695
556
|
}
|
|
557
|
+
const DEFAULT_SR_ONLY_ELEMENT = "span";
|
|
558
|
+
function SrOnly(props) {
|
|
559
|
+
const $ = c(12), t0 = props;
|
|
560
|
+
let children, className, rest, t1;
|
|
561
|
+
$[0] !== t0 ? ({
|
|
562
|
+
as: t1,
|
|
563
|
+
children,
|
|
564
|
+
className,
|
|
565
|
+
...rest
|
|
566
|
+
} = t0, $[0] = t0, $[1] = children, $[2] = className, $[3] = rest, $[4] = t1) : (children = $[1], className = $[2], rest = $[3], t1 = $[4]);
|
|
567
|
+
const Element2 = t1 === void 0 ? DEFAULT_SR_ONLY_ELEMENT : t1;
|
|
568
|
+
let t2;
|
|
569
|
+
$[5] !== className ? (t2 = srOnly({
|
|
570
|
+
className
|
|
571
|
+
}), $[5] = className, $[6] = t2) : t2 = $[6];
|
|
572
|
+
let t3;
|
|
573
|
+
return $[7] !== Element2 || $[8] !== children || $[9] !== rest || $[10] !== t2 ? (t3 = /* @__PURE__ */ jsx(Element2, { "data-ui": "SrOnly", ...rest, "aria-hidden": !0, className: t2, children }), $[7] = Element2, $[8] = children, $[9] = rest, $[10] = t2, $[11] = t3) : t3 = $[11], t3;
|
|
574
|
+
}
|
|
696
575
|
const DEFAULT_SWITCH_ELEMENT = "input";
|
|
697
576
|
function Switch(props) {
|
|
698
577
|
const $ = c(31), t0 = props;
|
|
@@ -731,7 +610,7 @@ function Switch(props) {
|
|
|
731
610
|
/* @__PURE__ */ jsx("span", { className: _switchThumb() })
|
|
732
611
|
] }), $[24] = t14) : t14 = $[24];
|
|
733
612
|
let t15;
|
|
734
|
-
return $[25] !== style || $[26] !== t13 || $[27] !== t5 || $[28] !== t6 || $[29] !== t7 ? (t15 = /* @__PURE__ */ jsxs(Box, { className: t5, "data-checked": t6, "data-indeterminate": t7, "data-ui": "Switch", display: "
|
|
613
|
+
return $[25] !== style || $[26] !== t13 || $[27] !== t5 || $[28] !== t6 || $[29] !== t7 ? (t15 = /* @__PURE__ */ jsxs(Box, { className: t5, "data-checked": t6, "data-indeterminate": t7, "data-ui": "Switch", display: "block", position: "relative", style, children: [
|
|
735
614
|
t13,
|
|
736
615
|
t14
|
|
737
616
|
] }), $[25] = style, $[26] = t13, $[27] = t5, $[28] = t6, $[29] = t7, $[30] = t15) : t15 = $[30], t15;
|
|
@@ -2046,6 +1925,127 @@ function TreeItem(props) {
|
|
|
2046
1925
|
/* @__PURE__ */ jsx(TreeContext.Provider, { value: contextValue, children: children && /* @__PURE__ */ jsx(TreeGroup, { expanded, children }) })
|
|
2047
1926
|
] });
|
|
2048
1927
|
}
|
|
1928
|
+
const DEFAULT_VIRTUAL_LIST_ELEMENT = "div";
|
|
1929
|
+
function VirtualList(props) {
|
|
1930
|
+
const $ = c(58), t0 = props;
|
|
1931
|
+
let forwardedRef, getItemKey, onChange, renderItem, rest, t1, t2, t3;
|
|
1932
|
+
$[0] !== t0 ? ({
|
|
1933
|
+
as: t1,
|
|
1934
|
+
gap: t2,
|
|
1935
|
+
getItemKey,
|
|
1936
|
+
items: t3,
|
|
1937
|
+
onChange,
|
|
1938
|
+
renderItem,
|
|
1939
|
+
ref: forwardedRef,
|
|
1940
|
+
...rest
|
|
1941
|
+
} = t0, $[0] = t0, $[1] = forwardedRef, $[2] = getItemKey, $[3] = onChange, $[4] = renderItem, $[5] = rest, $[6] = t1, $[7] = t2, $[8] = t3) : (forwardedRef = $[1], getItemKey = $[2], onChange = $[3], renderItem = $[4], rest = $[5], t1 = $[6], t2 = $[7], t3 = $[8]);
|
|
1942
|
+
const as = t1 === void 0 ? DEFAULT_VIRTUAL_LIST_ELEMENT : t1, gap = t2 === void 0 ? 0 : t2;
|
|
1943
|
+
let t4;
|
|
1944
|
+
$[9] !== t3 ? (t4 = t3 === void 0 ? [] : t3, $[9] = t3, $[10] = t4) : t4 = $[10];
|
|
1945
|
+
const items = t4, ref = useRef(null), wrapperRef = useRef(null), [scrollTop, setScrollTop] = useState(0), [scrollHeight, setScrollHeight] = useState(0), [itemHeight, setItemHeight] = useState(-1), [gapValue, setGapValue] = useState(0);
|
|
1946
|
+
let t5;
|
|
1947
|
+
$[11] === Symbol.for("react.memo_cache_sentinel") ? (t5 = () => ref.current, $[11] = t5) : t5 = $[11], useImperativeHandle(forwardedRef, t5);
|
|
1948
|
+
let t6, t7;
|
|
1949
|
+
$[12] === Symbol.for("react.memo_cache_sentinel") ? (t6 = () => {
|
|
1950
|
+
if (!ref.current)
|
|
1951
|
+
return;
|
|
1952
|
+
const scrollEl = findScrollable(ref.current.parentNode);
|
|
1953
|
+
if (scrollEl) {
|
|
1954
|
+
if (!(scrollEl instanceof HTMLElement))
|
|
1955
|
+
return;
|
|
1956
|
+
const handleScroll = () => {
|
|
1957
|
+
setScrollTop(scrollEl.scrollTop);
|
|
1958
|
+
};
|
|
1959
|
+
scrollEl.addEventListener("scroll", handleScroll, {
|
|
1960
|
+
passive: !0
|
|
1961
|
+
});
|
|
1962
|
+
const ro = new _ResizeObserver((entries) => {
|
|
1963
|
+
setScrollHeight(entries[0].contentRect.height);
|
|
1964
|
+
});
|
|
1965
|
+
return ro.observe(scrollEl), handleScroll(), () => {
|
|
1966
|
+
scrollEl.removeEventListener("scroll", handleScroll), ro.unobserve(scrollEl), ro.disconnect();
|
|
1967
|
+
};
|
|
1968
|
+
}
|
|
1969
|
+
const handleScroll_0 = () => {
|
|
1970
|
+
setScrollTop(window.scrollY);
|
|
1971
|
+
}, handleResize = () => {
|
|
1972
|
+
setScrollHeight(window.innerHeight);
|
|
1973
|
+
};
|
|
1974
|
+
return window.addEventListener("scroll", handleScroll_0, {
|
|
1975
|
+
passive: !0
|
|
1976
|
+
}), window.addEventListener("resize", handleResize), setScrollHeight(window.innerHeight), handleScroll_0(), () => {
|
|
1977
|
+
window.removeEventListener("scroll", handleScroll_0), window.removeEventListener("resize", handleResize);
|
|
1978
|
+
};
|
|
1979
|
+
}, t7 = [], $[12] = t6, $[13] = t7) : (t6 = $[12], t7 = $[13]), useEffect(t6, t7);
|
|
1980
|
+
const len = items.length, height = itemHeight ? len * (itemHeight + gapValue) - gapValue : 0, fromIndex = height ? Math.max(Math.floor(scrollTop / height * len) - 2, 0) : 0, toIndex = height ? Math.ceil((scrollTop + scrollHeight) / height * len) + 1 : 0;
|
|
1981
|
+
let t8, t9;
|
|
1982
|
+
$[14] !== fromIndex || $[15] !== gapValue || $[16] !== itemHeight || $[17] !== onChange || $[18] !== scrollHeight || $[19] !== scrollTop || $[20] !== toIndex ? (t8 = () => {
|
|
1983
|
+
onChange?.({
|
|
1984
|
+
fromIndex,
|
|
1985
|
+
gap: gapValue,
|
|
1986
|
+
itemHeight,
|
|
1987
|
+
scrollHeight,
|
|
1988
|
+
scrollTop,
|
|
1989
|
+
toIndex
|
|
1990
|
+
});
|
|
1991
|
+
}, t9 = [fromIndex, gapValue, itemHeight, onChange, scrollHeight, scrollTop, toIndex], $[14] = fromIndex, $[15] = gapValue, $[16] = itemHeight, $[17] = onChange, $[18] = scrollHeight, $[19] = scrollTop, $[20] = toIndex, $[21] = t8, $[22] = t9) : (t8 = $[21], t9 = $[22]), useEffect(t8, t9);
|
|
1992
|
+
let t10;
|
|
1993
|
+
bb0: {
|
|
1994
|
+
if (!renderItem || items.length === 0) {
|
|
1995
|
+
t10 = null;
|
|
1996
|
+
break bb0;
|
|
1997
|
+
}
|
|
1998
|
+
if (itemHeight === -1) {
|
|
1999
|
+
let t113;
|
|
2000
|
+
$[23] === Symbol.for("react.memo_cache_sentinel") ? (t113 = (el) => el ? setItemHeight(el.offsetHeight) : void 0, $[23] = t113) : t113 = $[23];
|
|
2001
|
+
let t122;
|
|
2002
|
+
$[24] !== items[0] || $[25] !== renderItem ? (t122 = renderItem(items[0]), $[24] = items[0], $[25] = renderItem, $[26] = t122) : t122 = $[26];
|
|
2003
|
+
let t132;
|
|
2004
|
+
$[27] !== t122 ? (t132 = /* @__PURE__ */ jsx(Box, { ref: t113, insetTop: 0, insetLeft: 0, insetRight: 0, position: "absolute", children: t122 }, 0), $[27] = t122, $[28] = t132) : t132 = $[28];
|
|
2005
|
+
let t142;
|
|
2006
|
+
$[29] === Symbol.for("react.memo_cache_sentinel") ? (t142 = (el_0) => el_0 ? setGapValue(el_0.offsetHeight) : void 0, $[29] = t142) : t142 = $[29];
|
|
2007
|
+
const t15 = vars.space[gap];
|
|
2008
|
+
let t16;
|
|
2009
|
+
$[30] !== t15 ? (t16 = /* @__PURE__ */ jsx("div", { ref: t142, style: {
|
|
2010
|
+
height: t15
|
|
2011
|
+
} }), $[30] = t15, $[31] = t16) : t16 = $[31];
|
|
2012
|
+
let t17;
|
|
2013
|
+
$[32] !== t132 || $[33] !== t16 ? (t17 = [/* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2014
|
+
t132,
|
|
2015
|
+
t16
|
|
2016
|
+
] })], $[32] = t132, $[33] = t16, $[34] = t17) : t17 = $[34], t10 = t17;
|
|
2017
|
+
break bb0;
|
|
2018
|
+
}
|
|
2019
|
+
let t112;
|
|
2020
|
+
if ($[35] !== fromIndex || $[36] !== gapValue || $[37] !== getItemKey || $[38] !== itemHeight || $[39] !== items || $[40] !== renderItem || $[41] !== toIndex) {
|
|
2021
|
+
let t122;
|
|
2022
|
+
$[43] !== fromIndex || $[44] !== gapValue || $[45] !== getItemKey || $[46] !== itemHeight || $[47] !== renderItem ? (t122 = (item, _itemIndex) => {
|
|
2023
|
+
const itemIndex = fromIndex + _itemIndex, node = renderItem(item), key = getItemKey ? getItemKey(item, itemIndex) : itemIndex;
|
|
2024
|
+
return /* @__PURE__ */ jsx(Box, { insetLeft: 0, insetRight: 0, position: "absolute", style: {
|
|
2025
|
+
top: itemIndex * (itemHeight + gapValue) - gapValue
|
|
2026
|
+
}, children: node }, key);
|
|
2027
|
+
}, $[43] = fromIndex, $[44] = gapValue, $[45] = getItemKey, $[46] = itemHeight, $[47] = renderItem, $[48] = t122) : t122 = $[48], t112 = items.slice(fromIndex, toIndex).map(t122), $[35] = fromIndex, $[36] = gapValue, $[37] = getItemKey, $[38] = itemHeight, $[39] = items, $[40] = renderItem, $[41] = toIndex, $[42] = t112;
|
|
2028
|
+
} else
|
|
2029
|
+
t112 = $[42];
|
|
2030
|
+
t10 = t112;
|
|
2031
|
+
}
|
|
2032
|
+
const children = t10;
|
|
2033
|
+
let t11, t12;
|
|
2034
|
+
$[49] !== height ? (t12 = {
|
|
2035
|
+
height
|
|
2036
|
+
}, $[49] = height, $[50] = t12) : t12 = $[50], t11 = t12;
|
|
2037
|
+
const wrapperStyle = t11;
|
|
2038
|
+
let t13;
|
|
2039
|
+
$[51] !== children || $[52] !== wrapperStyle ? (t13 = /* @__PURE__ */ jsx("div", { ref: wrapperRef, style: wrapperStyle, children }), $[51] = children, $[52] = wrapperStyle, $[53] = t13) : t13 = $[53];
|
|
2040
|
+
let t14;
|
|
2041
|
+
return $[54] !== as || $[55] !== rest || $[56] !== t13 ? (t14 = /* @__PURE__ */ jsx(Box, { "data-ui": "VirtualList", ...rest, as, position: "relative", ref, children: t13 }), $[54] = as, $[55] = rest, $[56] = t13, $[57] = t14) : t14 = $[57], t14;
|
|
2042
|
+
}
|
|
2043
|
+
function findScrollable(parentNode) {
|
|
2044
|
+
let _scrollEl = parentNode;
|
|
2045
|
+
for (; _scrollEl && !_isScrollable(_scrollEl); )
|
|
2046
|
+
_scrollEl = _scrollEl.parentNode;
|
|
2047
|
+
return _scrollEl;
|
|
2048
|
+
}
|
|
2049
2049
|
export {
|
|
2050
2050
|
Arrow,
|
|
2051
2051
|
Autocomplete,
|