@sanity/ui 2.9.0-corel.0 → 3.0.0-static.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/ui.js +6 -0
- package/dist/_chunks-cjs/buildCommand.js +2836 -0
- package/dist/_chunks-cjs/buildCommand.js.map +1 -0
- package/dist/_chunks-cjs/getTheme_v2.js +1 -27
- package/dist/_chunks-cjs/getTheme_v2.js.map +1 -1
- package/dist/_chunks-es/getTheme_v2.mjs +1 -27
- package/dist/_chunks-es/getTheme_v2.mjs.map +1 -1
- package/dist/_legacy/getTheme_v2.esm.js +1 -27
- package/dist/_legacy/getTheme_v2.esm.js.map +1 -1
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +23 -0
- package/dist/cli.js.map +1 -0
- package/dist/css.d.mts +943 -0
- package/dist/css.d.ts +943 -0
- package/dist/css.esm.js +3135 -0
- package/dist/css.esm.js.map +1 -0
- package/dist/css.js +3135 -0
- package/dist/css.js.map +1 -0
- package/dist/css.mjs +3135 -0
- package/dist/css.mjs.map +1 -0
- package/dist/index.d.mts +175 -164
- package/dist/index.d.ts +175 -164
- package/dist/index.esm.js +864 -1955
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +870 -1962
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +864 -1955
- package/dist/index.mjs.map +1 -1
- package/dist/sanity-theme.css +25 -0
- package/dist/system.css +2953 -0
- package/dist/theme.d.mts +84 -22
- package/dist/theme.d.ts +84 -22
- package/dist/theme.esm.js +232 -283
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +232 -283
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +232 -283
- package/dist/theme.mjs.map +1 -1
- package/exports/css.ts +1 -0
- package/package.json +25 -4
- package/src/core/__workshop__/constants.ts +15 -15
- package/src/core/__workshop__/fontsPlugin.tsx +1 -1
- package/src/core/components/autocomplete/autocomplete.styles.tsx +1 -1
- package/src/core/components/autocomplete/autocomplete.tsx +12 -4
- package/src/core/components/breadcrumbs/__workshop__/example.tsx +1 -3
- package/src/core/components/breadcrumbs/__workshop__/index.ts +0 -5
- package/src/core/components/breadcrumbs/breadcrumbs.styles.ts +14 -2
- package/src/core/components/breadcrumbs/breadcrumbs.tsx +14 -9
- package/src/core/components/dialog/__workshop__/panes.tsx +1 -1
- package/src/core/components/dialog/dialog.tsx +77 -92
- package/src/core/components/hotkeys/hotkeys.tsx +18 -29
- package/src/core/components/menu/menu.tsx +8 -5
- package/src/core/components/menu/menuDivider.ts +2 -1
- package/src/core/components/menu/menuGroup.tsx +16 -8
- package/src/core/components/menu/menuItem.tsx +23 -14
- package/src/core/components/skeleton/skeleton.tsx +1 -1
- package/src/core/components/skeleton/styles.ts +1 -1
- package/src/core/components/skeleton/textSkeleton.tsx +1 -1
- package/src/core/components/tab/tab.tsx +6 -7
- package/src/core/components/tab/tabList.tsx +3 -2
- package/src/core/components/toast/styles.ts +1 -1
- package/src/core/components/toast/toast.tsx +6 -4
- package/src/core/components/toast/toastProvider.tsx +31 -22
- package/src/core/components/tree/style.ts +1 -1
- package/src/core/components/tree/tree.tsx +8 -2
- package/src/core/components/tree/treeGroup.tsx +1 -1
- package/src/core/components/tree/treeItem.tsx +38 -25
- package/src/core/components/tree/types.ts +5 -1
- package/src/core/lib/styled/elements.ts +135 -0
- package/src/core/lib/styled/index.ts +2 -0
- package/src/core/lib/styled/members.ts +15 -0
- package/src/core/lib/styled/styled.ts +79 -0
- package/src/core/primitives/_selectable/selectable.tsx +27 -14
- package/src/core/primitives/avatar/avatar.tsx +52 -32
- package/src/core/primitives/avatar/avatarCounter.tsx +1 -1
- package/src/core/primitives/avatar/avatarStack.tsx +1 -1
- package/src/core/primitives/badge/__workshop__/tones.tsx +9 -16
- package/src/core/primitives/badge/badge.tsx +18 -20
- package/src/core/primitives/box/box.tsx +62 -74
- package/src/core/primitives/button/__workshop__/props.tsx +3 -1
- package/src/core/primitives/button/__workshop__/sanityUploadButton.tsx +1 -1
- package/src/core/primitives/button/__workshop__/styled1.tsx +1 -1
- package/src/core/primitives/button/__workshop__/styled2.tsx +1 -1
- package/src/core/primitives/button/button.tsx +38 -45
- package/src/core/primitives/button/styles.ts +2 -2
- package/src/core/primitives/card/RootCardContext.ts +3 -0
- package/src/core/primitives/card/__workshop__/selected.tsx +1 -1
- package/src/core/primitives/card/__workshop__/styled.tsx +1 -1
- package/src/core/primitives/card/card.tsx +44 -46
- package/src/core/primitives/card/styles.ts +1 -1
- package/src/core/primitives/checkbox/checkbox.tsx +6 -8
- package/src/core/primitives/code/code.tsx +23 -12
- package/src/core/primitives/code/styles.ts +1 -1
- package/src/core/primitives/container/container.tsx +7 -15
- package/src/core/primitives/flex/__workshop__/example.tsx +1 -1
- package/src/core/primitives/flex/flex.tsx +6 -19
- package/src/core/primitives/grid/grid.tsx +2 -1
- package/src/core/primitives/heading/heading.tsx +32 -19
- package/src/core/primitives/heading/styles.ts +1 -1
- package/src/core/primitives/inline/inline.tsx +22 -13
- package/src/core/primitives/kbd/kbd.tsx +30 -37
- package/src/core/primitives/label/label.tsx +15 -4
- package/src/core/primitives/label/styles.ts +1 -1
- package/src/core/primitives/popover/__workshop__/RecursiveStory.tsx +0 -1
- package/src/core/primitives/popover/popover.tsx +21 -15
- package/src/core/primitives/popover/popoverCard.tsx +36 -38
- package/src/core/primitives/radio/radio.tsx +1 -1
- package/src/core/primitives/radio/styles.ts +1 -1
- package/src/core/primitives/select/select.tsx +1 -1
- package/src/core/primitives/select/styles.ts +1 -1
- package/src/core/primitives/spinner/spinner.tsx +6 -20
- package/src/core/primitives/stack/stack.tsx +12 -10
- package/src/core/primitives/switch/styles.ts +9 -9
- package/src/core/primitives/switch/switch.tsx +20 -21
- package/src/core/primitives/text/__workshop__/colored.tsx +1 -1
- package/src/core/primitives/text/styles.ts +1 -2
- package/src/core/primitives/text/text.tsx +17 -21
- package/src/core/primitives/textArea/textArea.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/textInput/textInput.tsx +176 -123
- package/src/core/primitives/tooltip/tooltip.test.tsx +1 -0
- package/src/core/primitives/tooltip/tooltip.tsx +13 -13
- package/src/core/primitives/tooltip/tooltipCard.tsx +15 -14
- package/src/core/primitives/types.ts +35 -16
- package/src/core/styles/border/borderStyle.ts +6 -0
- package/src/core/styles/border/types.ts +1 -0
- package/src/core/styles/box/boxStyle.ts +6 -0
- package/src/core/styles/card/_cardColorStyle.ts +0 -8
- package/src/core/styles/flex/flexStyle.ts +0 -18
- package/src/core/styles/flex/types.ts +1 -3
- package/src/core/styles/grid/gridStyle.ts +0 -10
- package/src/core/styles/helpers.ts +9 -0
- package/src/core/styles/input/textInputStyle.ts +1 -1
- package/src/core/theme/__workshop__/build/Root.tsx +1 -1
- package/src/core/theme/themeProvider.tsx +1 -1
- package/src/core/theme/useTheme.ts +1 -1
- package/src/core/types/avatar.ts +6 -1
- package/src/core/types/button.ts +1 -0
- package/src/core/types/flex.ts +27 -26
- package/src/core/types/gridItem.ts +32 -24
- package/src/core/types/radius.ts +7 -4
- package/src/core/utils/arrow/arrow.tsx +1 -1
- package/src/core/utils/elementQuery/__workshop__/customMedia.tsx +1 -1
- package/src/core/utils/layer/layer.tsx +28 -11
- package/src/core/utils/srOnly/srOnly.tsx +1 -1
- package/src/core/utils/virtualList/virtualList.tsx +1 -1
- package/src/css/_resp.ts +28 -0
- package/src/css/cli/buildCommand.ts +36 -0
- package/src/css/cli/index.ts +38 -0
- package/src/css/compile/comileRules.ts +59 -0
- package/src/css/compile/compileRule.ts +58 -0
- package/src/css/compile/compileSystem.ts +7 -0
- package/src/css/compile/compileTheme.ts +509 -0
- package/src/css/components/breadcrumbs/breadcrumbs.ts +5 -0
- package/src/css/components/breadcrumbs/index.ts +1 -0
- package/src/css/components/breadcrumbs/rules.ts +7 -0
- package/src/css/components/dialog/classes.ts +29 -0
- package/src/css/components/dialog/index.ts +1 -0
- package/src/css/components/dialog/rules.ts +75 -0
- package/src/css/components/tree/index.ts +1 -0
- package/src/css/components/tree/rules.ts +52 -0
- package/src/css/components/tree/tree.ts +5 -0
- package/src/css/composeClassNames.ts +3 -0
- package/src/css/index.ts +47 -0
- package/src/css/primitives/avatar/avatar.ts +32 -0
- package/src/css/primitives/avatar/index.ts +2 -0
- package/src/css/primitives/avatar/rules.ts +190 -0
- package/src/css/primitives/avatar/types.ts +9 -0
- package/src/css/primitives/badge/badge.ts +8 -0
- package/src/css/primitives/badge/index.ts +2 -0
- package/src/css/primitives/badge/rules.ts +25 -0
- package/src/css/primitives/badge/types.ts +8 -0
- package/src/css/primitives/box/box.ts +34 -0
- package/src/css/primitives/box/index.ts +2 -0
- package/src/css/primitives/box/rules.ts +25 -0
- package/src/css/primitives/box/types.ts +49 -0
- package/src/css/primitives/button/button.ts +26 -0
- package/src/css/primitives/button/index.ts +1 -0
- package/src/css/primitives/button/rules.ts +58 -0
- package/src/css/primitives/card/card.ts +21 -0
- package/src/css/primitives/card/index.ts +1 -0
- package/src/css/primitives/card/rules.ts +93 -0
- package/src/{core/primitives/checkbox/styles.ts → css/primitives/checkbox/__styles.ts} +3 -3
- package/src/css/primitives/checkbox/checkbox.ts +9 -0
- package/src/css/primitives/checkbox/index.ts +1 -0
- package/src/css/primitives/checkbox/rules.ts +136 -0
- package/src/css/primitives/code/code.ts +9 -0
- package/src/css/primitives/code/index.ts +2 -0
- package/src/css/primitives/code/rules.ts +71 -0
- package/src/css/primitives/code/types.ts +10 -0
- package/src/css/primitives/container/container.ts +7 -0
- package/src/css/primitives/container/index.ts +2 -0
- package/src/css/primitives/container/rules.ts +8 -0
- package/src/css/primitives/container/types.ts +6 -0
- package/src/css/primitives/heading/heading.ts +16 -0
- package/src/css/primitives/heading/index.ts +2 -0
- package/src/css/primitives/heading/rules.ts +84 -0
- package/src/css/primitives/heading/types.ts +12 -0
- package/src/css/primitives/kbd/index.ts +2 -0
- package/src/css/primitives/kbd/kbd.ts +7 -0
- package/src/css/primitives/kbd/rules.ts +20 -0
- package/src/css/primitives/kbd/types.ts +5 -0
- package/src/css/primitives/label/index.ts +2 -0
- package/src/css/primitives/label/label.ts +16 -0
- package/src/css/primitives/label/rules.ts +85 -0
- package/src/css/primitives/label/types.ts +12 -0
- package/src/css/primitives/popover/index.ts +1 -0
- package/src/css/primitives/popover/popover.ts +5 -0
- package/src/css/primitives/popover/rules.ts +5 -0
- package/src/css/primitives/radio/index.ts +1 -0
- package/src/css/primitives/radio/radio.ts +5 -0
- package/src/css/primitives/radio/rules.ts +5 -0
- package/src/css/primitives/select/index.ts +1 -0
- package/src/css/primitives/select/rules.ts +5 -0
- package/src/css/primitives/select/select.ts +5 -0
- package/src/{core/primitives/_selectable/style.ts → css/primitives/selectable/__style.ts} +5 -4
- package/src/css/primitives/selectable/index.ts +2 -0
- package/src/css/primitives/selectable/rules.ts +27 -0
- package/src/css/primitives/selectable/selectable.ts +9 -0
- package/src/css/primitives/selectable/types.ts +6 -0
- package/src/css/primitives/spinner/index.ts +1 -0
- package/src/css/primitives/spinner/rules.ts +22 -0
- package/src/css/primitives/spinner/spinner.ts +5 -0
- package/src/css/primitives/switch/index.ts +1 -0
- package/src/css/primitives/switch/rules.ts +132 -0
- package/src/css/primitives/switch/switch.ts +5 -0
- package/src/css/primitives/text/index.ts +2 -0
- package/src/css/primitives/text/rules.ts +75 -0
- package/src/css/primitives/text/text.ts +16 -0
- package/src/css/primitives/text/types.ts +11 -0
- package/src/css/primitives/textArea/index.ts +1 -0
- package/src/css/primitives/textArea/rules.ts +5 -0
- package/src/css/primitives/textArea/textArea.ts +5 -0
- package/src/css/primitives/textInput/index.ts +1 -0
- package/src/css/primitives/textInput/rules.ts +226 -0
- package/src/css/primitives/textInput/textInput.ts +7 -0
- package/src/css/primitives/token/rules.ts +45 -0
- package/src/css/primitives/tooltip/index.ts +1 -0
- package/src/css/primitives/tooltip/rules.ts +17 -0
- package/src/css/primitives/tooltip/tooltip.ts +9 -0
- package/src/css/responsiveRules.ts +25 -0
- package/src/css/rules.ts +121 -0
- package/src/css/styles/border/border.ts +22 -0
- package/src/css/styles/border/index.ts +2 -0
- package/src/css/styles/border/rules.ts +24 -0
- package/src/css/styles/border/types.ts +10 -0
- package/src/css/styles/display/rules.ts +62 -0
- package/src/css/styles/flex/flex.ts +20 -0
- package/src/css/styles/flex/index.ts +2 -0
- package/src/css/styles/flex/rules.ts +28 -0
- package/src/css/styles/flex/types.ts +35 -0
- package/src/css/styles/flexItem/flexItem.ts +8 -0
- package/src/css/styles/flexItem/index.ts +2 -0
- package/src/css/styles/flexItem/rules.ts +11 -0
- package/src/css/styles/flexItem/types.ts +11 -0
- package/src/css/styles/font/font.ts +12 -0
- package/src/css/styles/font/index.ts +2 -0
- package/src/css/styles/font/rules.ts +125 -0
- package/src/css/styles/font/types.ts +6 -0
- package/src/css/styles/gap/gap.ts +8 -0
- package/src/css/styles/gap/index.ts +2 -0
- package/src/css/styles/gap/rules.ts +33 -0
- package/src/css/styles/gap/types.ts +9 -0
- package/src/css/styles/grid/rules.ts +35 -0
- package/src/css/styles/gridItem/gridItem.ts +15 -0
- package/src/css/styles/gridItem/index.ts +2 -0
- package/src/css/styles/gridItem/rules.ts +96 -0
- package/src/css/styles/gridItem/types.ts +41 -0
- package/src/css/styles/height/rules.ts +7 -0
- package/src/css/styles/margin/index.ts +2 -0
- package/src/css/styles/margin/margin.ts +15 -0
- package/src/css/styles/margin/rules.ts +59 -0
- package/src/css/styles/margin/types.ts +11 -0
- package/src/css/styles/maxWidth/index.ts +2 -0
- package/src/css/styles/maxWidth/maxWidth.ts +6 -0
- package/src/css/styles/maxWidth/rules.ts +36 -0
- package/src/css/styles/maxWidth/types.ts +6 -0
- package/src/css/styles/overflow/rules.ts +9 -0
- package/src/css/styles/padding/index.ts +2 -0
- package/src/css/styles/padding/padding.ts +15 -0
- package/src/css/styles/padding/rules.ts +59 -0
- package/src/css/styles/padding/types.ts +12 -0
- package/src/css/styles/pointerEvents/index.ts +2 -0
- package/src/css/styles/pointerEvents/pointerEvents.ts +6 -0
- package/src/css/styles/pointerEvents/rules.ts +11 -0
- package/src/css/styles/pointerEvents/types.ts +7 -0
- package/src/css/styles/position/index.ts +2 -0
- package/src/css/styles/position/position.ts +7 -0
- package/src/css/styles/position/rules.ts +31 -0
- package/src/css/styles/position/types.ts +13 -0
- package/src/css/styles/radius/index.ts +2 -0
- package/src/css/styles/radius/radius.ts +8 -0
- package/src/css/styles/radius/rules.ts +13 -0
- package/src/css/styles/radius/types.ts +7 -0
- package/src/css/styles/shadow/rules.ts +53 -0
- package/src/css/styles/width/index.ts +2 -0
- package/src/css/styles/width/rules.ts +7 -0
- package/src/css/styles/width/types.ts +8 -0
- package/src/css/styles/width/width.ts +6 -0
- package/src/css/types.ts +591 -0
- package/src/css/varNames.ts +381 -0
- package/src/css/vars.ts +313 -0
- package/src/theme/build/_deprecated/color/factory.ts +1 -1
- package/src/theme/build/_deprecated/color/muted/createMuted.ts +2 -2
- package/src/theme/build/buildColorTheme.ts +39 -45
- package/src/theme/build/renderColorTheme.ts +65 -239
- package/src/theme/build/resolveColorTokens.ts +115 -51
- package/src/theme/config/tokens/color/types.ts +18 -4
- package/src/theme/defaults/colorTokens.ts +10 -17
- package/src/theme/defaults/config.ts +1 -1
- package/src/theme/getScopedTheme.ts +2 -9
- package/src/theme/system/_constants.ts +25 -0
- package/src/theme/system/_types.ts +41 -0
- package/src/theme/system/color/_constants.ts +0 -8
- package/src/theme/system/color/badge.ts +7 -3
- package/src/theme/system/index.ts +2 -0
- package/src/theme/system/v0/color/_system.ts +4 -8
- package/src/theme/system/v0/color/color.ts +2 -3
- package/src/theme/versioning/themeColor_v0_v2.ts +0 -26
- package/src/theme/versioning/v0_v2.ts +0 -4
- package/src/core/components/breadcrumbs/__workshop__/buttons.tsx +0 -58
- package/src/core/components/dialog/styles.ts +0 -76
package/dist/index.mjs
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { buildTheme, 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, getTheme_v2, getScopedTheme } from "@sanity/ui/theme";
|
|
2
2
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { composeClassNames, label, avatar, avatarArrow, avatarImage, avatarBgStroke, avatarStroke, avatarInitials, box, text, badge, spinner, button, buttonLoadingBox, card, checkbox, checkboxInput, code, container, heading, kbd, _switch, textInput, tooltipCard, tooltip, breadcrumbs, dialogContainer, dialogCardRoot, dialogLayout, dialogHeader, dialogContent, dialogFooter, dialog, selectable, treeItem } from "@sanity/ui/css";
|
|
4
|
+
import { useMemo, useState, useRef, useEffect, useDebugValue, useImperativeHandle, useSyncExternalStore, forwardRef, createElement, createContext, useContext, useId, useCallback, Children, isValidElement, cloneElement, Component, memo, useLayoutEffect, useReducer, startTransition } from "react";
|
|
4
5
|
import ReactIs, { isValidElementType } from "react-is";
|
|
5
|
-
import {
|
|
6
|
+
import { css as css$1, keyframes as keyframes$1, ThemeProvider as ThemeProvider$2, useTheme as useTheme$2 } from "styled-components";
|
|
6
7
|
import { SpinnerIcon, CheckmarkIcon, RemoveIcon, ChevronDownIcon, CloseIcon, ChevronRightIcon, ToggleArrowRightIcon } from "@sanity/icons";
|
|
7
8
|
import Refractor from "react-refractor";
|
|
8
9
|
import { detectOverflow, flip, offset, shift, arrow, hide, useFloating, autoUpdate } from "@floating-ui/react-dom";
|
|
9
10
|
import { motion, AnimatePresence } from "framer-motion";
|
|
10
|
-
import { createPortal } from "react-dom";
|
|
11
11
|
import { useEffectEvent } from "use-effect-event";
|
|
12
|
+
import { createPortal } from "react-dom";
|
|
12
13
|
import { getTheme_v2 as getTheme_v2$1 } from "./_chunks-es/getTheme_v2.mjs";
|
|
13
14
|
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, studioTheme = buildTheme(), EMPTY_ARRAY = [], EMPTY_RECORD = {}, POPOVER_MOTION_CONTENT_OPACITY_PROPERTY = "--motion-content-opacity", POPOVER_MOTION_PROPS = {
|
|
14
15
|
initial: {
|
|
@@ -33,6 +34,9 @@ const createColorTheme = createColorTheme$1, hexToRgb = hexToRgb$1, hslToRgb = h
|
|
|
33
34
|
function _fillCSSObject(keys, value) {
|
|
34
35
|
return keys.reduce((style, key2) => (style[key2] = value, style), {});
|
|
35
36
|
}
|
|
37
|
+
function px(pixelValue) {
|
|
38
|
+
return pixelValue === 0 ? 0 : `${pixelValue}px`;
|
|
39
|
+
}
|
|
36
40
|
function rem(pixelValue) {
|
|
37
41
|
return pixelValue === 0 ? 0 : `${pixelValue / 16}rem`;
|
|
38
42
|
}
|
|
@@ -138,7 +142,7 @@ function _getElements(element, elementsArg) {
|
|
|
138
142
|
return ret.filter(Boolean);
|
|
139
143
|
}
|
|
140
144
|
function useClickOutside(listener, elementsArg = EMPTY_ARRAY, boundaryElement) {
|
|
141
|
-
const [element, setElement] = useState(null), [
|
|
145
|
+
const [element, setElement] = useState(null), [elements2, setElements] = useState(() => _getElements(element, elementsArg)), elementsRef = useRef(elements2);
|
|
142
146
|
return useEffect(() => {
|
|
143
147
|
const prevElements = elementsRef.current, nextElements = _getElements(element, elementsArg);
|
|
144
148
|
if (prevElements.length !== nextElements.length) {
|
|
@@ -160,7 +164,7 @@ function useClickOutside(listener, elementsArg = EMPTY_ARRAY, boundaryElement) {
|
|
|
160
164
|
const handleWindowMouseDown = (evt) => {
|
|
161
165
|
const target = evt.target;
|
|
162
166
|
if (target instanceof Node && !(boundaryElement && !boundaryElement.contains(target))) {
|
|
163
|
-
for (const el of
|
|
167
|
+
for (const el of elements2)
|
|
164
168
|
if (target === el || el.contains(target))
|
|
165
169
|
return;
|
|
166
170
|
listener(evt);
|
|
@@ -169,7 +173,7 @@ function useClickOutside(listener, elementsArg = EMPTY_ARRAY, boundaryElement) {
|
|
|
169
173
|
return window.addEventListener("mousedown", handleWindowMouseDown), () => {
|
|
170
174
|
window.removeEventListener("mousedown", handleWindowMouseDown);
|
|
171
175
|
};
|
|
172
|
-
}, [boundaryElement, listener,
|
|
176
|
+
}, [boundaryElement, listener, elements2]), setElement;
|
|
173
177
|
}
|
|
174
178
|
function useClickOutsideEvent(listener, elementsArg = () => EMPTY_ARRAY, boundaryElement) {
|
|
175
179
|
const onEvent = useEffectEvent((evt) => {
|
|
@@ -181,8 +185,8 @@ function useClickOutsideEvent(listener, elementsArg = () => EMPTY_ARRAY, boundar
|
|
|
181
185
|
const resolvedBoundaryElement = boundaryElement?.();
|
|
182
186
|
if (resolvedBoundaryElement && !resolvedBoundaryElement.contains(target))
|
|
183
187
|
return;
|
|
184
|
-
const
|
|
185
|
-
for (const el of
|
|
188
|
+
const elements2 = elementsArg().flat();
|
|
189
|
+
for (const el of elements2)
|
|
186
190
|
if (el && (target === el || el.contains(target)))
|
|
187
191
|
return;
|
|
188
192
|
listener(evt);
|
|
@@ -278,7 +282,7 @@ var freeze = function(obj) {
|
|
|
278
282
|
return cache.get(target);
|
|
279
283
|
if (isHidden(target))
|
|
280
284
|
return cache.set(target, zeroBoxes), zeroBoxes;
|
|
281
|
-
var cs = getComputedStyle(target), svg = isSVG(target) && target.ownerSVGElement && target.getBBox(), removePadding = !IE && cs.boxSizing === "border-box", switchSizes = verticalRegexp.test(cs.writingMode || ""), canScrollVertically = !svg && scrollRegexp.test(cs.overflowY || ""), canScrollHorizontally = !svg && scrollRegexp.test(cs.overflowX || ""), paddingTop = svg ? 0 : parseDimension(cs.paddingTop), paddingRight = svg ? 0 : parseDimension(cs.paddingRight), paddingBottom = svg ? 0 : parseDimension(cs.paddingBottom), paddingLeft = svg ? 0 : parseDimension(cs.paddingLeft),
|
|
285
|
+
var cs = getComputedStyle(target), svg = isSVG(target) && target.ownerSVGElement && target.getBBox(), removePadding = !IE && cs.boxSizing === "border-box", switchSizes = verticalRegexp.test(cs.writingMode || ""), canScrollVertically = !svg && scrollRegexp.test(cs.overflowY || ""), canScrollHorizontally = !svg && scrollRegexp.test(cs.overflowX || ""), paddingTop = svg ? 0 : parseDimension(cs.paddingTop), paddingRight = svg ? 0 : parseDimension(cs.paddingRight), paddingBottom = svg ? 0 : parseDimension(cs.paddingBottom), paddingLeft = svg ? 0 : parseDimension(cs.paddingLeft), borderTop = svg ? 0 : parseDimension(cs.borderTopWidth), borderRight = svg ? 0 : parseDimension(cs.borderRightWidth), borderBottom = svg ? 0 : parseDimension(cs.borderBottomWidth), borderLeft = svg ? 0 : parseDimension(cs.borderLeftWidth), horizontalPadding = paddingLeft + paddingRight, verticalPadding = paddingTop + paddingBottom, horizontalBorderArea = borderLeft + borderRight, verticalBorderArea = borderTop + borderBottom, horizontalScrollbarThickness = canScrollHorizontally ? target.offsetHeight - verticalBorderArea - target.clientHeight : 0, verticalScrollbarThickness = canScrollVertically ? target.offsetWidth - horizontalBorderArea - target.clientWidth : 0, widthReduction = removePadding ? horizontalPadding + horizontalBorderArea : 0, heightReduction = removePadding ? verticalPadding + verticalBorderArea : 0, contentWidth = svg ? svg.width : parseDimension(cs.width) - widthReduction - verticalScrollbarThickness, contentHeight = svg ? svg.height : parseDimension(cs.height) - heightReduction - horizontalScrollbarThickness, borderBoxWidth = contentWidth + horizontalPadding + verticalScrollbarThickness + horizontalBorderArea, borderBoxHeight = contentHeight + verticalPadding + horizontalScrollbarThickness + verticalBorderArea, boxes = freeze({
|
|
282
286
|
devicePixelContentBoxSize: size$1(Math.round(contentWidth * devicePixelRatio), Math.round(contentHeight * devicePixelRatio), switchSizes),
|
|
283
287
|
borderBoxSize: size$1(borderBoxWidth, borderBoxHeight, switchSizes),
|
|
284
288
|
contentBoxSize: size$1(contentWidth, contentHeight, switchSizes),
|
|
@@ -553,6 +557,169 @@ function useMatchMedia(mediaQueryString, getServerSnapshot2) {
|
|
|
553
557
|
}, [mediaQueryString]);
|
|
554
558
|
return useDebugValue(mediaQueryString), useSyncExternalStore(subscribe2, getSnapshot, getServerSnapshot2);
|
|
555
559
|
}
|
|
560
|
+
const css = css$1, keyframes = keyframes$1, ThemeProvider$1 = ThemeProvider$2, useTheme$1 = useTheme$2, elements = [
|
|
561
|
+
"a",
|
|
562
|
+
"abbr",
|
|
563
|
+
"address",
|
|
564
|
+
"area",
|
|
565
|
+
"article",
|
|
566
|
+
"aside",
|
|
567
|
+
"audio",
|
|
568
|
+
"b",
|
|
569
|
+
"base",
|
|
570
|
+
"bdi",
|
|
571
|
+
"bdo",
|
|
572
|
+
"big",
|
|
573
|
+
"blockquote",
|
|
574
|
+
"body",
|
|
575
|
+
"br",
|
|
576
|
+
"button",
|
|
577
|
+
"canvas",
|
|
578
|
+
"caption",
|
|
579
|
+
"cite",
|
|
580
|
+
"code",
|
|
581
|
+
"col",
|
|
582
|
+
"colgroup",
|
|
583
|
+
"data",
|
|
584
|
+
"datalist",
|
|
585
|
+
"dd",
|
|
586
|
+
"del",
|
|
587
|
+
"details",
|
|
588
|
+
"dfn",
|
|
589
|
+
"dialog",
|
|
590
|
+
"div",
|
|
591
|
+
"dl",
|
|
592
|
+
"dt",
|
|
593
|
+
"em",
|
|
594
|
+
"embed",
|
|
595
|
+
"fieldset",
|
|
596
|
+
"figcaption",
|
|
597
|
+
"figure",
|
|
598
|
+
"footer",
|
|
599
|
+
"form",
|
|
600
|
+
"h1",
|
|
601
|
+
"h2",
|
|
602
|
+
"h3",
|
|
603
|
+
"h4",
|
|
604
|
+
"h5",
|
|
605
|
+
"h6",
|
|
606
|
+
"header",
|
|
607
|
+
"hgroup",
|
|
608
|
+
"hr",
|
|
609
|
+
"html",
|
|
610
|
+
"i",
|
|
611
|
+
"iframe",
|
|
612
|
+
"img",
|
|
613
|
+
"input",
|
|
614
|
+
"ins",
|
|
615
|
+
"kbd",
|
|
616
|
+
"keygen",
|
|
617
|
+
"label",
|
|
618
|
+
"legend",
|
|
619
|
+
"li",
|
|
620
|
+
"link",
|
|
621
|
+
"main",
|
|
622
|
+
"map",
|
|
623
|
+
"mark",
|
|
624
|
+
"menu",
|
|
625
|
+
"menuitem",
|
|
626
|
+
"meta",
|
|
627
|
+
"meter",
|
|
628
|
+
"nav",
|
|
629
|
+
"noscript",
|
|
630
|
+
"object",
|
|
631
|
+
"ol",
|
|
632
|
+
"optgroup",
|
|
633
|
+
"option",
|
|
634
|
+
"output",
|
|
635
|
+
"p",
|
|
636
|
+
"param",
|
|
637
|
+
"picture",
|
|
638
|
+
"pre",
|
|
639
|
+
"progress",
|
|
640
|
+
"q",
|
|
641
|
+
"rp",
|
|
642
|
+
"rt",
|
|
643
|
+
"ruby",
|
|
644
|
+
"s",
|
|
645
|
+
"samp",
|
|
646
|
+
"script",
|
|
647
|
+
"section",
|
|
648
|
+
"select",
|
|
649
|
+
"small",
|
|
650
|
+
"source",
|
|
651
|
+
"span",
|
|
652
|
+
"strong",
|
|
653
|
+
"style",
|
|
654
|
+
"sub",
|
|
655
|
+
"summary",
|
|
656
|
+
"sup",
|
|
657
|
+
"table",
|
|
658
|
+
"tbody",
|
|
659
|
+
"td",
|
|
660
|
+
"textarea",
|
|
661
|
+
"tfoot",
|
|
662
|
+
"th",
|
|
663
|
+
"thead",
|
|
664
|
+
"time",
|
|
665
|
+
"tr",
|
|
666
|
+
"track",
|
|
667
|
+
"u",
|
|
668
|
+
"ul",
|
|
669
|
+
"use",
|
|
670
|
+
"var",
|
|
671
|
+
"video",
|
|
672
|
+
"wbr",
|
|
673
|
+
// SVG
|
|
674
|
+
"circle",
|
|
675
|
+
"clipPath",
|
|
676
|
+
"defs",
|
|
677
|
+
"ellipse",
|
|
678
|
+
"foreignObject",
|
|
679
|
+
"g",
|
|
680
|
+
"image",
|
|
681
|
+
"line",
|
|
682
|
+
"linearGradient",
|
|
683
|
+
"marker",
|
|
684
|
+
"mask",
|
|
685
|
+
"path",
|
|
686
|
+
"pattern",
|
|
687
|
+
"polygon",
|
|
688
|
+
"polyline",
|
|
689
|
+
"radialGradient",
|
|
690
|
+
"rect",
|
|
691
|
+
"stop",
|
|
692
|
+
"svg",
|
|
693
|
+
"text",
|
|
694
|
+
"tspan"
|
|
695
|
+
], baseStyled = (tagName) => {
|
|
696
|
+
const m = (_strings, ..._interpolations) => {
|
|
697
|
+
const Styled = forwardRef(function(props, ref) {
|
|
698
|
+
const { as, forwardedAs, ...rest } = props, sanitizedProps = Object.fromEntries(
|
|
699
|
+
Object.entries(rest).filter(([, val]) => !!val && (!isArray(val) || val.length > 0)).map(([key2, val]) => key2.startsWith("$") ? [`data-${toSnakeCase(key2.slice(1))}`, val] : [key2, val])
|
|
700
|
+
);
|
|
701
|
+
return createElement(as ?? tagName, { ...sanitizedProps, as: forwardedAs, ref });
|
|
702
|
+
});
|
|
703
|
+
return Styled.displayName = `Styled(${typeof tagName == "function" ? tagName.displayName : tagName})`, Styled;
|
|
704
|
+
};
|
|
705
|
+
return m.attrs = (attrs) => (_strings, ..._interpolations) => {
|
|
706
|
+
const StyledAttrs = forwardRef(function(_props, ref) {
|
|
707
|
+
const props = { ...attrs, ..._props }, { as, forwardedAs, ...rest } = props, sanitizedProps = Object.fromEntries(
|
|
708
|
+
Object.entries(rest).filter(([, val]) => !!val && (!isArray(val) || val.length > 0)).map(([key2, val]) => key2.startsWith("$") ? [`data-${toSnakeCase(key2.slice(1))}`, val] : [key2, val])
|
|
709
|
+
);
|
|
710
|
+
return createElement(as ?? tagName, { ...sanitizedProps, as: forwardedAs, ref });
|
|
711
|
+
});
|
|
712
|
+
return StyledAttrs.displayName = `StyledAttrs(${typeof tagName == "function" ? tagName.displayName : tagName})`, StyledAttrs;
|
|
713
|
+
}, m;
|
|
714
|
+
}, styled = baseStyled;
|
|
715
|
+
for (const tagName of elements)
|
|
716
|
+
styled[tagName] = baseStyled(tagName);
|
|
717
|
+
function toSnakeCase(str) {
|
|
718
|
+
return str.replace(/[A-Z]/g, (letter) => `-${letter.toLowerCase()}`);
|
|
719
|
+
}
|
|
720
|
+
function isArray(value) {
|
|
721
|
+
return Array.isArray(value);
|
|
722
|
+
}
|
|
556
723
|
function getGlobalScope() {
|
|
557
724
|
if (typeof globalThis < "u") return globalThis;
|
|
558
725
|
if (typeof window < "u") return window;
|
|
@@ -648,107 +815,16 @@ function usePrefersDark(getServerSnapshot2 = () => !1) {
|
|
|
648
815
|
function usePrefersReducedMotion(getServerSnapshot2 = () => !1) {
|
|
649
816
|
return useMatchMedia("(prefers-reduced-motion: reduce)", getServerSnapshot2);
|
|
650
817
|
}
|
|
651
|
-
|
|
652
|
-
return [border, borderTop, borderRight, borderBottom, borderLeft];
|
|
653
|
-
}
|
|
654
|
-
function border(props) {
|
|
655
|
-
const { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
|
|
656
|
-
return _responsive(
|
|
657
|
-
media,
|
|
658
|
-
props.$border,
|
|
659
|
-
(value) => value ? { "&&": { border: borderStyle } } : { "&&": { border: 0 } }
|
|
660
|
-
);
|
|
661
|
-
}
|
|
662
|
-
function borderTop(props) {
|
|
663
|
-
const { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
|
|
664
|
-
return _responsive(
|
|
665
|
-
media,
|
|
666
|
-
props.$borderTop,
|
|
667
|
-
(value) => value ? { "&&": { borderTop: borderStyle } } : { "&&": { borderTop: 0 } }
|
|
668
|
-
);
|
|
669
|
-
}
|
|
670
|
-
function borderRight(props) {
|
|
671
|
-
const { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
|
|
672
|
-
return _responsive(
|
|
673
|
-
media,
|
|
674
|
-
props.$borderRight,
|
|
675
|
-
(value) => value ? { "&&": { borderRight: borderStyle } } : { "&&": { borderRight: 0 } }
|
|
676
|
-
);
|
|
677
|
-
}
|
|
678
|
-
function borderBottom(props) {
|
|
679
|
-
const { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
|
|
680
|
-
return _responsive(
|
|
681
|
-
media,
|
|
682
|
-
props.$borderBottom,
|
|
683
|
-
(value) => value ? { "&&": { borderBottom: borderStyle } } : { "&&": { borderBottom: 0 } }
|
|
684
|
-
);
|
|
685
|
-
}
|
|
686
|
-
function borderLeft(props) {
|
|
687
|
-
const { card, media } = getTheme_v2(props.theme), borderStyle = `${card.border?.width ?? 1}px solid var(--card-border-color)`;
|
|
688
|
-
return _responsive(
|
|
689
|
-
media,
|
|
690
|
-
props.$borderLeft,
|
|
691
|
-
(value) => value ? { "&&": { borderLeft: borderStyle } } : { "&&": { borderLeft: 0 } }
|
|
692
|
-
);
|
|
693
|
-
}
|
|
694
|
-
const BASE_STYLE$4 = {
|
|
695
|
-
'&[data-as="ul"],&[data-as="ol"]': {
|
|
696
|
-
listStyle: "none"
|
|
697
|
-
}
|
|
698
|
-
}, BOX_SIZING = {
|
|
699
|
-
content: "content-box",
|
|
700
|
-
border: "border-box"
|
|
701
|
-
}, BOX_HEIGHT = {
|
|
702
|
-
stretch: "stretch",
|
|
703
|
-
fill: "100%"
|
|
704
|
-
};
|
|
705
|
-
function boxStyle() {
|
|
706
|
-
return BASE_STYLE$4;
|
|
707
|
-
}
|
|
708
|
-
function responsiveBoxStyle() {
|
|
709
|
-
return [
|
|
710
|
-
responsiveBoxSizingStyle,
|
|
711
|
-
responsiveBoxHeightStyle,
|
|
712
|
-
responsiveBoxOverflowStyle,
|
|
713
|
-
responsiveBoxDisplayStyle
|
|
714
|
-
];
|
|
715
|
-
}
|
|
716
|
-
function responsiveBoxDisplayStyle(props) {
|
|
717
|
-
const { media } = getTheme_v2(props.theme);
|
|
718
|
-
return _responsive(media, props.$display, (display) => ({
|
|
719
|
-
"&:not([hidden])": { display }
|
|
720
|
-
}));
|
|
721
|
-
}
|
|
722
|
-
function responsiveBoxSizingStyle(props) {
|
|
723
|
-
const { media } = getTheme_v2(props.theme);
|
|
724
|
-
return _responsive(media, props.$sizing, (sizing) => ({
|
|
725
|
-
boxSizing: BOX_SIZING[sizing]
|
|
726
|
-
}));
|
|
727
|
-
}
|
|
728
|
-
function responsiveBoxHeightStyle(props) {
|
|
729
|
-
const { media } = getTheme_v2(props.theme);
|
|
730
|
-
return _responsive(media, props.$height, (height) => ({
|
|
731
|
-
height: BOX_HEIGHT[height]
|
|
732
|
-
}));
|
|
733
|
-
}
|
|
734
|
-
function responsiveBoxOverflowStyle(props) {
|
|
735
|
-
const { media } = getTheme_v2(props.theme);
|
|
736
|
-
return _responsive(media, props.$overflow, (overflow) => ({
|
|
737
|
-
overflow
|
|
738
|
-
}));
|
|
739
|
-
}
|
|
740
|
-
const BASE_STYLE$3 = {
|
|
818
|
+
const BASE_STYLE$1 = {
|
|
741
819
|
"&&:not([hidden])": {
|
|
742
820
|
display: "flex"
|
|
743
821
|
}
|
|
744
822
|
};
|
|
745
823
|
function responsiveFlexStyle() {
|
|
746
824
|
return [
|
|
747
|
-
BASE_STYLE$
|
|
825
|
+
BASE_STYLE$1,
|
|
748
826
|
responsiveFlexAlignStyle,
|
|
749
827
|
responsiveFlexGapStyle,
|
|
750
|
-
responsiveFlexGapXStyle,
|
|
751
|
-
responsiveFlexGapYStyle,
|
|
752
828
|
responsiveFlexWrapStyle,
|
|
753
829
|
responsiveFlexJustifyStyle,
|
|
754
830
|
responsiveFlexDirectionStyle
|
|
@@ -764,18 +840,6 @@ function responsiveFlexGapStyle(props) {
|
|
|
764
840
|
gap: gap ? rem(space[gap]) : void 0
|
|
765
841
|
}));
|
|
766
842
|
}
|
|
767
|
-
function responsiveFlexGapXStyle(props) {
|
|
768
|
-
const { media, space } = getTheme_v2(props.theme);
|
|
769
|
-
return _responsive(media, props.$gapX, (gapX) => ({
|
|
770
|
-
columnGap: gapX ? rem(space[gapX]) : void 0
|
|
771
|
-
}));
|
|
772
|
-
}
|
|
773
|
-
function responsiveFlexGapYStyle(props) {
|
|
774
|
-
const { media, space } = getTheme_v2(props.theme);
|
|
775
|
-
return _responsive(media, props.$gapY, (gapY) => ({
|
|
776
|
-
rowGap: gapY ? rem(space[gapY]) : void 0
|
|
777
|
-
}));
|
|
778
|
-
}
|
|
779
843
|
function responsiveFlexWrapStyle(props) {
|
|
780
844
|
const { media } = getTheme_v2(props.theme);
|
|
781
845
|
return _responsive(media, props.$wrap, (wrap) => ({ flexWrap: wrap }));
|
|
@@ -788,37 +852,30 @@ function responsiveFlexDirectionStyle(props) {
|
|
|
788
852
|
const { media } = getTheme_v2(props.theme);
|
|
789
853
|
return _responsive(media, props.$direction, (direction) => ({ flexDirection: direction }));
|
|
790
854
|
}
|
|
791
|
-
const BASE_STYLE
|
|
855
|
+
const BASE_STYLE = {
|
|
792
856
|
minWidth: 0,
|
|
793
857
|
minHeight: 0
|
|
794
858
|
};
|
|
795
859
|
function flexItemStyle() {
|
|
796
|
-
return [BASE_STYLE
|
|
860
|
+
return [BASE_STYLE, responsiveFlexItemStyle];
|
|
797
861
|
}
|
|
798
862
|
function responsiveFlexItemStyle(props) {
|
|
799
863
|
const { media } = getTheme_v2(props.theme);
|
|
800
864
|
return props.$flex ? _responsive(media, props.$flex, (flex) => ({ flex })) : EMPTY_ARRAY;
|
|
801
865
|
}
|
|
802
|
-
function focusRingBorderStyle(
|
|
803
|
-
return `inset 0 0 0 ${
|
|
866
|
+
function focusRingBorderStyle(border) {
|
|
867
|
+
return `inset 0 0 0 ${border.width}px ${border.color}`;
|
|
804
868
|
}
|
|
805
869
|
function focusRingStyle(opts) {
|
|
806
|
-
const { base, border
|
|
870
|
+
const { base, border, focusRing } = opts, focusRingOutsetWidth = focusRing.offset + focusRing.width, focusRingInsetWidth = 0 - focusRing.offset, bgColor = base ? base.bg : "var(--card-bg-color)";
|
|
807
871
|
return [
|
|
808
872
|
focusRingInsetWidth > 0 && `inset 0 0 0 ${focusRingInsetWidth}px var(--card-focus-ring-color)`,
|
|
809
|
-
|
|
873
|
+
border && focusRingBorderStyle(border),
|
|
810
874
|
focusRingInsetWidth < 0 && `0 0 0 ${0 - focusRingInsetWidth}px ${bgColor}`,
|
|
811
875
|
focusRingOutsetWidth > 0 && `0 0 0 ${focusRingOutsetWidth}px var(--card-focus-ring-color)`
|
|
812
876
|
].filter(Boolean).join(",");
|
|
813
877
|
}
|
|
814
|
-
const
|
|
815
|
-
"&&:not([hidden])": {
|
|
816
|
-
display: "grid"
|
|
817
|
-
},
|
|
818
|
-
'&[data-as="ul"],&[data-as="ol"]': {
|
|
819
|
-
listStyle: "none"
|
|
820
|
-
}
|
|
821
|
-
}, GRID_AUTO_COLUMS = {
|
|
878
|
+
const GRID_AUTO_COLUMS = {
|
|
822
879
|
auto: "auto",
|
|
823
880
|
min: "min-content",
|
|
824
881
|
max: "max-content",
|
|
@@ -831,7 +888,6 @@ const GRID_CSS = {
|
|
|
831
888
|
};
|
|
832
889
|
function responsiveGridStyle() {
|
|
833
890
|
return [
|
|
834
|
-
GRID_CSS,
|
|
835
891
|
responsiveGridAutoFlowStyle,
|
|
836
892
|
responsiveGridAutoRowsStyle,
|
|
837
893
|
responsiveGridAutoColsStyle,
|
|
@@ -890,53 +946,6 @@ function responsiveGridGapYStyle(props) {
|
|
|
890
946
|
rowGap: gapY ? rem(space[gapY]) : void 0
|
|
891
947
|
}));
|
|
892
948
|
}
|
|
893
|
-
function responsiveGridItemStyle() {
|
|
894
|
-
return [
|
|
895
|
-
responsiveGridItemRowStyle,
|
|
896
|
-
responsiveGridItemRowStartStyle,
|
|
897
|
-
responsiveGridItemRowEndStyle,
|
|
898
|
-
responsiveGridItemColumnStyle,
|
|
899
|
-
responsiveGridItemColumnStartStyle,
|
|
900
|
-
responsiveGridItemColumnEndStyle
|
|
901
|
-
];
|
|
902
|
-
}
|
|
903
|
-
const GRID_ITEM_ROW = {
|
|
904
|
-
auto: "auto",
|
|
905
|
-
full: "1 / -1"
|
|
906
|
-
}, GRID_ITEM_COLUMN = {
|
|
907
|
-
auto: "auto",
|
|
908
|
-
full: "1 / -1"
|
|
909
|
-
};
|
|
910
|
-
function responsiveGridItemRowStyle(props) {
|
|
911
|
-
const { media } = getTheme_v2(props.theme);
|
|
912
|
-
return _responsive(media, props.$row, (row) => typeof row == "number" ? { gridRow: `span ${row} / span ${row}` } : { gridRow: GRID_ITEM_ROW[row] });
|
|
913
|
-
}
|
|
914
|
-
function responsiveGridItemRowStartStyle(props) {
|
|
915
|
-
const { media } = getTheme_v2(props.theme);
|
|
916
|
-
return _responsive(media, props.$rowStart, (rowStart) => ({
|
|
917
|
-
gridRowStart: rowStart
|
|
918
|
-
}));
|
|
919
|
-
}
|
|
920
|
-
function responsiveGridItemRowEndStyle(props) {
|
|
921
|
-
const { media } = getTheme_v2(props.theme);
|
|
922
|
-
return _responsive(media, props.$rowEnd, (rowEnd) => ({ gridRowEnd: rowEnd }));
|
|
923
|
-
}
|
|
924
|
-
function responsiveGridItemColumnStyle(props) {
|
|
925
|
-
const { media } = getTheme_v2(props.theme);
|
|
926
|
-
return _responsive(media, props.$column, (column) => typeof column == "number" ? { gridColumn: `span ${column} / span ${column}` } : { gridColumn: GRID_ITEM_COLUMN[column] });
|
|
927
|
-
}
|
|
928
|
-
function responsiveGridItemColumnStartStyle(props) {
|
|
929
|
-
const { media } = getTheme_v2(props.theme);
|
|
930
|
-
return _responsive(media, props.$columnStart, (columnStart) => ({
|
|
931
|
-
gridColumnStart: columnStart
|
|
932
|
-
}));
|
|
933
|
-
}
|
|
934
|
-
function responsiveGridItemColumnEndStyle(props) {
|
|
935
|
-
const { media } = getTheme_v2(props.theme);
|
|
936
|
-
return _responsive(media, props.$columnEnd, (columnEnd) => ({
|
|
937
|
-
gridColumnEnd: columnEnd
|
|
938
|
-
}));
|
|
939
|
-
}
|
|
940
949
|
function responsiveInputPaddingStyle(props) {
|
|
941
950
|
const { $fontSize, $iconLeft, $iconRight, $padding, $space } = props, { font, media, space } = getTheme_v2(props.theme), len = Math.max($padding.length, $space.length, $fontSize.length), _padding = [], _space = [], _fontSize = [];
|
|
942
951
|
for (let i = 0; i < len; i += 1)
|
|
@@ -1170,30 +1179,6 @@ function textInputRepresentationStyle(props) {
|
|
|
1170
1179
|
}
|
|
1171
1180
|
`;
|
|
1172
1181
|
}
|
|
1173
|
-
function responsiveMarginStyle(props) {
|
|
1174
|
-
const { theme } = props;
|
|
1175
|
-
return [
|
|
1176
|
-
_getResponsiveSpace(theme, ["margin"], props.$margin),
|
|
1177
|
-
_getResponsiveSpace(theme, ["marginLeft", "marginRight"], props.$marginX),
|
|
1178
|
-
_getResponsiveSpace(theme, ["marginTop", "marginBottom"], props.$marginY),
|
|
1179
|
-
_getResponsiveSpace(theme, ["marginTop"], props.$marginTop),
|
|
1180
|
-
_getResponsiveSpace(theme, ["marginRight"], props.$marginRight),
|
|
1181
|
-
_getResponsiveSpace(theme, ["marginBottom"], props.$marginBottom),
|
|
1182
|
-
_getResponsiveSpace(theme, ["marginLeft"], props.$marginLeft)
|
|
1183
|
-
].filter(Boolean);
|
|
1184
|
-
}
|
|
1185
|
-
function responsivePaddingStyle(props) {
|
|
1186
|
-
const { theme } = props;
|
|
1187
|
-
return [
|
|
1188
|
-
_getResponsiveSpace(theme, ["padding"], props.$padding),
|
|
1189
|
-
_getResponsiveSpace(theme, ["paddingLeft", "paddingRight"], props.$paddingX),
|
|
1190
|
-
_getResponsiveSpace(theme, ["paddingTop", "paddingBottom"], props.$paddingY),
|
|
1191
|
-
_getResponsiveSpace(theme, ["paddingTop"], props.$paddingTop),
|
|
1192
|
-
_getResponsiveSpace(theme, ["paddingRight"], props.$paddingRight),
|
|
1193
|
-
_getResponsiveSpace(theme, ["paddingBottom"], props.$paddingBottom),
|
|
1194
|
-
_getResponsiveSpace(theme, ["paddingLeft"], props.$paddingLeft)
|
|
1195
|
-
].filter(Boolean);
|
|
1196
|
-
}
|
|
1197
1182
|
function responsiveRadiusStyle(props) {
|
|
1198
1183
|
const { media, radius } = getTheme_v2(props.theme);
|
|
1199
1184
|
return _responsive(media, props.$radius, (value) => {
|
|
@@ -1201,22 +1186,6 @@ function responsiveRadiusStyle(props) {
|
|
|
1201
1186
|
return typeof value == "number" && (borderRadius = rem(radius[value])), value === "full" && (borderRadius = "9999px"), { borderRadius };
|
|
1202
1187
|
});
|
|
1203
1188
|
}
|
|
1204
|
-
function toBoxShadow(shadow, color) {
|
|
1205
|
-
return `${shadow.map(rem).join(" ")} ${color}`;
|
|
1206
|
-
}
|
|
1207
|
-
function shadowStyle(shadow, outlineWidth = 1) {
|
|
1208
|
-
if (!shadow) return EMPTY_RECORD;
|
|
1209
|
-
const outline = `0 0 0 ${rem(outlineWidth)} var(--card-shadow-outline-color)`, umbra = toBoxShadow(shadow.umbra, "var(--card-shadow-umbra-color)"), penumbra = toBoxShadow(shadow.penumbra, "var(--card-shadow-penumbra-color)"), ambient = toBoxShadow(shadow.ambient, "var(--card-shadow-ambient-color)");
|
|
1210
|
-
return { boxShadow: `${outline}, ${umbra}, ${penumbra}, ${ambient}` };
|
|
1211
|
-
}
|
|
1212
|
-
function responsiveShadowStyle(props) {
|
|
1213
|
-
const { card, media, shadow } = getTheme_v2(props.theme);
|
|
1214
|
-
return _responsive(
|
|
1215
|
-
media,
|
|
1216
|
-
props.$shadow,
|
|
1217
|
-
(index) => shadowStyle(shadow[index], card.shadow.outline)
|
|
1218
|
-
);
|
|
1219
|
-
}
|
|
1220
1189
|
function labelBaseStyle(props) {
|
|
1221
1190
|
const { $accent, $muted } = props, { font } = getTheme_v2(props.theme);
|
|
1222
1191
|
return css`
|
|
@@ -1251,7 +1220,7 @@ function labelBaseStyle(props) {
|
|
|
1251
1220
|
}
|
|
1252
1221
|
`;
|
|
1253
1222
|
}
|
|
1254
|
-
const Root$
|
|
1223
|
+
const Root$f = styled.div(responsiveLabelFont, responsiveTextAlignStyle, labelBaseStyle), SpanWithTextOverflow$2 = styled.span`
|
|
1255
1224
|
display: block;
|
|
1256
1225
|
white-space: nowrap;
|
|
1257
1226
|
text-overflow: ellipsis;
|
|
@@ -1262,6 +1231,7 @@ const Root$C = styled.div(responsiveLabelFont, responsiveTextAlignStyle, labelBa
|
|
|
1262
1231
|
accent,
|
|
1263
1232
|
align,
|
|
1264
1233
|
children: childrenProp,
|
|
1234
|
+
className,
|
|
1265
1235
|
muted = !1,
|
|
1266
1236
|
size: size2 = 2,
|
|
1267
1237
|
textOverflow,
|
|
@@ -1270,164 +1240,31 @@ const Root$C = styled.div(responsiveLabelFont, responsiveTextAlignStyle, labelBa
|
|
|
1270
1240
|
} = props;
|
|
1271
1241
|
let children = childrenProp;
|
|
1272
1242
|
return textOverflow === "ellipsis" ? children = /* @__PURE__ */ jsx(SpanWithTextOverflow$2, { children }) : children = /* @__PURE__ */ jsx("span", { children }), /* @__PURE__ */ jsx(
|
|
1273
|
-
Root$
|
|
1243
|
+
Root$f,
|
|
1274
1244
|
{
|
|
1275
1245
|
"data-ui": "Label",
|
|
1276
1246
|
...restProps,
|
|
1277
|
-
$accent: accent,
|
|
1278
1247
|
$align: useArrayProp(align),
|
|
1279
|
-
$muted: muted,
|
|
1280
|
-
$size: useArrayProp(size2),
|
|
1281
1248
|
$weight: weight,
|
|
1249
|
+
className: composeClassNames(
|
|
1250
|
+
className,
|
|
1251
|
+
label({
|
|
1252
|
+
accent,
|
|
1253
|
+
muted,
|
|
1254
|
+
size: size2
|
|
1255
|
+
})
|
|
1256
|
+
),
|
|
1282
1257
|
ref,
|
|
1283
1258
|
children
|
|
1284
1259
|
}
|
|
1285
1260
|
);
|
|
1286
1261
|
});
|
|
1287
1262
|
Label.displayName = "ForwardRef(Label)";
|
|
1288
|
-
const
|
|
1289
|
-
root: avatarRootStyle,
|
|
1290
|
-
arrow: avatarArrowStyle,
|
|
1291
|
-
bgStroke: avatarBgStrokeStyle,
|
|
1292
|
-
stroke: avatarStrokeStyle,
|
|
1293
|
-
initials: avatarInitialsStyle,
|
|
1294
|
-
image: avatarImageStyle
|
|
1295
|
-
};
|
|
1296
|
-
function avatarArrowStyle() {
|
|
1297
|
-
return {
|
|
1298
|
-
position: "absolute",
|
|
1299
|
-
boxSizing: "border-box",
|
|
1300
|
-
zIndex: 0,
|
|
1301
|
-
opacity: 0,
|
|
1302
|
-
transition: "all 0.2s linear",
|
|
1303
|
-
transform: "rotate(-90deg) translate3d(0, 6px, 0)",
|
|
1304
|
-
left: 0,
|
|
1305
|
-
right: 0,
|
|
1306
|
-
top: 0,
|
|
1307
|
-
bottom: 0,
|
|
1308
|
-
"& > svg": {
|
|
1309
|
-
width: "11px",
|
|
1310
|
-
height: "7px",
|
|
1311
|
-
position: "absolute",
|
|
1312
|
-
top: "-5px",
|
|
1313
|
-
left: "50%",
|
|
1314
|
-
transform: "translateX(-6px)",
|
|
1315
|
-
"&:not([hidden])": {
|
|
1316
|
-
display: "block"
|
|
1317
|
-
}
|
|
1318
|
-
},
|
|
1319
|
-
"[data-arrow-position='inside'] > &": {
|
|
1320
|
-
transform: "rotate(-90deg) translate3d(0, 6px, 0)",
|
|
1321
|
-
opacity: 0
|
|
1322
|
-
},
|
|
1323
|
-
"[data-arrow-position='top'] > &": {
|
|
1324
|
-
opacity: 1,
|
|
1325
|
-
transform: "rotate(0deg)"
|
|
1326
|
-
},
|
|
1327
|
-
"[data-arrow-position='bottom'] > &": {
|
|
1328
|
-
opacity: 1,
|
|
1329
|
-
transform: "rotate(-180deg)"
|
|
1330
|
-
}
|
|
1331
|
-
};
|
|
1332
|
-
}
|
|
1333
|
-
function avatarRootStyle(props) {
|
|
1334
|
-
const { $color } = props, { avatar } = getTheme_v2(props.theme);
|
|
1335
|
-
return {
|
|
1336
|
-
"--avatar-bg-color": `var(--card-avatar-${$color}-bg-color)`,
|
|
1337
|
-
"--avatar-fg-color": `var(--card-avatar-${$color}-fg-color)`,
|
|
1338
|
-
backgroundColor: "var(--avatar-bg-color)",
|
|
1339
|
-
position: "relative",
|
|
1340
|
-
boxSizing: "border-box",
|
|
1341
|
-
userSelect: "none",
|
|
1342
|
-
boxShadow: "0 0 0 1px var(--card-bg-color)",
|
|
1343
|
-
'&[data-status="inactive"]': {
|
|
1344
|
-
opacity: 0.5
|
|
1345
|
-
},
|
|
1346
|
-
"&>svg": {
|
|
1347
|
-
"&:not([hidden])": {
|
|
1348
|
-
display: "block"
|
|
1349
|
-
}
|
|
1350
|
-
},
|
|
1351
|
-
/* &:is(button) */
|
|
1352
|
-
'&[data-as="button"]': {
|
|
1353
|
-
WebkitFontSmoothing: "inherit",
|
|
1354
|
-
appearance: "none",
|
|
1355
|
-
margin: 0,
|
|
1356
|
-
padding: 0,
|
|
1357
|
-
border: 0,
|
|
1358
|
-
font: "inherit",
|
|
1359
|
-
color: "inherit",
|
|
1360
|
-
outline: "none",
|
|
1361
|
-
"&:focus": {
|
|
1362
|
-
boxShadow: focusRingStyle({ focusRing: avatar.focusRing })
|
|
1363
|
-
},
|
|
1364
|
-
"&:focus:not(:focus-visible)": {
|
|
1365
|
-
boxShadow: "none"
|
|
1366
|
-
}
|
|
1367
|
-
}
|
|
1368
|
-
};
|
|
1369
|
-
}
|
|
1370
|
-
function responsiveAvatarSizeStyle(props) {
|
|
1371
|
-
const { avatar, media } = getTheme_v2(props.theme);
|
|
1372
|
-
return _responsive(media, props.$size, (size2) => {
|
|
1373
|
-
const avatarSize = avatar.sizes[size2] || avatar.sizes[0];
|
|
1374
|
-
return {
|
|
1375
|
-
width: rem(avatarSize.size),
|
|
1376
|
-
height: rem(avatarSize.size),
|
|
1377
|
-
borderRadius: rem(avatarSize.size / 2),
|
|
1378
|
-
"&>svg": {
|
|
1379
|
-
width: rem(avatarSize.size),
|
|
1380
|
-
height: rem(avatarSize.size),
|
|
1381
|
-
borderRadius: rem(avatarSize.size / 2)
|
|
1382
|
-
}
|
|
1383
|
-
};
|
|
1384
|
-
});
|
|
1385
|
-
}
|
|
1386
|
-
function avatarImageStyle() {
|
|
1387
|
-
return {
|
|
1388
|
-
position: "relative"
|
|
1389
|
-
};
|
|
1390
|
-
}
|
|
1391
|
-
function avatarInitialsStyle() {
|
|
1392
|
-
return {
|
|
1393
|
-
width: "100%",
|
|
1394
|
-
height: "100%",
|
|
1395
|
-
color: "var(--avatar-fg-color)",
|
|
1396
|
-
alignItems: "center",
|
|
1397
|
-
justifyContent: "center",
|
|
1398
|
-
textTransform: "uppercase",
|
|
1399
|
-
textAlign: "center",
|
|
1400
|
-
borderRadius: "50%",
|
|
1401
|
-
"&:not([hidden])": {
|
|
1402
|
-
display: "flex"
|
|
1403
|
-
}
|
|
1404
|
-
};
|
|
1405
|
-
}
|
|
1406
|
-
function avatarBgStrokeStyle() {
|
|
1407
|
-
return {
|
|
1408
|
-
strokeWidth: "4px",
|
|
1409
|
-
stroke: "var(--card-bg-color)"
|
|
1410
|
-
};
|
|
1411
|
-
}
|
|
1412
|
-
function avatarStrokeStyle() {
|
|
1413
|
-
return {
|
|
1414
|
-
strokeWidth: "2px",
|
|
1415
|
-
stroke: "var(--avatar-bg-color)",
|
|
1416
|
-
'[data-status="editing"] &': {
|
|
1417
|
-
strokeDasharray: "2 4",
|
|
1418
|
-
strokeLinecap: "round"
|
|
1419
|
-
}
|
|
1420
|
-
};
|
|
1421
|
-
}
|
|
1422
|
-
const Root$B = styled.div(
|
|
1423
|
-
responsiveAvatarSizeStyle,
|
|
1424
|
-
avatarStyle.root
|
|
1425
|
-
), Arrow$1 = styled.div(avatarStyle.arrow), BgStroke = styled.ellipse(avatarStyle.bgStroke), Stroke = styled.ellipse(avatarStyle.stroke), Initials = styled.div(avatarStyle.initials), InitialsLabel = styled(Label)({
|
|
1426
|
-
color: "inherit"
|
|
1427
|
-
}), Image = styled.svg(avatarStyle.image), Avatar = forwardRef(function(props, ref) {
|
|
1263
|
+
const Avatar = forwardRef(function(props, ref) {
|
|
1428
1264
|
const {
|
|
1429
1265
|
__unstable_hideInnerStroke,
|
|
1430
1266
|
as: asProp,
|
|
1267
|
+
className,
|
|
1431
1268
|
color = "gray",
|
|
1432
1269
|
src,
|
|
1433
1270
|
title,
|
|
@@ -1438,7 +1275,7 @@ const Root$B = styled.div(
|
|
|
1438
1275
|
status = "online",
|
|
1439
1276
|
size: sizeProp = 1,
|
|
1440
1277
|
...restProps
|
|
1441
|
-
} = props, { avatar } = useTheme_v2(),
|
|
1278
|
+
} = props, { avatar: avatarTheme } = useTheme_v2(), As = ReactIs.isValidElementType(asProp) ? asProp : "div", size2 = useArrayProp(sizeProp), _sizeRem = (avatarTheme.sizes[size2[0]] || avatarTheme.sizes[0]).size, _radius = _sizeRem / 2, elementId = useId(), [arrowPosition, setArrowPosition] = useState(
|
|
1442
1279
|
animateArrowFrom || arrowPositionProp || "inside"
|
|
1443
1280
|
), [imageFailed, setImageFailed] = useState(!1), imageId = `avatar-image-${elementId}`;
|
|
1444
1281
|
useEffect(() => {
|
|
@@ -1455,28 +1292,34 @@ const Root$B = styled.div(
|
|
|
1455
1292
|
[size2]
|
|
1456
1293
|
);
|
|
1457
1294
|
return /* @__PURE__ */ jsxs(
|
|
1458
|
-
|
|
1295
|
+
As,
|
|
1459
1296
|
{
|
|
1460
|
-
as,
|
|
1461
|
-
"data-as": typeof as == "string" ? as : void 0,
|
|
1297
|
+
"data-as": typeof As == "string" ? As : void 0,
|
|
1462
1298
|
"data-ui": "Avatar",
|
|
1463
1299
|
...restProps,
|
|
1464
1300
|
$color: color,
|
|
1465
1301
|
$size: size2,
|
|
1466
1302
|
"aria-label": title,
|
|
1467
|
-
|
|
1303
|
+
className: composeClassNames(
|
|
1304
|
+
className,
|
|
1305
|
+
avatar({
|
|
1306
|
+
arrowPosition,
|
|
1307
|
+
color,
|
|
1308
|
+
size: sizeProp
|
|
1309
|
+
})
|
|
1310
|
+
),
|
|
1468
1311
|
"data-status": status,
|
|
1469
1312
|
ref,
|
|
1470
1313
|
title,
|
|
1471
1314
|
children: [
|
|
1472
|
-
/* @__PURE__ */ jsx(
|
|
1315
|
+
/* @__PURE__ */ jsx("span", { className: avatarArrow(), children: /* @__PURE__ */ jsx("svg", { width: "11", height: "7", viewBox: "0 0 11 7", fill: "none", children: /* @__PURE__ */ jsx(
|
|
1473
1316
|
"path",
|
|
1474
1317
|
{
|
|
1475
1318
|
d: "M6.67948 1.50115L11 7L0 7L4.32052 1.50115C4.92109 0.736796 6.07891 0.736795 6.67948 1.50115Z",
|
|
1476
1319
|
fill: color
|
|
1477
1320
|
}
|
|
1478
1321
|
) }) }),
|
|
1479
|
-
!imageFailed && src && /* @__PURE__ */ jsxs(
|
|
1322
|
+
!imageFailed && src && /* @__PURE__ */ jsxs("svg", { className: avatarImage(), viewBox: `0 0 ${_sizeRem} ${_sizeRem}`, fill: "none", children: [
|
|
1480
1323
|
/* @__PURE__ */ jsx("defs", { children: /* @__PURE__ */ jsx("pattern", { id: imageId, patternContentUnits: "objectBoundingBox", width: "1", height: "1", children: /* @__PURE__ */ jsx(
|
|
1481
1324
|
"image",
|
|
1482
1325
|
{
|
|
@@ -1488,8 +1331,9 @@ const Root$B = styled.div(
|
|
|
1488
1331
|
) }) }),
|
|
1489
1332
|
/* @__PURE__ */ jsx("circle", { cx: _radius, cy: _radius, r: _radius, fill: `url(#${imageId})` }),
|
|
1490
1333
|
!__unstable_hideInnerStroke && /* @__PURE__ */ jsx(
|
|
1491
|
-
|
|
1334
|
+
"ellipse",
|
|
1492
1335
|
{
|
|
1336
|
+
className: avatarBgStroke(),
|
|
1493
1337
|
cx: _radius,
|
|
1494
1338
|
cy: _radius,
|
|
1495
1339
|
rx: _radius,
|
|
@@ -1498,8 +1342,9 @@ const Root$B = styled.div(
|
|
|
1498
1342
|
}
|
|
1499
1343
|
),
|
|
1500
1344
|
/* @__PURE__ */ jsx(
|
|
1501
|
-
|
|
1345
|
+
"ellipse",
|
|
1502
1346
|
{
|
|
1347
|
+
className: avatarStroke(),
|
|
1503
1348
|
cx: _radius,
|
|
1504
1349
|
cy: _radius,
|
|
1505
1350
|
rx: _radius,
|
|
@@ -1508,16 +1353,16 @@ const Root$B = styled.div(
|
|
|
1508
1353
|
}
|
|
1509
1354
|
)
|
|
1510
1355
|
] }),
|
|
1511
|
-
(imageFailed || !src) && initials && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
1356
|
+
(imageFailed || !src) && initials && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("span", { className: avatarInitials(), children: /* @__PURE__ */ jsx(Label, { as: "span", size: initialsSize, style: { color: "inherit" }, weight: "medium", children: initials }) }) })
|
|
1512
1357
|
]
|
|
1513
1358
|
}
|
|
1514
1359
|
);
|
|
1515
1360
|
});
|
|
1516
1361
|
Avatar.displayName = "ForwardRef(Avatar)";
|
|
1517
1362
|
function _responsiveAvatarCounterSizeStyle(props) {
|
|
1518
|
-
const { avatar, media } = getTheme_v2(props.theme);
|
|
1363
|
+
const { avatar: avatar2, media } = getTheme_v2(props.theme);
|
|
1519
1364
|
return _responsive(media, props.$size, (size2) => {
|
|
1520
|
-
const avatarSize =
|
|
1365
|
+
const avatarSize = avatar2.sizes[size2];
|
|
1521
1366
|
return avatarSize ? {
|
|
1522
1367
|
borderRadius: rem(avatarSize.size / 2),
|
|
1523
1368
|
minWidth: rem(avatarSize.size),
|
|
@@ -1545,7 +1390,7 @@ function _avatarCounterBaseStyle(props) {
|
|
|
1545
1390
|
}
|
|
1546
1391
|
`;
|
|
1547
1392
|
}
|
|
1548
|
-
const Root$
|
|
1393
|
+
const Root$e = styled.div(
|
|
1549
1394
|
_responsiveAvatarCounterSizeStyle,
|
|
1550
1395
|
_avatarCounterBaseStyle
|
|
1551
1396
|
), AvatarCounter = forwardRef(function(props, ref) {
|
|
@@ -1553,7 +1398,7 @@ const Root$A = styled.div(
|
|
|
1553
1398
|
() => size2.map((s) => s === 1 ? 1 : s === 2 ? 3 : s === 3 ? 5 : 0),
|
|
1554
1399
|
[size2]
|
|
1555
1400
|
);
|
|
1556
|
-
return /* @__PURE__ */ jsx(Root$
|
|
1401
|
+
return /* @__PURE__ */ jsx(Root$e, { $size: size2, "data-ui": "AvatarCounter", ref, children: /* @__PURE__ */ jsx(Label, { as: "span", size: fontSize2, weight: "medium", children: count }) });
|
|
1557
1402
|
});
|
|
1558
1403
|
AvatarCounter.displayName = "ForwardRef(AvatarCounter)";
|
|
1559
1404
|
const BASE_STYLES = css`
|
|
@@ -1571,9 +1416,9 @@ function avatarStackStyle() {
|
|
|
1571
1416
|
return BASE_STYLES;
|
|
1572
1417
|
}
|
|
1573
1418
|
function responsiveAvatarStackSizeStyle(props) {
|
|
1574
|
-
const { avatar, media } = getTheme_v2(props.theme);
|
|
1419
|
+
const { avatar: avatar2, media } = getTheme_v2(props.theme);
|
|
1575
1420
|
return _responsive(media, props.$size, (size2) => {
|
|
1576
|
-
const avatarSize =
|
|
1421
|
+
const avatarSize = avatar2.sizes[size2];
|
|
1577
1422
|
return avatarSize ? {
|
|
1578
1423
|
"& > div + div": {
|
|
1579
1424
|
marginLeft: rem(avatarSize.distance)
|
|
@@ -1581,7 +1426,7 @@ function responsiveAvatarStackSizeStyle(props) {
|
|
|
1581
1426
|
} : EMPTY_RECORD;
|
|
1582
1427
|
});
|
|
1583
1428
|
}
|
|
1584
|
-
const Root$
|
|
1429
|
+
const Root$d = styled.div(responsiveAvatarStackSizeStyle, avatarStackStyle), AvatarStack = forwardRef(function(props, ref) {
|
|
1585
1430
|
const {
|
|
1586
1431
|
children: childrenProp,
|
|
1587
1432
|
maxLength: maxLengthProp = 4,
|
|
@@ -1591,29 +1436,30 @@ const Root$z = styled.div(responsiveAvatarStackSizeStyle, avatarStackStyle), Ava
|
|
|
1591
1436
|
() => Children.toArray(childrenProp).filter(isValidElement),
|
|
1592
1437
|
[childrenProp]
|
|
1593
1438
|
), maxLength = Math.max(maxLengthProp, 0), size2 = useArrayProp(sizeProp), len = children.length, visibleCount = maxLength - 1, extraCount = len - visibleCount, visibleChildren = extraCount > 1 ? children.slice(extraCount, len) : children;
|
|
1594
|
-
return /* @__PURE__ */ jsxs(Root$
|
|
1439
|
+
return /* @__PURE__ */ jsxs(Root$d, { "data-ui": "AvatarStack", ...restProps, ref, $size: size2, children: [
|
|
1595
1440
|
len === 0 && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(AvatarCounter, { count: len, size: size2 }) }),
|
|
1596
1441
|
len !== 0 && extraCount > 1 && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(AvatarCounter, { count: extraCount, size: size2 }) }),
|
|
1597
1442
|
visibleChildren.map((child, childIndex) => /* @__PURE__ */ jsx("div", { children: cloneElement(child, { size: size2 }) }, String(childIndex)))
|
|
1598
1443
|
] });
|
|
1599
1444
|
});
|
|
1600
1445
|
AvatarStack.displayName = "ForwardRef(AvatarStack)";
|
|
1601
|
-
const
|
|
1602
|
-
boxStyle,
|
|
1603
|
-
flexItemStyle,
|
|
1604
|
-
responsiveBoxStyle,
|
|
1605
|
-
responsiveGridItemStyle,
|
|
1606
|
-
responsiveMarginStyle,
|
|
1607
|
-
responsivePaddingStyle
|
|
1608
|
-
), Box = forwardRef(function(props, ref) {
|
|
1446
|
+
const Box = forwardRef(function(props, ref) {
|
|
1609
1447
|
const {
|
|
1610
|
-
|
|
1448
|
+
align,
|
|
1449
|
+
as: As = "div",
|
|
1450
|
+
className,
|
|
1611
1451
|
column,
|
|
1612
1452
|
columnStart,
|
|
1613
1453
|
columnEnd,
|
|
1454
|
+
direction,
|
|
1614
1455
|
display = "block",
|
|
1615
1456
|
flex,
|
|
1457
|
+
gap,
|
|
1458
|
+
gapX,
|
|
1459
|
+
gapY,
|
|
1616
1460
|
height,
|
|
1461
|
+
inset,
|
|
1462
|
+
justify,
|
|
1617
1463
|
margin = 0,
|
|
1618
1464
|
marginX,
|
|
1619
1465
|
marginY,
|
|
@@ -1629,119 +1475,70 @@ const Root$y = styled.div(
|
|
|
1629
1475
|
paddingRight,
|
|
1630
1476
|
paddingBottom,
|
|
1631
1477
|
paddingLeft,
|
|
1478
|
+
pointerEvents,
|
|
1479
|
+
position,
|
|
1632
1480
|
row,
|
|
1633
1481
|
rowStart,
|
|
1634
1482
|
rowEnd,
|
|
1635
1483
|
sizing,
|
|
1484
|
+
width,
|
|
1485
|
+
wrap,
|
|
1636
1486
|
...restProps
|
|
1637
1487
|
} = props;
|
|
1638
1488
|
return /* @__PURE__ */ jsx(
|
|
1639
|
-
|
|
1489
|
+
As,
|
|
1640
1490
|
{
|
|
1641
|
-
"data-as": typeof
|
|
1491
|
+
"data-as": typeof As == "string" ? As : void 0,
|
|
1642
1492
|
"data-ui": "Box",
|
|
1643
1493
|
...restProps,
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
|
|
1657
|
-
|
|
1658
|
-
|
|
1659
|
-
|
|
1660
|
-
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1494
|
+
className: composeClassNames(
|
|
1495
|
+
className,
|
|
1496
|
+
box({
|
|
1497
|
+
align,
|
|
1498
|
+
column,
|
|
1499
|
+
columnStart,
|
|
1500
|
+
columnEnd,
|
|
1501
|
+
direction,
|
|
1502
|
+
display,
|
|
1503
|
+
flex,
|
|
1504
|
+
gap,
|
|
1505
|
+
gapX,
|
|
1506
|
+
gapY,
|
|
1507
|
+
height,
|
|
1508
|
+
inset,
|
|
1509
|
+
justify,
|
|
1510
|
+
overflow,
|
|
1511
|
+
margin,
|
|
1512
|
+
marginX,
|
|
1513
|
+
marginY,
|
|
1514
|
+
marginTop,
|
|
1515
|
+
marginRight,
|
|
1516
|
+
marginBottom,
|
|
1517
|
+
marginLeft,
|
|
1518
|
+
padding,
|
|
1519
|
+
paddingX,
|
|
1520
|
+
paddingY,
|
|
1521
|
+
paddingTop,
|
|
1522
|
+
paddingRight,
|
|
1523
|
+
paddingBottom,
|
|
1524
|
+
paddingLeft,
|
|
1525
|
+
pointerEvents,
|
|
1526
|
+
position,
|
|
1527
|
+
row,
|
|
1528
|
+
rowStart,
|
|
1529
|
+
rowEnd,
|
|
1530
|
+
sizing,
|
|
1531
|
+
width,
|
|
1532
|
+
wrap
|
|
1533
|
+
})
|
|
1534
|
+
),
|
|
1670
1535
|
ref,
|
|
1671
1536
|
children: props.children
|
|
1672
1537
|
}
|
|
1673
1538
|
);
|
|
1674
1539
|
});
|
|
1675
1540
|
Box.displayName = "ForwardRef(Box)";
|
|
1676
|
-
|
|
1677
|
-
const { $accent, $muted } = props, { font } = getTheme_v2(props.theme);
|
|
1678
|
-
return css`
|
|
1679
|
-
min-width: 0;
|
|
1680
|
-
color: var(--card-fg-color);
|
|
1681
|
-
|
|
1682
|
-
${$accent && css`
|
|
1683
|
-
color: var(--card-accent-fg-color);
|
|
1684
|
-
`}
|
|
1685
|
-
|
|
1686
|
-
${$muted && css`
|
|
1687
|
-
color: var(--card-muted-fg-color);
|
|
1688
|
-
`}
|
|
1689
|
-
|
|
1690
|
-
& code {
|
|
1691
|
-
font-family: ${font.code.family};
|
|
1692
|
-
border-radius: 1px;
|
|
1693
|
-
background-color: var(--card-code-bg-color);
|
|
1694
|
-
color: var(--card-code-fg-color);
|
|
1695
|
-
}
|
|
1696
|
-
|
|
1697
|
-
& a {
|
|
1698
|
-
text-decoration: none;
|
|
1699
|
-
border-radius: 1px;
|
|
1700
|
-
color: var(--card-link-color);
|
|
1701
|
-
outline: none;
|
|
1702
|
-
|
|
1703
|
-
@media (hover: hover) {
|
|
1704
|
-
&:hover {
|
|
1705
|
-
text-decoration: underline;
|
|
1706
|
-
}
|
|
1707
|
-
}
|
|
1708
|
-
|
|
1709
|
-
&:focus {
|
|
1710
|
-
box-shadow:
|
|
1711
|
-
0 0 0 1px var(--card-bg-color),
|
|
1712
|
-
0 0 0 3px var(--card-focus-ring-color);
|
|
1713
|
-
}
|
|
1714
|
-
|
|
1715
|
-
&:focus:not(:focus-visible) {
|
|
1716
|
-
box-shadow: none;
|
|
1717
|
-
}
|
|
1718
|
-
}
|
|
1719
|
-
|
|
1720
|
-
& strong {
|
|
1721
|
-
font-weight: ${font.text.weights.bold};
|
|
1722
|
-
}
|
|
1723
|
-
|
|
1724
|
-
& svg {
|
|
1725
|
-
/* Certain popular CSS libraries changes the defaults for SVG display */
|
|
1726
|
-
/* Make sure SVGs are rendered as inline elements */
|
|
1727
|
-
display: inline;
|
|
1728
|
-
}
|
|
1729
|
-
|
|
1730
|
-
& [data-sanity-icon] {
|
|
1731
|
-
vertical-align: baseline;
|
|
1732
|
-
color: var(--card-icon-color);
|
|
1733
|
-
|
|
1734
|
-
& path {
|
|
1735
|
-
vector-effect: non-scaling-stroke !important;
|
|
1736
|
-
}
|
|
1737
|
-
}
|
|
1738
|
-
`;
|
|
1739
|
-
}
|
|
1740
|
-
const Root$x = styled.div(
|
|
1741
|
-
responsiveTextFont,
|
|
1742
|
-
responsiveTextAlignStyle,
|
|
1743
|
-
textBaseStyle
|
|
1744
|
-
), SpanWithTextOverflow$1 = styled.span`
|
|
1541
|
+
const SpanWithTextOverflow$1 = styled.span`
|
|
1745
1542
|
display: block;
|
|
1746
1543
|
white-space: nowrap;
|
|
1747
1544
|
text-overflow: ellipsis;
|
|
@@ -1751,7 +1548,9 @@ const Root$x = styled.div(
|
|
|
1751
1548
|
const {
|
|
1752
1549
|
accent = !1,
|
|
1753
1550
|
align,
|
|
1551
|
+
as: As = "div",
|
|
1754
1552
|
children: childrenProp,
|
|
1553
|
+
className,
|
|
1755
1554
|
muted = !1,
|
|
1756
1555
|
size: size2 = 2,
|
|
1757
1556
|
textOverflow,
|
|
@@ -1760,282 +1559,86 @@ const Root$x = styled.div(
|
|
|
1760
1559
|
} = props;
|
|
1761
1560
|
let children = childrenProp;
|
|
1762
1561
|
return textOverflow === "ellipsis" ? children = /* @__PURE__ */ jsx(SpanWithTextOverflow$1, { children }) : children = /* @__PURE__ */ jsx("span", { children }), /* @__PURE__ */ jsx(
|
|
1763
|
-
|
|
1562
|
+
As,
|
|
1764
1563
|
{
|
|
1765
1564
|
"data-ui": "Text",
|
|
1766
1565
|
...restProps,
|
|
1767
|
-
$accent: accent,
|
|
1768
1566
|
$align: useArrayProp(align),
|
|
1769
|
-
$muted: muted,
|
|
1770
1567
|
ref,
|
|
1771
|
-
|
|
1772
|
-
|
|
1568
|
+
className: composeClassNames(
|
|
1569
|
+
className,
|
|
1570
|
+
text({
|
|
1571
|
+
accent,
|
|
1572
|
+
muted,
|
|
1573
|
+
size: size2,
|
|
1574
|
+
weight
|
|
1575
|
+
})
|
|
1576
|
+
),
|
|
1773
1577
|
children
|
|
1774
1578
|
}
|
|
1775
1579
|
);
|
|
1776
1580
|
});
|
|
1777
1581
|
Text.displayName = "ForwardRef(Text)";
|
|
1778
|
-
|
|
1779
|
-
const { $tone } = props;
|
|
1780
|
-
return {
|
|
1781
|
-
"--card-bg-color": `var(--card-badge-${$tone}-bg-color)`,
|
|
1782
|
-
"--card-fg-color": `var(--card-badge-${$tone}-fg-color)`,
|
|
1783
|
-
backgroundColor: "var(--card-bg-color)",
|
|
1784
|
-
cursor: "default",
|
|
1785
|
-
"&:not([hidden])": {
|
|
1786
|
-
display: "inline-block",
|
|
1787
|
-
verticalAlign: "top"
|
|
1788
|
-
}
|
|
1789
|
-
};
|
|
1790
|
-
}
|
|
1791
|
-
const Root$w = styled(Box)(
|
|
1792
|
-
responsiveRadiusStyle,
|
|
1793
|
-
badgeStyle
|
|
1794
|
-
), Badge = forwardRef(function(props, ref) {
|
|
1582
|
+
const Badge = forwardRef(function(props, ref) {
|
|
1795
1583
|
const {
|
|
1796
1584
|
children,
|
|
1585
|
+
className,
|
|
1586
|
+
display = "inline-block",
|
|
1797
1587
|
fontSize: fontSize2 = 1,
|
|
1798
1588
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
1799
1589
|
mode: _deprecated_mode,
|
|
1800
1590
|
padding = 1,
|
|
1801
|
-
radius =
|
|
1591
|
+
radius = 2,
|
|
1802
1592
|
tone = "default",
|
|
1803
1593
|
...restProps
|
|
1804
1594
|
} = props;
|
|
1805
1595
|
return /* @__PURE__ */ jsx(
|
|
1806
|
-
|
|
1596
|
+
Box,
|
|
1807
1597
|
{
|
|
1808
1598
|
"data-ui": "Badge",
|
|
1809
1599
|
...restProps,
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1600
|
+
className: composeClassNames(
|
|
1601
|
+
className,
|
|
1602
|
+
badge({
|
|
1603
|
+
radius,
|
|
1604
|
+
tone
|
|
1605
|
+
})
|
|
1606
|
+
),
|
|
1607
|
+
display,
|
|
1608
|
+
padding,
|
|
1813
1609
|
ref,
|
|
1814
1610
|
children: /* @__PURE__ */ jsx(Text, { size: fontSize2, children })
|
|
1815
1611
|
}
|
|
1816
1612
|
);
|
|
1817
1613
|
});
|
|
1818
1614
|
Badge.displayName = "ForwardRef(Badge)";
|
|
1819
|
-
const Root$
|
|
1615
|
+
const Root$c = styled(Box)(
|
|
1820
1616
|
flexItemStyle,
|
|
1821
1617
|
responsiveFlexStyle
|
|
1822
1618
|
), Flex = forwardRef(function(props, ref) {
|
|
1823
|
-
const {
|
|
1619
|
+
const { as, direction = "row", ...restProps } = props;
|
|
1824
1620
|
return /* @__PURE__ */ jsx(
|
|
1825
|
-
Root$
|
|
1621
|
+
Root$c,
|
|
1826
1622
|
{
|
|
1827
1623
|
"data-ui": "Flex",
|
|
1828
1624
|
...restProps,
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
$gap: useArrayProp(gap),
|
|
1832
|
-
$gapX: useArrayProp(gapX),
|
|
1833
|
-
$gapY: useArrayProp(gapY),
|
|
1834
|
-
$justify: useArrayProp(justify),
|
|
1835
|
-
$wrap: useArrayProp(wrap),
|
|
1625
|
+
direction,
|
|
1626
|
+
display: "flex",
|
|
1836
1627
|
forwardedAs: as,
|
|
1837
1628
|
ref
|
|
1838
1629
|
}
|
|
1839
1630
|
);
|
|
1840
1631
|
});
|
|
1841
1632
|
Flex.displayName = "ForwardRef(Flex)";
|
|
1842
|
-
const
|
|
1843
|
-
|
|
1844
|
-
transform: rotate(0deg);
|
|
1845
|
-
}
|
|
1846
|
-
|
|
1847
|
-
to {
|
|
1848
|
-
transform: rotate(360deg);
|
|
1849
|
-
}
|
|
1850
|
-
`, Root$u = styled(Text)`
|
|
1851
|
-
& > span > svg {
|
|
1852
|
-
animation: ${rotate$1} 500ms linear infinite;
|
|
1853
|
-
}
|
|
1854
|
-
`, Spinner = forwardRef(function(props, ref) {
|
|
1855
|
-
return /* @__PURE__ */ jsx(Root$u, { "data-ui": "Spinner", ...props, ref, children: /* @__PURE__ */ jsx(SpinnerIcon, {}) });
|
|
1633
|
+
const Spinner = forwardRef(function(props, ref) {
|
|
1634
|
+
return /* @__PURE__ */ jsx(Text, { "data-ui": "Spinner", ...props, className: spinner(), ref, children: /* @__PURE__ */ jsx(SpinnerIcon, {}) });
|
|
1856
1635
|
});
|
|
1857
1636
|
Spinner.displayName = "ForwardRef(Spinner)";
|
|
1858
|
-
|
|
1859
|
-
return {
|
|
1860
|
-
// from base
|
|
1861
|
-
"--card-backdrop-color": base.backdrop,
|
|
1862
|
-
"--card-focus-ring-color": base.focusRing,
|
|
1863
|
-
"--card-shadow-outline-color": base.shadow.outline,
|
|
1864
|
-
"--card-shadow-umbra-color": base.shadow.umbra,
|
|
1865
|
-
"--card-shadow-penumbra-color": base.shadow.penumbra,
|
|
1866
|
-
"--card-shadow-ambient-color": base.shadow.ambient,
|
|
1867
|
-
// from state
|
|
1868
|
-
"--card-accent-fg-color": color.accent.fg,
|
|
1869
|
-
"--card-avatar-gray-bg-color": color.avatar.gray.bg,
|
|
1870
|
-
"--card-avatar-gray-fg-color": color.avatar.gray.fg,
|
|
1871
|
-
"--card-avatar-blue-bg-color": color.avatar.blue.bg,
|
|
1872
|
-
"--card-avatar-blue-fg-color": color.avatar.blue.fg,
|
|
1873
|
-
"--card-avatar-purple-bg-color": color.avatar.purple.bg,
|
|
1874
|
-
"--card-avatar-purple-fg-color": color.avatar.purple.fg,
|
|
1875
|
-
"--card-avatar-magenta-bg-color": color.avatar.magenta.bg,
|
|
1876
|
-
"--card-avatar-magenta-fg-color": color.avatar.magenta.fg,
|
|
1877
|
-
"--card-avatar-red-bg-color": color.avatar.red.bg,
|
|
1878
|
-
"--card-avatar-red-fg-color": color.avatar.red.fg,
|
|
1879
|
-
"--card-avatar-orange-bg-color": color.avatar.orange.bg,
|
|
1880
|
-
"--card-avatar-orange-fg-color": color.avatar.orange.fg,
|
|
1881
|
-
"--card-avatar-yellow-bg-color": color.avatar.yellow.bg,
|
|
1882
|
-
"--card-avatar-yellow-fg-color": color.avatar.yellow.fg,
|
|
1883
|
-
"--card-avatar-green-bg-color": color.avatar.green.bg,
|
|
1884
|
-
"--card-avatar-green-fg-color": color.avatar.green.fg,
|
|
1885
|
-
"--card-avatar-cyan-bg-color": color.avatar.cyan.bg,
|
|
1886
|
-
"--card-avatar-cyan-fg-color": color.avatar.cyan.fg,
|
|
1887
|
-
"--card-bg-color": color.bg,
|
|
1888
|
-
"--card-bg-image": checkered ? `repeating-conic-gradient(${color.bg} 0% 25%, ${color.muted.bg} 0% 50%)` : void 0,
|
|
1889
|
-
"--card-border-color": color.border,
|
|
1890
|
-
"--card-badge-default-bg-color": color.badge.default.bg,
|
|
1891
|
-
"--card-badge-default-dot-color": color.badge.default.dot,
|
|
1892
|
-
"--card-badge-default-fg-color": color.badge.default.fg,
|
|
1893
|
-
"--card-badge-default-icon-color": color.badge.default.icon,
|
|
1894
|
-
"--card-badge-primary-bg-color": color.badge.primary.bg,
|
|
1895
|
-
"--card-badge-primary-dot-color": color.badge.primary.dot,
|
|
1896
|
-
"--card-badge-primary-fg-color": color.badge.primary.fg,
|
|
1897
|
-
"--card-badge-primary-icon-color": color.badge.primary.icon,
|
|
1898
|
-
"--card-badge-positive-bg-color": color.badge.positive.bg,
|
|
1899
|
-
"--card-badge-positive-dot-color": color.badge.positive.dot,
|
|
1900
|
-
"--card-badge-positive-fg-color": color.badge.positive.fg,
|
|
1901
|
-
"--card-badge-positive-icon-color": color.badge.positive.icon,
|
|
1902
|
-
"--card-badge-caution-bg-color": color.badge.caution.bg,
|
|
1903
|
-
"--card-badge-caution-dot-color": color.badge.caution.dot,
|
|
1904
|
-
"--card-badge-caution-fg-color": color.badge.caution.fg,
|
|
1905
|
-
"--card-badge-caution-icon-color": color.badge.caution.icon,
|
|
1906
|
-
"--card-badge-critical-bg-color": color.badge.critical.bg,
|
|
1907
|
-
"--card-badge-critical-dot-color": color.badge.critical.dot,
|
|
1908
|
-
"--card-badge-critical-fg-color": color.badge.critical.fg,
|
|
1909
|
-
"--card-badge-critical-icon-color": color.badge.critical.icon,
|
|
1910
|
-
"--card-badge-prospect-bg-color": color.badge.prospect.bg,
|
|
1911
|
-
"--card-badge-prospect-dot-color": color.badge.prospect.dot,
|
|
1912
|
-
"--card-badge-prospect-fg-color": color.badge.prospect.fg,
|
|
1913
|
-
"--card-badge-prospect-icon-color": color.badge.prospect.icon,
|
|
1914
|
-
"--card-badge-explore-bg-color": color.badge.explore.bg,
|
|
1915
|
-
"--card-badge-explore-dot-color": color.badge.explore.dot,
|
|
1916
|
-
"--card-badge-explore-fg-color": color.badge.explore.fg,
|
|
1917
|
-
"--card-badge-explore-icon-color": color.badge.explore.icon,
|
|
1918
|
-
"--card-code-bg-color": color.code.bg,
|
|
1919
|
-
"--card-code-fg-color": color.code.fg,
|
|
1920
|
-
"--card-fg-color": color.fg,
|
|
1921
|
-
"--card-icon-color": color.icon,
|
|
1922
|
-
"--card-kbd-bg-color": color.kbd.bg,
|
|
1923
|
-
"--card-kbd-border-color": color.kbd.border,
|
|
1924
|
-
"--card-kbd-fg-color": color.kbd.fg,
|
|
1925
|
-
"--card-link-fg-color": color.link.fg,
|
|
1926
|
-
"--card-muted-bg-color": color.muted.bg,
|
|
1927
|
-
"--card-muted-fg-color": color.muted.fg,
|
|
1928
|
-
"--card-skeleton-color-from": color.skeleton.from,
|
|
1929
|
-
"--card-skeleton-color-to": color.skeleton.to,
|
|
1930
|
-
// deprecated variables (kept for legacy)
|
|
1931
|
-
"--card-bg2-color": color.muted.bg,
|
|
1932
|
-
"--card-link-color": color.link.fg,
|
|
1933
|
-
"--card-hairline-soft-color": color.border,
|
|
1934
|
-
"--card-hairline-hard-color": color.border
|
|
1935
|
-
};
|
|
1936
|
-
}
|
|
1937
|
-
function buttonBaseStyles(props) {
|
|
1938
|
-
const { $width } = props, { style } = getTheme_v2(props.theme);
|
|
1939
|
-
return css`
|
|
1940
|
-
${style?.button};
|
|
1941
|
-
|
|
1942
|
-
-webkit-font-smoothing: inherit;
|
|
1943
|
-
appearance: none;
|
|
1944
|
-
display: inline-flex;
|
|
1945
|
-
align-items: center;
|
|
1946
|
-
font: inherit;
|
|
1947
|
-
border: 0;
|
|
1948
|
-
outline: none;
|
|
1949
|
-
user-select: none;
|
|
1950
|
-
text-decoration: none;
|
|
1951
|
-
border: 0;
|
|
1952
|
-
box-sizing: border-box;
|
|
1953
|
-
padding: 0;
|
|
1954
|
-
overflow: hidden;
|
|
1955
|
-
margin: 0;
|
|
1956
|
-
text-align: left;
|
|
1957
|
-
position: relative;
|
|
1958
|
-
vertical-align: top;
|
|
1959
|
-
|
|
1960
|
-
${$width === "fill" && css`
|
|
1961
|
-
width: -moz-available;
|
|
1962
|
-
width: -webkit-fill-available;
|
|
1963
|
-
width: stretch;
|
|
1964
|
-
`}
|
|
1965
|
-
|
|
1966
|
-
& > span {
|
|
1967
|
-
display: block;
|
|
1968
|
-
flex: 1;
|
|
1969
|
-
min-width: 0;
|
|
1970
|
-
border-radius: inherit;
|
|
1971
|
-
}
|
|
1972
|
-
|
|
1973
|
-
&::-moz-focus-inner {
|
|
1974
|
-
border: 0;
|
|
1975
|
-
padding: 0;
|
|
1976
|
-
}
|
|
1977
|
-
`;
|
|
1978
|
-
}
|
|
1979
|
-
function combineBoxShadow(...boxShadows) {
|
|
1980
|
-
return boxShadows.filter(Boolean).join(",");
|
|
1981
|
-
}
|
|
1982
|
-
function buttonColorStyles(props) {
|
|
1983
|
-
const { $mode } = props, { button, color: baseColor, style } = getTheme_v2(props.theme), shadow = props.$mode === "ghost", mode = baseColor.button[$mode] || baseColor.button.default, color = mode[props.$tone] || mode.default, border2 = {
|
|
1984
|
-
width: button.border.width,
|
|
1985
|
-
color: "var(--card-border-color)"
|
|
1986
|
-
}, defaultBoxShadow = void 0;
|
|
1987
|
-
return [
|
|
1988
|
-
_cardColorStyle(baseColor, color.enabled),
|
|
1989
|
-
{
|
|
1990
|
-
backgroundColor: "var(--card-bg-color)",
|
|
1991
|
-
color: "var(--card-fg-color)",
|
|
1992
|
-
boxShadow: focusRingBorderStyle(border2),
|
|
1993
|
-
'&:disabled, &[data-disabled="true"]': _cardColorStyle(baseColor, color.disabled),
|
|
1994
|
-
"&:not([data-disabled='true'])": {
|
|
1995
|
-
boxShadow: combineBoxShadow(
|
|
1996
|
-
focusRingBorderStyle(border2),
|
|
1997
|
-
shadow ? defaultBoxShadow : void 0
|
|
1998
|
-
),
|
|
1999
|
-
"&:focus": {
|
|
2000
|
-
boxShadow: focusRingStyle({
|
|
2001
|
-
base: baseColor,
|
|
2002
|
-
border: { width: 2, color: baseColor.bg },
|
|
2003
|
-
focusRing: button.focusRing
|
|
2004
|
-
})
|
|
2005
|
-
},
|
|
2006
|
-
"&:focus:not(:focus-visible)": {
|
|
2007
|
-
boxShadow: combineBoxShadow(
|
|
2008
|
-
focusRingBorderStyle(border2),
|
|
2009
|
-
shadow ? defaultBoxShadow : void 0
|
|
2010
|
-
)
|
|
2011
|
-
},
|
|
2012
|
-
"@media (hover: hover)": {
|
|
2013
|
-
"&:hover": _cardColorStyle(baseColor, color.hovered),
|
|
2014
|
-
"&:active": _cardColorStyle(baseColor, color.pressed),
|
|
2015
|
-
"&[data-hovered]": _cardColorStyle(baseColor, color.hovered)
|
|
2016
|
-
},
|
|
2017
|
-
"&[data-selected]": _cardColorStyle(baseColor, color.pressed)
|
|
2018
|
-
}
|
|
2019
|
-
},
|
|
2020
|
-
style?.button?.root
|
|
2021
|
-
].filter(Boolean);
|
|
2022
|
-
}
|
|
2023
|
-
const Root$t = styled.button(responsiveRadiusStyle, buttonBaseStyles, buttonColorStyles), LoadingBox = styled.div`
|
|
2024
|
-
position: absolute;
|
|
2025
|
-
top: 0;
|
|
2026
|
-
left: 0;
|
|
2027
|
-
right: 0;
|
|
2028
|
-
bottom: 0;
|
|
2029
|
-
display: flex;
|
|
2030
|
-
align-items: center;
|
|
2031
|
-
justify-content: center;
|
|
2032
|
-
background-color: var(--card-bg-color);
|
|
2033
|
-
border-radius: inherit;
|
|
2034
|
-
z-index: 1;
|
|
2035
|
-
box-shadow: inherit;
|
|
2036
|
-
`, Button = forwardRef(function(props, ref) {
|
|
1637
|
+
const Button = forwardRef(function(props, ref) {
|
|
2037
1638
|
const {
|
|
1639
|
+
as: As = "button",
|
|
2038
1640
|
children,
|
|
1641
|
+
className,
|
|
2039
1642
|
disabled,
|
|
2040
1643
|
fontSize: fontSize2 = 1,
|
|
2041
1644
|
icon: IconComponent,
|
|
@@ -2053,7 +1656,7 @@ const Root$t = styled.button(responsiveRadiusStyle, buttonBaseStyles, buttonColo
|
|
|
2053
1656
|
radius: radiusProp = 2,
|
|
2054
1657
|
selected,
|
|
2055
1658
|
space: spaceProp = 3,
|
|
2056
|
-
text,
|
|
1659
|
+
text: text2,
|
|
2057
1660
|
textAlign,
|
|
2058
1661
|
textOverflow = "ellipsis",
|
|
2059
1662
|
textWeight,
|
|
@@ -2062,7 +1665,7 @@ const Root$t = styled.button(responsiveRadiusStyle, buttonBaseStyles, buttonColo
|
|
|
2062
1665
|
muted = !1,
|
|
2063
1666
|
width,
|
|
2064
1667
|
...restProps
|
|
2065
|
-
} = props, { button } = useTheme_v2(), justify = useArrayProp(justifyProp), padding = useArrayProp(paddingProp), paddingX = useArrayProp(paddingXProp), paddingY = useArrayProp(paddingYProp), paddingTop = useArrayProp(paddingTopProp), paddingBottom = useArrayProp(paddingBottomProp), paddingLeft = useArrayProp(paddingLeftProp), paddingRight = useArrayProp(paddingRightProp),
|
|
1668
|
+
} = props, { button: buttonTheme } = useTheme_v2(), justify = useArrayProp(justifyProp), padding = useArrayProp(paddingProp), paddingX = useArrayProp(paddingXProp), paddingY = useArrayProp(paddingYProp), paddingTop = useArrayProp(paddingTopProp), paddingBottom = useArrayProp(paddingBottomProp), paddingLeft = useArrayProp(paddingLeftProp), paddingRight = useArrayProp(paddingRightProp), space = useArrayProp(spaceProp), boxProps = useMemo(
|
|
2066
1669
|
() => ({
|
|
2067
1670
|
// flex: 1,
|
|
2068
1671
|
padding,
|
|
@@ -2076,27 +1679,32 @@ const Root$t = styled.button(responsiveRadiusStyle, buttonBaseStyles, buttonColo
|
|
|
2076
1679
|
[padding, paddingX, paddingY, paddingTop, paddingBottom, paddingLeft, paddingRight]
|
|
2077
1680
|
);
|
|
2078
1681
|
return /* @__PURE__ */ jsxs(
|
|
2079
|
-
|
|
1682
|
+
As,
|
|
2080
1683
|
{
|
|
2081
1684
|
"data-ui": "Button",
|
|
2082
1685
|
...restProps,
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
1686
|
+
className: composeClassNames(
|
|
1687
|
+
className,
|
|
1688
|
+
button({
|
|
1689
|
+
mode,
|
|
1690
|
+
radius: radiusProp,
|
|
1691
|
+
tone,
|
|
1692
|
+
width
|
|
1693
|
+
})
|
|
1694
|
+
),
|
|
2086
1695
|
"data-disabled": !!(loading || disabled),
|
|
2087
1696
|
"data-selected": selected ? "" : void 0,
|
|
2088
1697
|
disabled: !!(loading || disabled),
|
|
2089
1698
|
ref,
|
|
2090
1699
|
type,
|
|
2091
|
-
$width: width,
|
|
2092
1700
|
children: [
|
|
2093
|
-
!!loading && /* @__PURE__ */ jsx(
|
|
2094
|
-
(IconComponent ||
|
|
1701
|
+
!!loading && /* @__PURE__ */ jsx(Box, { align: "center", className: buttonLoadingBox(), display: "flex", justify: "center", children: /* @__PURE__ */ jsx(Spinner, { size: fontSize2 }) }),
|
|
1702
|
+
(IconComponent || text2 || IconRightComponent) && /* @__PURE__ */ jsx(Box, { as: "span", ...boxProps, children: /* @__PURE__ */ jsxs(Flex, { as: "span", justify, gap: space, children: [
|
|
2095
1703
|
IconComponent && /* @__PURE__ */ jsxs(Text, { as: "span", size: fontSize2, style: { flex: "none" }, children: [
|
|
2096
1704
|
isValidElement(IconComponent) && IconComponent,
|
|
2097
1705
|
isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})
|
|
2098
1706
|
] }),
|
|
2099
|
-
|
|
1707
|
+
text2 && /* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
2100
1708
|
Text,
|
|
2101
1709
|
{
|
|
2102
1710
|
as: "span",
|
|
@@ -2104,8 +1712,8 @@ const Root$t = styled.button(responsiveRadiusStyle, buttonBaseStyles, buttonColo
|
|
|
2104
1712
|
align: textAlign,
|
|
2105
1713
|
size: fontSize2,
|
|
2106
1714
|
textOverflow,
|
|
2107
|
-
weight: textWeight ??
|
|
2108
|
-
children:
|
|
1715
|
+
weight: textWeight ?? buttonTheme.textWeight,
|
|
1716
|
+
children: text2
|
|
2109
1717
|
}
|
|
2110
1718
|
) }),
|
|
2111
1719
|
IconRightComponent && /* @__PURE__ */ jsxs(Text, { as: "span", size: fontSize2, style: { flex: "none" }, children: [
|
|
@@ -2119,299 +1727,60 @@ const Root$t = styled.button(responsiveRadiusStyle, buttonBaseStyles, buttonColo
|
|
|
2119
1727
|
);
|
|
2120
1728
|
});
|
|
2121
1729
|
Button.displayName = "ForwardRef(Button)";
|
|
2122
|
-
|
|
2123
|
-
return [cardBaseStyle(props), cardColorStyle(props)];
|
|
2124
|
-
}
|
|
2125
|
-
function cardBaseStyle(props) {
|
|
2126
|
-
const { $checkered } = props, { space } = getTheme_v2(props.theme);
|
|
2127
|
-
return css`
|
|
2128
|
-
${$checkered && css`
|
|
2129
|
-
background-size: ${space[3]}px ${space[3]}px;
|
|
2130
|
-
background-position: 50% 50%;
|
|
2131
|
-
background-image: var(--card-bg-image);
|
|
2132
|
-
`}
|
|
2133
|
-
|
|
2134
|
-
&[data-as='button'] {
|
|
2135
|
-
-webkit-font-smoothing: inherit;
|
|
2136
|
-
appearance: none;
|
|
2137
|
-
outline: none;
|
|
2138
|
-
font: inherit;
|
|
2139
|
-
text-align: inherit;
|
|
2140
|
-
border: 0;
|
|
2141
|
-
width: -moz-available;
|
|
2142
|
-
width: -webkit-fill-available;
|
|
2143
|
-
width: stretch;
|
|
2144
|
-
}
|
|
2145
|
-
|
|
2146
|
-
/* &:is(a) */
|
|
2147
|
-
&[data-as='a'] {
|
|
2148
|
-
outline: none;
|
|
2149
|
-
text-decoration: none;
|
|
2150
|
-
}
|
|
2151
|
-
|
|
2152
|
-
/* &:is(pre) */
|
|
2153
|
-
&[data-as='pre'] {
|
|
2154
|
-
font: inherit;
|
|
2155
|
-
}
|
|
2156
|
-
`;
|
|
2157
|
-
}
|
|
2158
|
-
function cardColorStyle(props) {
|
|
2159
|
-
const { $checkered, $focusRing, $muted } = props, { card, color, style } = getTheme_v2(props.theme), border2 = { width: card.border.width, color: "var(--card-border-color)" };
|
|
2160
|
-
return css`
|
|
2161
|
-
color-scheme: ${color._dark ? "dark" : "light"};
|
|
2162
|
-
|
|
2163
|
-
${_cardColorStyle(color, color, $checkered)}
|
|
2164
|
-
|
|
2165
|
-
background-color: ${$muted ? "var(--card-muted-bg-color)" : "var(--card-bg-color)"};
|
|
2166
|
-
color: var(--card-fg-color);
|
|
2167
|
-
|
|
2168
|
-
/* &:is(button) */
|
|
2169
|
-
&[data-as='button'] {
|
|
2170
|
-
--card-focus-ring-box-shadow: none;
|
|
2171
|
-
|
|
2172
|
-
cursor: default;
|
|
2173
|
-
box-shadow: var(--card-focus-ring-box-shadow);
|
|
2174
|
-
|
|
2175
|
-
&:disabled {
|
|
2176
|
-
${_cardColorStyle(color, color.selectable.default.disabled, $checkered)}
|
|
2177
|
-
}
|
|
2178
|
-
|
|
2179
|
-
&:not(:disabled) {
|
|
2180
|
-
&[data-pressed] {
|
|
2181
|
-
${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
|
|
2182
|
-
}
|
|
2183
|
-
|
|
2184
|
-
&[data-selected] {
|
|
2185
|
-
${_cardColorStyle(color, color.selectable.default.selected, $checkered)}
|
|
2186
|
-
}
|
|
2187
|
-
|
|
2188
|
-
@media (hover: hover) {
|
|
2189
|
-
&:not([data-pressed]):not([data-selected]) {
|
|
2190
|
-
&[data-hovered],
|
|
2191
|
-
&:hover {
|
|
2192
|
-
${_cardColorStyle(color, color.selectable.default.hovered, $checkered)}
|
|
2193
|
-
}
|
|
2194
|
-
|
|
2195
|
-
&:active {
|
|
2196
|
-
${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
|
|
2197
|
-
}
|
|
2198
|
-
}
|
|
2199
|
-
}
|
|
2200
|
-
|
|
2201
|
-
&:focus-visible {
|
|
2202
|
-
--card-focus-ring-box-shadow: ${$focusRing ? focusRingStyle({ base: color, border: border2, focusRing: card.focusRing }) : void 0};
|
|
2203
|
-
}
|
|
2204
|
-
}
|
|
2205
|
-
}
|
|
2206
|
-
|
|
2207
|
-
/* &:is(a) */
|
|
2208
|
-
&[data-as='a'] {
|
|
2209
|
-
cursor: pointer;
|
|
2210
|
-
box-shadow: var(--card-focus-ring-box-shadow);
|
|
2211
|
-
|
|
2212
|
-
&[data-disabled] {
|
|
2213
|
-
${_cardColorStyle(color, color.selectable.default.disabled, $checkered)}
|
|
2214
|
-
}
|
|
2215
|
-
|
|
2216
|
-
&:not([data-disabled]) {
|
|
2217
|
-
&[data-pressed] {
|
|
2218
|
-
${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
|
|
2219
|
-
}
|
|
2220
|
-
|
|
2221
|
-
&[data-selected] {
|
|
2222
|
-
${_cardColorStyle(color, color.selectable.default.selected, $checkered)}
|
|
2223
|
-
}
|
|
2224
|
-
|
|
2225
|
-
@media (hover: hover) {
|
|
2226
|
-
&:not([data-pressed]):not([data-selected]) {
|
|
2227
|
-
&[data-hovered],
|
|
2228
|
-
&:hover {
|
|
2229
|
-
${_cardColorStyle(color, color.selectable.default.hovered, $checkered)}
|
|
2230
|
-
}
|
|
2231
|
-
|
|
2232
|
-
&:active {
|
|
2233
|
-
${_cardColorStyle(color, color.selectable.default.pressed, $checkered)}
|
|
2234
|
-
}
|
|
2235
|
-
}
|
|
2236
|
-
}
|
|
2237
|
-
|
|
2238
|
-
&:focus-visible {
|
|
2239
|
-
--card-focus-ring-box-shadow: ${$focusRing ? focusRingStyle({ base: color, border: border2, focusRing: card.focusRing }) : void 0};
|
|
2240
|
-
}
|
|
2241
|
-
}
|
|
2242
|
-
}
|
|
2243
|
-
|
|
2244
|
-
${style?.card?.root}
|
|
2245
|
-
`;
|
|
2246
|
-
}
|
|
2247
|
-
const Root$s = styled(Box)(responsiveBorderStyle, responsiveRadiusStyle, responsiveShadowStyle, cardStyle), Card = forwardRef(function(props, ref) {
|
|
1730
|
+
const RootCardContext = createContext(null), Card = forwardRef(function(props, ref) {
|
|
2248
1731
|
const {
|
|
2249
|
-
__unstable_checkered: checkered =
|
|
2250
|
-
__unstable_focusRing: focusRing =
|
|
1732
|
+
// __unstable_checkered: checkered = false,
|
|
1733
|
+
// __unstable_focusRing: focusRing = false,
|
|
2251
1734
|
as: asProp,
|
|
2252
|
-
border
|
|
2253
|
-
borderTop
|
|
2254
|
-
borderRight
|
|
2255
|
-
borderBottom
|
|
2256
|
-
borderLeft
|
|
2257
|
-
|
|
1735
|
+
border,
|
|
1736
|
+
borderTop,
|
|
1737
|
+
borderRight,
|
|
1738
|
+
borderBottom,
|
|
1739
|
+
borderLeft,
|
|
1740
|
+
className,
|
|
1741
|
+
// muted,
|
|
2258
1742
|
pressed,
|
|
2259
1743
|
radius = 0,
|
|
2260
1744
|
scheme,
|
|
2261
1745
|
selected,
|
|
2262
1746
|
shadow,
|
|
1747
|
+
style,
|
|
2263
1748
|
tone: toneProp = "default",
|
|
2264
1749
|
...restProps
|
|
2265
|
-
} = props, as = isValidElementType(asProp) ? asProp : "div", rootTheme = useRootTheme(), tone = toneProp === "inherit" ? rootTheme.tone : toneProp
|
|
2266
|
-
|
|
2267
|
-
Root$s,
|
|
1750
|
+
} = props, as = isValidElementType(asProp) ? asProp : "div", rootCard = useContext(RootCardContext), rootTheme = useRootTheme(), tone = toneProp === "inherit" ? rootTheme.tone : toneProp, node = /* @__PURE__ */ jsx(ThemeColorProvider, { scheme, tone, children: /* @__PURE__ */ jsx(
|
|
1751
|
+
Box,
|
|
2268
1752
|
{
|
|
2269
1753
|
"data-as": typeof as == "string" ? as : void 0,
|
|
2270
1754
|
"data-scheme": rootTheme.scheme,
|
|
2271
1755
|
"data-ui": "Card",
|
|
2272
1756
|
"data-tone": tone,
|
|
2273
1757
|
...restProps,
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
1758
|
+
as,
|
|
1759
|
+
className: composeClassNames(
|
|
1760
|
+
className,
|
|
1761
|
+
rootCard ? void 0 : "root",
|
|
1762
|
+
card({
|
|
1763
|
+
border,
|
|
1764
|
+
borderTop,
|
|
1765
|
+
borderRight,
|
|
1766
|
+
borderBottom,
|
|
1767
|
+
borderLeft,
|
|
1768
|
+
radius,
|
|
1769
|
+
shadow
|
|
1770
|
+
})
|
|
1771
|
+
),
|
|
2286
1772
|
"data-pressed": pressed ? "" : void 0,
|
|
1773
|
+
"data-test": rootCard ? void 0 : "",
|
|
2287
1774
|
"data-selected": selected ? "" : void 0,
|
|
2288
|
-
forwardedAs: as,
|
|
2289
1775
|
ref,
|
|
2290
|
-
selected
|
|
1776
|
+
selected,
|
|
1777
|
+
style
|
|
2291
1778
|
}
|
|
2292
1779
|
) });
|
|
1780
|
+
return rootCard ? node : /* @__PURE__ */ jsx(RootCardContext.Provider, { value: { renderedVars: !0 }, children: node });
|
|
2293
1781
|
});
|
|
2294
1782
|
Card.displayName = "ForwardRef(Card)";
|
|
2295
|
-
function
|
|
2296
|
-
return css`
|
|
2297
|
-
position: relative;
|
|
2298
|
-
display: inline-block;
|
|
2299
|
-
`;
|
|
2300
|
-
}
|
|
2301
|
-
function inputElementStyles(props) {
|
|
2302
|
-
const { color, input, radius } = getTheme_v2(props.theme), { focusRing } = input.checkbox;
|
|
2303
|
-
return css`
|
|
2304
|
-
position: absolute;
|
|
2305
|
-
top: 0;
|
|
2306
|
-
left: 0;
|
|
2307
|
-
width: 100%;
|
|
2308
|
-
height: 100%;
|
|
2309
|
-
outline: none;
|
|
2310
|
-
opacity: 0;
|
|
2311
|
-
z-index: 1;
|
|
2312
|
-
padding: 0;
|
|
2313
|
-
margin: 0;
|
|
2314
|
-
|
|
2315
|
-
& + span {
|
|
2316
|
-
position: relative;
|
|
2317
|
-
display: block;
|
|
2318
|
-
height: ${rem(input.checkbox.size)};
|
|
2319
|
-
width: ${rem(input.checkbox.size)};
|
|
2320
|
-
box-sizing: border-box;
|
|
2321
|
-
box-shadow: ${focusRingBorderStyle({
|
|
2322
|
-
color: color.input.default.enabled.border,
|
|
2323
|
-
width: input.border.width
|
|
2324
|
-
})};
|
|
2325
|
-
border-radius: ${rem(radius[2])};
|
|
2326
|
-
line-height: 1;
|
|
2327
|
-
background-color: ${color.input.default.enabled.bg};
|
|
2328
|
-
|
|
2329
|
-
& > svg {
|
|
2330
|
-
display: block;
|
|
2331
|
-
position: absolute;
|
|
2332
|
-
opacity: 0;
|
|
2333
|
-
height: 100%;
|
|
2334
|
-
width: 100%;
|
|
2335
|
-
|
|
2336
|
-
& > path {
|
|
2337
|
-
vector-effect: non-scaling-stroke;
|
|
2338
|
-
stroke-width: 1.5px !important;
|
|
2339
|
-
}
|
|
2340
|
-
}
|
|
2341
|
-
}
|
|
2342
|
-
|
|
2343
|
-
&:checked + span {
|
|
2344
|
-
background: ${color.input.default.enabled.fg};
|
|
2345
|
-
box-shadow: ${focusRingBorderStyle({
|
|
2346
|
-
color: color.input.default.enabled.fg,
|
|
2347
|
-
width: input.border.width
|
|
2348
|
-
})};
|
|
2349
|
-
color: ${color.input.default.enabled.bg};
|
|
2350
|
-
}
|
|
2351
|
-
|
|
2352
|
-
/* focus */
|
|
2353
|
-
&:not(:disabled):focus:focus-visible + span {
|
|
2354
|
-
box-shadow: ${focusRingStyle({ focusRing })};
|
|
2355
|
-
}
|
|
2356
|
-
|
|
2357
|
-
/* focus when checked - uses a different offset */
|
|
2358
|
-
&:not(:disabled):focus:focus-visible&:checked + span {
|
|
2359
|
-
box-shadow: ${focusRingStyle({ focusRing: { width: 1, offset: 1 } })};
|
|
2360
|
-
}
|
|
2361
|
-
|
|
2362
|
-
&[data-error] + span {
|
|
2363
|
-
background-color: ${color.input.invalid.enabled.border};
|
|
2364
|
-
box-shadow: ${focusRingBorderStyle({
|
|
2365
|
-
width: input.border.width,
|
|
2366
|
-
color: color.input.invalid.enabled.muted.bg
|
|
2367
|
-
})};
|
|
2368
|
-
color: ${color.input.default.disabled.fg};
|
|
2369
|
-
}
|
|
2370
|
-
&[data-error]&:checked + span {
|
|
2371
|
-
background-color: ${color.input.invalid.enabled.muted.bg};
|
|
2372
|
-
color: ${color.input.default.enabled.bg};
|
|
2373
|
-
}
|
|
2374
|
-
&[data-error]&:checked&:not(:disabled):focus:focus-visible + span {
|
|
2375
|
-
box-shadow: ${focusRingStyle({
|
|
2376
|
-
border: { width: input.border.width, color: color.input.invalid.readOnly.muted.bg },
|
|
2377
|
-
focusRing: { width: 1, offset: 1 }
|
|
2378
|
-
})};
|
|
2379
|
-
}
|
|
2380
|
-
|
|
2381
|
-
&:disabled + span {
|
|
2382
|
-
background-color: ${color.input.default.disabled.bg};
|
|
2383
|
-
box-shadow: ${focusRingBorderStyle({
|
|
2384
|
-
width: input.border.width,
|
|
2385
|
-
color: color.input.default.disabled.border
|
|
2386
|
-
})};
|
|
2387
|
-
color: ${color.input.default.disabled.fg};
|
|
2388
|
-
}
|
|
2389
|
-
&:disabled&:checked + span {
|
|
2390
|
-
background-color: ${color.input.default.disabled.muted.bg};
|
|
2391
|
-
}
|
|
2392
|
-
|
|
2393
|
-
&[data-read-only] + span {
|
|
2394
|
-
background-color: ${color.input.default.readOnly.bg};
|
|
2395
|
-
box-shadow: ${focusRingBorderStyle({
|
|
2396
|
-
width: input.border.width,
|
|
2397
|
-
color: color.input.default.readOnly.border
|
|
2398
|
-
})};
|
|
2399
|
-
color: ${color.input.default.readOnly.fg};
|
|
2400
|
-
}
|
|
2401
|
-
|
|
2402
|
-
&[data-read-only]&:checked + span {
|
|
2403
|
-
background-color: ${color.input.default.readOnly.muted.bg};
|
|
2404
|
-
}
|
|
2405
|
-
|
|
2406
|
-
&:checked + span > svg:first-child {
|
|
2407
|
-
opacity: 1;
|
|
2408
|
-
}
|
|
2409
|
-
&:indeterminate + span > svg:last-child {
|
|
2410
|
-
opacity: 1;
|
|
2411
|
-
}
|
|
2412
|
-
`;
|
|
2413
|
-
}
|
|
2414
|
-
const Root$r = styled.div(checkboxBaseStyles), Input$5 = styled.input(inputElementStyles), Checkbox = forwardRef(function(props, forwardedRef) {
|
|
1783
|
+
const Checkbox = forwardRef(function(props, forwardedRef) {
|
|
2415
1784
|
const {
|
|
2416
1785
|
checked,
|
|
2417
1786
|
className,
|
|
@@ -2427,14 +1796,15 @@ const Root$r = styled.div(checkboxBaseStyles), Input$5 = styled.input(inputEleme
|
|
|
2427
1796
|
() => ref.current
|
|
2428
1797
|
), useEffect(() => {
|
|
2429
1798
|
ref.current && (ref.current.indeterminate = indeterminate || !1);
|
|
2430
|
-
}, [indeterminate]), useCustomValidity(ref, customValidity), /* @__PURE__ */ jsxs(
|
|
1799
|
+
}, [indeterminate]), useCustomValidity(ref, customValidity), /* @__PURE__ */ jsxs("span", { className: composeClassNames(className, checkbox()), "data-ui": "Checkbox", style, children: [
|
|
2431
1800
|
/* @__PURE__ */ jsx(
|
|
2432
|
-
|
|
1801
|
+
"input",
|
|
2433
1802
|
{
|
|
2434
1803
|
"data-read-only": !disabled && readOnly ? "" : void 0,
|
|
2435
1804
|
"data-error": customValidity ? "" : void 0,
|
|
2436
1805
|
...restProps,
|
|
2437
1806
|
checked,
|
|
1807
|
+
className: composeClassNames(className, checkboxInput()),
|
|
2438
1808
|
disabled: disabled || readOnly,
|
|
2439
1809
|
type: "checkbox",
|
|
2440
1810
|
readOnly,
|
|
@@ -2448,120 +1818,49 @@ const Root$r = styled.div(checkboxBaseStyles), Input$5 = styled.input(inputEleme
|
|
|
2448
1818
|
] });
|
|
2449
1819
|
});
|
|
2450
1820
|
Checkbox.displayName = "ForwardRef(Checkbox)";
|
|
2451
|
-
|
|
1821
|
+
const Code = forwardRef(function(props, ref) {
|
|
2452
1822
|
const {
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
"&.hexcode": { color: color.hexcode },
|
|
2473
|
-
"&.id": { color: color.id },
|
|
2474
|
-
"&.important": { color: color.important },
|
|
2475
|
-
"&.inserted": { color: color.inserted },
|
|
2476
|
-
"&.keyword": { color: color.keyword },
|
|
2477
|
-
"&.number": { color: color.number },
|
|
2478
|
-
"&.operator": { color: color.operator },
|
|
2479
|
-
"&.prolog": { color: color.prolog },
|
|
2480
|
-
"&.property": { color: color.property },
|
|
2481
|
-
"&.pseudo-class": { color: color.pseudoClass },
|
|
2482
|
-
"&.pseudo-element": { color: color.pseudoElement },
|
|
2483
|
-
"&.punctuation": { color: color.punctuation },
|
|
2484
|
-
"&.regex": { color: color.regex },
|
|
2485
|
-
"&.selector": { color: color.selector },
|
|
2486
|
-
"&.string": { color: color.string },
|
|
2487
|
-
"&.symbol": { color: color.symbol },
|
|
2488
|
-
"&.tag": { color: color.tag },
|
|
2489
|
-
"&.unit": { color: color.unit },
|
|
2490
|
-
"&.url": { color: color.url },
|
|
2491
|
-
"&.variable": { color: color.variable }
|
|
2492
|
-
};
|
|
2493
|
-
}
|
|
2494
|
-
function codeBaseStyle() {
|
|
2495
|
-
return css`
|
|
2496
|
-
color: var(--card-code-fg-color);
|
|
2497
|
-
|
|
2498
|
-
& code {
|
|
2499
|
-
font-family: inherit;
|
|
2500
|
-
|
|
2501
|
-
&.refractor .token {
|
|
2502
|
-
${codeSyntaxHighlightingStyle}
|
|
2503
|
-
}
|
|
2504
|
-
}
|
|
2505
|
-
|
|
2506
|
-
& a {
|
|
2507
|
-
color: inherit;
|
|
2508
|
-
text-decoration: underline;
|
|
2509
|
-
border-radius: 1px;
|
|
2510
|
-
}
|
|
2511
|
-
|
|
2512
|
-
& svg {
|
|
2513
|
-
/* Certain popular CSS libraries changes the defaults for SVG display */
|
|
2514
|
-
/* Make sure SVGs are rendered as inline elements */
|
|
2515
|
-
display: inline;
|
|
2516
|
-
}
|
|
2517
|
-
|
|
2518
|
-
& [data-sanity-icon] {
|
|
2519
|
-
vertical-align: baseline;
|
|
1823
|
+
as: As = "pre",
|
|
1824
|
+
children,
|
|
1825
|
+
className,
|
|
1826
|
+
language: languageProp,
|
|
1827
|
+
size: size2 = 2,
|
|
1828
|
+
weight,
|
|
1829
|
+
...restProps
|
|
1830
|
+
} = props, language = typeof languageProp == "string" ? languageProp : void 0, registered = language ? Refractor.hasLanguage(language) : !1;
|
|
1831
|
+
return /* @__PURE__ */ jsxs(
|
|
1832
|
+
As,
|
|
1833
|
+
{
|
|
1834
|
+
"data-ui": "Code",
|
|
1835
|
+
...restProps,
|
|
1836
|
+
className: composeClassNames(className, code({ size: size2, weight })),
|
|
1837
|
+
ref,
|
|
1838
|
+
children: [
|
|
1839
|
+
!(language && registered) && /* @__PURE__ */ jsx("code", { children }),
|
|
1840
|
+
language && registered && /* @__PURE__ */ jsx(Refractor, { inline: !0, language, value: String(children) })
|
|
1841
|
+
]
|
|
2520
1842
|
}
|
|
2521
|
-
|
|
2522
|
-
}
|
|
2523
|
-
const Root$q = styled.pre(codeBaseStyle, responsiveCodeFontStyle), Code = forwardRef(function(props, ref) {
|
|
2524
|
-
const { children, language: languageProp, size: size2 = 2, weight, ...restProps } = props, language = typeof languageProp == "string" ? languageProp : void 0, registered = language ? Refractor.hasLanguage(language) : !1;
|
|
2525
|
-
return /* @__PURE__ */ jsxs(Root$q, { "data-ui": "Code", ...restProps, $size: useArrayProp(size2), $weight: weight, ref, children: [
|
|
2526
|
-
!(language && registered) && /* @__PURE__ */ jsx("code", { children }),
|
|
2527
|
-
language && registered && /* @__PURE__ */ jsx(Refractor, { inline: !0, language, value: String(children) })
|
|
2528
|
-
] });
|
|
1843
|
+
);
|
|
2529
1844
|
});
|
|
2530
1845
|
Code.displayName = "ForwardRef(Code)";
|
|
2531
|
-
const
|
|
2532
|
-
width
|
|
2533
|
-
margin: "0 auto"
|
|
2534
|
-
};
|
|
2535
|
-
function containerBaseStyle() {
|
|
2536
|
-
return BASE_STYLE$1;
|
|
2537
|
-
}
|
|
2538
|
-
function responsiveContainerWidthStyle(props) {
|
|
2539
|
-
const { container, media } = getTheme_v2(props.theme);
|
|
2540
|
-
return _responsive(media, props.$width, (val) => ({
|
|
2541
|
-
maxWidth: val === "auto" ? "none" : rem(container[val])
|
|
2542
|
-
}));
|
|
2543
|
-
}
|
|
2544
|
-
const Root$p = styled(Box)(
|
|
2545
|
-
containerBaseStyle,
|
|
2546
|
-
responsiveContainerWidthStyle
|
|
2547
|
-
), Container = forwardRef(function(props, ref) {
|
|
2548
|
-
const { as, width = 2, ...restProps } = props;
|
|
1846
|
+
const Container = forwardRef(function(props, ref) {
|
|
1847
|
+
const { as, className, width = 2, ...restProps } = props;
|
|
2549
1848
|
return /* @__PURE__ */ jsx(
|
|
2550
|
-
|
|
1849
|
+
Box,
|
|
2551
1850
|
{
|
|
2552
1851
|
"data-ui": "Container",
|
|
2553
1852
|
...restProps,
|
|
2554
|
-
|
|
2555
|
-
|
|
1853
|
+
as,
|
|
1854
|
+
className: composeClassNames(className, container({ width })),
|
|
2556
1855
|
ref
|
|
2557
1856
|
}
|
|
2558
1857
|
);
|
|
2559
1858
|
});
|
|
2560
1859
|
Container.displayName = "ForwardRef(Container)";
|
|
2561
|
-
const Root$
|
|
1860
|
+
const Root$b = styled(Box)(responsiveGridStyle), Grid = forwardRef(function(props, ref) {
|
|
2562
1861
|
const { as, autoRows, autoCols, autoFlow, columns, gap, gapX, gapY, rows, children, ...restProps } = props;
|
|
2563
1862
|
return /* @__PURE__ */ jsx(
|
|
2564
|
-
Root$
|
|
1863
|
+
Root$b,
|
|
2565
1864
|
{
|
|
2566
1865
|
"data-as": typeof as == "string" ? as : void 0,
|
|
2567
1866
|
"data-ui": "Grid",
|
|
@@ -2574,6 +1873,7 @@ const Root$o = styled(Box)(responsiveGridStyle), Grid = forwardRef(function(prop
|
|
|
2574
1873
|
$gapX: useArrayProp(gapX),
|
|
2575
1874
|
$gapY: useArrayProp(gapY),
|
|
2576
1875
|
$rows: useArrayProp(rows),
|
|
1876
|
+
display: "grid",
|
|
2577
1877
|
forwardedAs: as,
|
|
2578
1878
|
ref,
|
|
2579
1879
|
children
|
|
@@ -2581,61 +1881,7 @@ const Root$o = styled(Box)(responsiveGridStyle), Grid = forwardRef(function(prop
|
|
|
2581
1881
|
);
|
|
2582
1882
|
});
|
|
2583
1883
|
Grid.displayName = "ForwardRef(Grid)";
|
|
2584
|
-
|
|
2585
|
-
const { $accent, $muted } = props, { font } = getTheme_v2(props.theme);
|
|
2586
|
-
return css`
|
|
2587
|
-
${$accent && css`
|
|
2588
|
-
color: var(--card-accent-fg-color);
|
|
2589
|
-
`}
|
|
2590
|
-
|
|
2591
|
-
${$muted && css`
|
|
2592
|
-
color: var(--card-muted-fg-color);
|
|
2593
|
-
`}
|
|
2594
|
-
|
|
2595
|
-
& code {
|
|
2596
|
-
font-family: ${font.code.family};
|
|
2597
|
-
border-radius: 1px;
|
|
2598
|
-
}
|
|
2599
|
-
|
|
2600
|
-
& a {
|
|
2601
|
-
text-decoration: none;
|
|
2602
|
-
border-radius: 1px;
|
|
2603
|
-
color: var(--card-link-color);
|
|
2604
|
-
outline: none;
|
|
2605
|
-
|
|
2606
|
-
@media (hover: hover) {
|
|
2607
|
-
&:hover {
|
|
2608
|
-
text-decoration: underline;
|
|
2609
|
-
}
|
|
2610
|
-
}
|
|
2611
|
-
|
|
2612
|
-
&:focus {
|
|
2613
|
-
box-shadow:
|
|
2614
|
-
0 0 0 1px var(--card-bg-color),
|
|
2615
|
-
0 0 0 3px var(--card-focus-ring-color);
|
|
2616
|
-
}
|
|
2617
|
-
|
|
2618
|
-
&:focus:not(:focus-visible) {
|
|
2619
|
-
box-shadow: none;
|
|
2620
|
-
}
|
|
2621
|
-
}
|
|
2622
|
-
|
|
2623
|
-
& strong {
|
|
2624
|
-
font-weight: ${font.heading.weights.bold};
|
|
2625
|
-
}
|
|
2626
|
-
|
|
2627
|
-
& svg {
|
|
2628
|
-
/* Certain popular CSS libraries changes the defaults for SVG display */
|
|
2629
|
-
/* Make sure SVGs are rendered as inline elements */
|
|
2630
|
-
display: inline;
|
|
2631
|
-
}
|
|
2632
|
-
|
|
2633
|
-
& [data-sanity-icon] {
|
|
2634
|
-
vertical-align: baseline;
|
|
2635
|
-
}
|
|
2636
|
-
`;
|
|
2637
|
-
}
|
|
2638
|
-
const Root$n = styled.div(headingBaseStyle, responsiveTextAlignStyle, responsiveHeadingFont), SpanWithTextOverflow = styled.span`
|
|
1884
|
+
const SpanWithTextOverflow = styled.span`
|
|
2639
1885
|
display: block;
|
|
2640
1886
|
white-space: nowrap;
|
|
2641
1887
|
text-overflow: ellipsis;
|
|
@@ -2645,7 +1891,9 @@ const Root$n = styled.div(headingBaseStyle, responsiveTextAlignStyle, responsive
|
|
|
2645
1891
|
const {
|
|
2646
1892
|
accent = !1,
|
|
2647
1893
|
align,
|
|
1894
|
+
as: As = "div",
|
|
2648
1895
|
children: childrenProp,
|
|
1896
|
+
className,
|
|
2649
1897
|
muted = !1,
|
|
2650
1898
|
size: size2 = 2,
|
|
2651
1899
|
textOverflow,
|
|
@@ -2654,81 +1902,71 @@ const Root$n = styled.div(headingBaseStyle, responsiveTextAlignStyle, responsive
|
|
|
2654
1902
|
} = props;
|
|
2655
1903
|
let children = childrenProp;
|
|
2656
1904
|
return textOverflow === "ellipsis" && (children = /* @__PURE__ */ jsx(SpanWithTextOverflow, { children })), /* @__PURE__ */ jsx(
|
|
2657
|
-
|
|
1905
|
+
As,
|
|
2658
1906
|
{
|
|
2659
1907
|
"data-ui": "Heading",
|
|
2660
1908
|
...restProps,
|
|
2661
|
-
$accent: accent,
|
|
2662
1909
|
$align: useArrayProp(align),
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
1910
|
+
className: composeClassNames(
|
|
1911
|
+
className,
|
|
1912
|
+
heading({
|
|
1913
|
+
accent,
|
|
1914
|
+
muted,
|
|
1915
|
+
size: size2,
|
|
1916
|
+
weight
|
|
1917
|
+
})
|
|
1918
|
+
),
|
|
2666
1919
|
ref,
|
|
2667
1920
|
children: /* @__PURE__ */ jsx("span", { children })
|
|
2668
1921
|
}
|
|
2669
1922
|
);
|
|
2670
1923
|
});
|
|
2671
1924
|
Heading.displayName = "ForwardRef(Heading)";
|
|
2672
|
-
function
|
|
2673
|
-
return {
|
|
2674
|
-
lineHeight: 0,
|
|
2675
|
-
"&&:not([hidden])": {
|
|
2676
|
-
display: "block"
|
|
2677
|
-
},
|
|
2678
|
-
"& > div": {
|
|
2679
|
-
display: "inline-block",
|
|
2680
|
-
verticalAlign: "middle"
|
|
2681
|
-
}
|
|
2682
|
-
};
|
|
2683
|
-
}
|
|
2684
|
-
function inlineSpaceStyle(props) {
|
|
2685
|
-
const { media, space } = getTheme_v2(props.theme);
|
|
2686
|
-
return _responsive(media, props.$space, (spaceIndex) => {
|
|
2687
|
-
const _space = rem(spaceIndex === 0.5 ? space[1] / 2 : space[spaceIndex]);
|
|
2688
|
-
return {
|
|
2689
|
-
margin: `-${_space} 0 0 -${_space}`,
|
|
2690
|
-
"& > div": { padding: `${_space} 0 0 ${_space}` }
|
|
2691
|
-
};
|
|
2692
|
-
});
|
|
2693
|
-
}
|
|
2694
|
-
const Root$m = styled(Box)(inlineBaseStyle, inlineSpaceStyle), Inline = forwardRef(function(props, ref) {
|
|
1925
|
+
const Inline = forwardRef(function(props, ref) {
|
|
2695
1926
|
const { as, children: childrenProp, space, ...restProps } = props, children = useMemo(
|
|
2696
|
-
() => Children.map(childrenProp, (child) => child && /* @__PURE__ */ jsx("
|
|
1927
|
+
() => Children.map(childrenProp, (child) => child && /* @__PURE__ */ jsx(Box, { maxWidth: "fill", children: child })),
|
|
2697
1928
|
[childrenProp]
|
|
2698
1929
|
);
|
|
2699
1930
|
return /* @__PURE__ */ jsx(
|
|
2700
|
-
|
|
1931
|
+
Box,
|
|
2701
1932
|
{
|
|
2702
1933
|
"data-ui": "Inline",
|
|
2703
1934
|
...restProps,
|
|
2704
|
-
|
|
2705
|
-
|
|
1935
|
+
align: "center",
|
|
1936
|
+
as,
|
|
1937
|
+
display: "flex",
|
|
1938
|
+
gap: space,
|
|
2706
1939
|
ref,
|
|
1940
|
+
wrap: "wrap",
|
|
2707
1941
|
children
|
|
2708
1942
|
}
|
|
2709
1943
|
);
|
|
2710
1944
|
});
|
|
2711
1945
|
Inline.displayName = "ForwardRef(Inline)";
|
|
2712
|
-
function
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
|
|
1946
|
+
const KBD = forwardRef(function(props, ref) {
|
|
1947
|
+
const {
|
|
1948
|
+
as = "kbd",
|
|
1949
|
+
children,
|
|
1950
|
+
className,
|
|
1951
|
+
display = "inline-block",
|
|
1952
|
+
fontSize: fontSize2 = 0,
|
|
1953
|
+
padding = 1,
|
|
1954
|
+
radius = 2,
|
|
1955
|
+
...restProps
|
|
1956
|
+
} = props;
|
|
1957
|
+
return /* @__PURE__ */ jsx(
|
|
1958
|
+
Box,
|
|
1959
|
+
{
|
|
1960
|
+
"data-ui": "KBD",
|
|
1961
|
+
...restProps,
|
|
1962
|
+
as,
|
|
1963
|
+
className: composeClassNames(className, kbd({ radius })),
|
|
1964
|
+
display,
|
|
1965
|
+
padding,
|
|
1966
|
+
ref,
|
|
1967
|
+
children: /* @__PURE__ */ jsx(Text, { as: "span", size: fontSize2, weight: "semibold", children })
|
|
2726
1968
|
}
|
|
2727
|
-
|
|
2728
|
-
}
|
|
2729
|
-
const Root$l = styled.kbd(responsiveRadiusStyle, kbdStyle), KBD = forwardRef(function(props, ref) {
|
|
2730
|
-
const { children, fontSize: fontSize2 = 0, padding = 1, radius = 2, ...restProps } = props;
|
|
2731
|
-
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 }) }) });
|
|
1969
|
+
);
|
|
2732
1970
|
});
|
|
2733
1971
|
KBD.displayName = "ForwardRef(KBD)";
|
|
2734
1972
|
const origin = {
|
|
@@ -2788,7 +2026,7 @@ function getRoundedCommands(points) {
|
|
|
2788
2026
|
function compileCommands(cmds) {
|
|
2789
2027
|
return cmds.map((n, idx) => n.type === "point" ? `${idx === 0 ? "M" : "L"} ${n.x} ${n.y}` : n.type === "curve" ? `C ${n.startControl.x} ${n.startControl.y} ${n.endControl.x} ${n.endControl.y} ${n.curveEnd.x} ${n.curveEnd.y}` : "").join(" ");
|
|
2790
2028
|
}
|
|
2791
|
-
const Root$
|
|
2029
|
+
const Root$a = styled.div(
|
|
2792
2030
|
({ $w: w }) => css`
|
|
2793
2031
|
position: absolute;
|
|
2794
2032
|
width: ${w}px;
|
|
@@ -2841,7 +2079,7 @@ const Root$k = styled.div(
|
|
|
2841
2079
|
`, ShapePath = styled.path`
|
|
2842
2080
|
fill: var(--card-bg-color);
|
|
2843
2081
|
`, Arrow = forwardRef(function(props, ref) {
|
|
2844
|
-
const { width: w, height: h, radius = 0, ...restProps } = props, { card } = useTheme_v2(), strokeWidth =
|
|
2082
|
+
const { width: w, height: h, radius = 0, ...restProps } = props, { card: card2 } = useTheme_v2(), strokeWidth = card2.shadow.outline, center = w / 2, points = [
|
|
2845
2083
|
{
|
|
2846
2084
|
x: 0,
|
|
2847
2085
|
y: 0
|
|
@@ -2866,7 +2104,7 @@ const Root$k = styled.div(
|
|
|
2866
2104
|
y: 0
|
|
2867
2105
|
}
|
|
2868
2106
|
], cmds = getRoundedCommands(points), path = compileCommands(cmds), strokePath = `${path}`, fillPath = `${path} M ${w} -1 M 0 -1 Z`;
|
|
2869
|
-
return /* @__PURE__ */ jsx(Root$
|
|
2107
|
+
return /* @__PURE__ */ jsx(Root$a, { ...restProps, $w: w, ref, children: /* @__PURE__ */ jsxs("svg", { width: w, height: w, viewBox: `0 0 ${w} ${w}`, children: [
|
|
2870
2108
|
/* @__PURE__ */ jsx("mask", { id: "stroke-mask", children: /* @__PURE__ */ jsx("rect", { x: 0, y: strokeWidth, width: w, height: w, fill: "white" }) }),
|
|
2871
2109
|
/* @__PURE__ */ jsx(StrokePath, { d: strokePath, mask: "url(#stroke-mask)", strokeWidth: strokeWidth * 2 }),
|
|
2872
2110
|
/* @__PURE__ */ jsx(ShapePath, { d: fillPath })
|
|
@@ -3080,8 +2318,15 @@ function LayerProvider(props) {
|
|
|
3080
2318
|
return /* @__PURE__ */ jsx(LayerContext.Provider, { value, children });
|
|
3081
2319
|
}
|
|
3082
2320
|
LayerProvider.displayName = "LayerProvider";
|
|
3083
|
-
const
|
|
3084
|
-
const {
|
|
2321
|
+
const LayerChildren = forwardRef(function(props, forwardedRef) {
|
|
2322
|
+
const {
|
|
2323
|
+
children,
|
|
2324
|
+
onActivate,
|
|
2325
|
+
onFocus,
|
|
2326
|
+
position = "relative",
|
|
2327
|
+
style = EMPTY_RECORD,
|
|
2328
|
+
...restProps
|
|
2329
|
+
} = props, { zIndex, isTopLayer } = useLayer(), lastFocusedRef = useRef(null), ref = useRef(null), isTopLayerRef = useRef(isTopLayer);
|
|
3085
2330
|
useImperativeHandle(forwardedRef, () => ref.current), useEffect(() => {
|
|
3086
2331
|
isTopLayerRef.current !== isTopLayer && isTopLayer && onActivate?.({ activeElement: lastFocusedRef.current }), isTopLayerRef.current = isTopLayer;
|
|
3087
2332
|
}, [isTopLayer, onActivate]);
|
|
@@ -3093,7 +2338,18 @@ const Root$j = styled.div({ position: "relative" }), LayerChildren = forwardRef(
|
|
|
3093
2338
|
},
|
|
3094
2339
|
[isTopLayer, onFocus]
|
|
3095
2340
|
);
|
|
3096
|
-
return /* @__PURE__ */ jsx(
|
|
2341
|
+
return /* @__PURE__ */ jsx(
|
|
2342
|
+
Box,
|
|
2343
|
+
{
|
|
2344
|
+
"data-ui": "Layer",
|
|
2345
|
+
...restProps,
|
|
2346
|
+
onFocus: handleFocus,
|
|
2347
|
+
position,
|
|
2348
|
+
ref,
|
|
2349
|
+
style: { ...style, zIndex },
|
|
2350
|
+
children
|
|
2351
|
+
}
|
|
2352
|
+
);
|
|
3097
2353
|
}), Layer = forwardRef(function(props, ref) {
|
|
3098
2354
|
const { children, zOffset = 1, ...restProps } = props;
|
|
3099
2355
|
return /* @__PURE__ */ jsx(LayerProvider, { zOffset, children: /* @__PURE__ */ jsx(LayerChildren, { ...restProps, ref, children }) });
|
|
@@ -3122,7 +2378,7 @@ function Portal(props) {
|
|
|
3122
2378
|
}
|
|
3123
2379
|
Portal.displayName = "Portal";
|
|
3124
2380
|
function PortalProvider(props) {
|
|
3125
|
-
const { boundaryElement, children, element, __unstable_elements: elementsProp } = props,
|
|
2381
|
+
const { boundaryElement, children, element, __unstable_elements: elementsProp } = props, elements2 = useUnique(elementsProp), fallbackElement = useSyncExternalStore(
|
|
3126
2382
|
emptySubscribe,
|
|
3127
2383
|
() => document.body,
|
|
3128
2384
|
() => null
|
|
@@ -3130,8 +2386,8 @@ function PortalProvider(props) {
|
|
|
3130
2386
|
version: 0,
|
|
3131
2387
|
boundaryElement: boundaryElement || null,
|
|
3132
2388
|
element: element || fallbackElement,
|
|
3133
|
-
elements
|
|
3134
|
-
}), [boundaryElement, element,
|
|
2389
|
+
elements: elements2
|
|
2390
|
+
}), [boundaryElement, element, elements2, fallbackElement]);
|
|
3135
2391
|
return /* @__PURE__ */ jsx(PortalContext.Provider, { value, children });
|
|
3136
2392
|
}
|
|
3137
2393
|
PortalProvider.displayName = "PortalProvider";
|
|
@@ -3147,7 +2403,7 @@ function _isEqual(objA, objB) {
|
|
|
3147
2403
|
const keysA = Object.keys(objA), keysB = Object.keys(objB);
|
|
3148
2404
|
return keysA.length !== keysB.length ? !1 : keysA.every((key2) => objA[key2] === objB[key2]);
|
|
3149
2405
|
}
|
|
3150
|
-
const Root$
|
|
2406
|
+
const Root$9 = styled.div`
|
|
3151
2407
|
display: block;
|
|
3152
2408
|
width: 0;
|
|
3153
2409
|
height: 0;
|
|
@@ -3156,10 +2412,10 @@ const Root$i = styled.div`
|
|
|
3156
2412
|
overflow: clip;
|
|
3157
2413
|
`, SrOnly = forwardRef(function(props, ref) {
|
|
3158
2414
|
const { as, children } = props;
|
|
3159
|
-
return /* @__PURE__ */ jsx(Root$
|
|
2415
|
+
return /* @__PURE__ */ jsx(Root$9, { "aria-hidden": !0, as, "data-ui": "SrOnly", ref, children });
|
|
3160
2416
|
});
|
|
3161
2417
|
SrOnly.displayName = "ForwardRef(SrOnly)";
|
|
3162
|
-
const Root$
|
|
2418
|
+
const Root$8 = styled.div`
|
|
3163
2419
|
position: relative;
|
|
3164
2420
|
`, ItemWrapper = styled.div`
|
|
3165
2421
|
position: absolute;
|
|
@@ -3207,7 +2463,7 @@ const Root$h = styled.div`
|
|
|
3207
2463
|
const itemIndex = fromIndex + _itemIndex, node = renderItem(item), key2 = getItemKey ? getItemKey(item, itemIndex) : itemIndex;
|
|
3208
2464
|
return /* @__PURE__ */ jsx(ItemWrapper, { style: { top: itemIndex * (itemHeight + space[gap]) }, children: node }, key2);
|
|
3209
2465
|
}), [fromIndex, gap, getItemKey, itemHeight, items, renderItem, space, toIndex]), wrapperStyle = useMemo(() => ({ height }), [height]);
|
|
3210
|
-
return /* @__PURE__ */ jsx(Root$
|
|
2466
|
+
return /* @__PURE__ */ jsx(Root$8, { as, "data-ui": "VirtualList", ...restProps, ref, children: /* @__PURE__ */ jsx("div", { ref: wrapperRef, style: wrapperStyle, children }) });
|
|
3211
2467
|
});
|
|
3212
2468
|
VirtualList.displayName = "ForwardRef(VirtualList)";
|
|
3213
2469
|
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 = {
|
|
@@ -3229,7 +2485,7 @@ function size(options) {
|
|
|
3229
2485
|
return {
|
|
3230
2486
|
name: "@sanity/ui/size",
|
|
3231
2487
|
async fn(args) {
|
|
3232
|
-
const { elements, placement, platform, rects } = args, { floating, reference } = rects, overflow = await detectOverflow(args, {
|
|
2488
|
+
const { elements: elements2, placement, platform, rects } = args, { floating, reference } = rects, overflow = await detectOverflow(args, {
|
|
3233
2489
|
altBoundary: !0,
|
|
3234
2490
|
boundary: options.boundaryElement || void 0,
|
|
3235
2491
|
elementContext: "floating",
|
|
@@ -3241,17 +2497,17 @@ function size(options) {
|
|
|
3241
2497
|
placement.includes("top") && (maxWidth = floatingW - (overflow.left + overflow.right), maxHeight = floatingH - overflow.top), placement.includes("right") && (maxWidth = floatingW - overflow.right, maxHeight = floatingH - (overflow.top + overflow.bottom)), placement.includes("bottom") && (maxWidth = floatingW - (overflow.left + overflow.right), maxHeight = floatingH - overflow.bottom), placement.includes("left") && (maxWidth = floatingW - overflow.left, maxHeight = floatingH - (overflow.top + overflow.bottom)), apply({
|
|
3242
2498
|
availableWidth: maxWidth - margins[1] - margins[3],
|
|
3243
2499
|
availableHeight: maxHeight - margins[0] - margins[2],
|
|
3244
|
-
elements,
|
|
2500
|
+
elements: elements2,
|
|
3245
2501
|
referenceWidth: reference.width - margins[1] - margins[3]
|
|
3246
2502
|
});
|
|
3247
|
-
const nextDimensions = await platform.getDimensions(
|
|
2503
|
+
const nextDimensions = await platform.getDimensions(elements2.floating), targetH = nextDimensions.height, targetW = nextDimensions.width;
|
|
3248
2504
|
return floatingW !== targetW || floatingH !== targetH ? { reset: { rects: !0 } } : {};
|
|
3249
2505
|
}
|
|
3250
2506
|
};
|
|
3251
2507
|
}
|
|
3252
2508
|
function calcCurrentWidth(params) {
|
|
3253
|
-
const { container, mediaIndex, width } = params, w = width[mediaIndex], currentWidth = w === void 0 ? width[width.length - 1] : w;
|
|
3254
|
-
return typeof currentWidth == "number" ?
|
|
2509
|
+
const { container: container2, mediaIndex, width } = params, w = width[mediaIndex], currentWidth = w === void 0 ? width[width.length - 1] : w;
|
|
2510
|
+
return typeof currentWidth == "number" ? container2[currentWidth] : void 0;
|
|
3255
2511
|
}
|
|
3256
2512
|
function calcMaxWidth(params) {
|
|
3257
2513
|
const { boundaryWidth, currentWidth } = params;
|
|
@@ -3261,18 +2517,7 @@ function calcMaxWidth(params) {
|
|
|
3261
2517
|
(boundaryWidth || 1 / 0) - DEFAULT_POPOVER_PADDING * 2
|
|
3262
2518
|
);
|
|
3263
2519
|
}
|
|
3264
|
-
const MotionCard$1 =
|
|
3265
|
-
&:not([hidden]) {
|
|
3266
|
-
display: flex;
|
|
3267
|
-
}
|
|
3268
|
-
flex-direction: column;
|
|
3269
|
-
width: max-content;
|
|
3270
|
-
min-width: min-content;
|
|
3271
|
-
& > * {
|
|
3272
|
-
opacity: var(${POPOVER_MOTION_CONTENT_OPACITY_PROPERTY}, 1);
|
|
3273
|
-
will-change: opacity;
|
|
3274
|
-
}
|
|
3275
|
-
`, PopoverCard = memo(
|
|
2520
|
+
const MotionCard$1 = motion(Card), PopoverCard = memo(
|
|
3276
2521
|
forwardRef(function(props, ref) {
|
|
3277
2522
|
const {
|
|
3278
2523
|
__unstable_margins: marginsProp,
|
|
@@ -3325,6 +2570,7 @@ const MotionCard$1 = styled(motion(Card))`
|
|
|
3325
2570
|
return /* @__PURE__ */ jsxs(
|
|
3326
2571
|
MotionCard$1,
|
|
3327
2572
|
{
|
|
2573
|
+
className: "popover-card",
|
|
3328
2574
|
"data-ui": "Popover",
|
|
3329
2575
|
...restProps,
|
|
3330
2576
|
"data-placement": placement,
|
|
@@ -3356,7 +2602,7 @@ const MotionCard$1 = styled(motion(Card))`
|
|
|
3356
2602
|
PopoverCard.displayName = "Memo(ForwardRef(PopoverCard))";
|
|
3357
2603
|
const Popover = memo(
|
|
3358
2604
|
forwardRef(function(props, forwardedRef) {
|
|
3359
|
-
const { container, layer } = useTheme_v2(), boundaryElementContext = useBoundaryElement(), {
|
|
2605
|
+
const { container: container2, layer } = useTheme_v2(), boundaryElementContext = useBoundaryElement(), {
|
|
3360
2606
|
__unstable_margins: margins = DEFAULT_POPOVER_MARGINS,
|
|
3361
2607
|
animate: _animate = !1,
|
|
3362
2608
|
arrow: arrowProp = !1,
|
|
@@ -3372,27 +2618,27 @@ const Popover = memo(
|
|
|
3372
2618
|
onActivate,
|
|
3373
2619
|
open,
|
|
3374
2620
|
overflow = "hidden",
|
|
3375
|
-
padding
|
|
2621
|
+
padding,
|
|
3376
2622
|
placement: placementProp = "bottom",
|
|
3377
2623
|
portal,
|
|
3378
2624
|
preventOverflow = !0,
|
|
3379
|
-
radius
|
|
2625
|
+
radius = 3,
|
|
3380
2626
|
referenceBoundary = props.boundaryElement ?? boundaryElementContext.element,
|
|
3381
2627
|
referenceElement,
|
|
3382
2628
|
scheme,
|
|
3383
|
-
shadow
|
|
2629
|
+
shadow = 3,
|
|
3384
2630
|
tone = "inherit",
|
|
3385
2631
|
width: widthProp = "auto",
|
|
3386
2632
|
zOffset: zOffsetProp = layer.popover.zOffset,
|
|
3387
2633
|
updateRef,
|
|
3388
2634
|
...restProps
|
|
3389
|
-
} = props, animate = usePrefersReducedMotion() ? !1 : _animate, boundarySize = useElementSize(boundaryElement)?.border,
|
|
2635
|
+
} = props, animate = usePrefersReducedMotion() ? !1 : _animate, boundarySize = useElementSize(boundaryElement)?.border, widthArrayProp = useArrayProp(widthProp), zOffset = useArrayProp(zOffsetProp), ref = useRef(null), arrowRef = useRef(null), rootBoundary = "viewport";
|
|
3390
2636
|
useImperativeHandle(
|
|
3391
2637
|
forwardedRef,
|
|
3392
2638
|
() => ref.current
|
|
3393
2639
|
);
|
|
3394
2640
|
const mediaIndex = useMediaIndex(), boundaryWidth = constrainSize || preventOverflow ? boundarySize?.width : void 0, width = calcCurrentWidth({
|
|
3395
|
-
container,
|
|
2641
|
+
container: container2,
|
|
3396
2642
|
mediaIndex,
|
|
3397
2643
|
width: widthArrayProp
|
|
3398
2644
|
}), widthRef = useRef(width);
|
|
@@ -3421,13 +2667,13 @@ const Popover = memo(
|
|
|
3421
2667
|
})
|
|
3422
2668
|
), ret.push(offset({ mainAxis: DEFAULT_POPOVER_DISTANCE })), (constrainSize || matchReferenceWidth) && ret.push(
|
|
3423
2669
|
size({
|
|
3424
|
-
apply({ availableWidth, availableHeight, elements, referenceWidth }) {
|
|
2670
|
+
apply({ availableWidth, availableHeight, elements: elements2, referenceWidth }) {
|
|
3425
2671
|
referenceWidthRef.current = referenceWidth;
|
|
3426
2672
|
const _currentWidth = widthRef.current, _maxWidth = maxWidthRef.current;
|
|
3427
|
-
matchReferenceWidth ?
|
|
2673
|
+
matchReferenceWidth ? elements2.floating.style.width = `${referenceWidth}px` : _currentWidth !== void 0 && (elements2.floating.style.width = `${_currentWidth}px`), constrainSize && (elements2.floating.style.maxWidth = `${Math.min(
|
|
3428
2674
|
availableWidth,
|
|
3429
2675
|
_maxWidth ?? 1 / 0
|
|
3430
|
-
)}px`,
|
|
2676
|
+
)}px`, elements2.floating.style.maxHeight = `${availableHeight}px`);
|
|
3431
2677
|
},
|
|
3432
2678
|
boundaryElement: floatingBoundary || void 0,
|
|
3433
2679
|
constrainSize,
|
|
@@ -3481,11 +2727,11 @@ const Popover = memo(
|
|
|
3481
2727
|
typeof childRef == "function" ? childRef(node) : childRef && (childRef.current = node);
|
|
3482
2728
|
},
|
|
3483
2729
|
[childProp, refs]
|
|
3484
|
-
), child = useMemo(() => childProp ? cloneElement(childProp, { ref:
|
|
2730
|
+
), child = useMemo(() => !childProp || referenceElement ? null : cloneElement(childProp, { ref: setReference }), [childProp, referenceElement, setReference]);
|
|
3485
2731
|
if (useEffect(() => {
|
|
3486
2732
|
updateRef && (typeof updateRef == "function" ? updateRef(update) : updateRef && (updateRef.current = update));
|
|
3487
2733
|
}, [update, updateRef]), useEffect(() => {
|
|
3488
|
-
|
|
2734
|
+
child || refs.setReference(referenceElement || null);
|
|
3489
2735
|
}, [referenceElement, refs, child]), disabled)
|
|
3490
2736
|
return childProp || /* @__PURE__ */ jsx(Fragment, {});
|
|
3491
2737
|
const popover = /* @__PURE__ */ jsx(LayerProvider, { zOffset, children: /* @__PURE__ */ jsx(
|
|
@@ -3635,14 +2881,14 @@ function inputElementStyle(props) {
|
|
|
3635
2881
|
}
|
|
3636
2882
|
`;
|
|
3637
2883
|
}
|
|
3638
|
-
const Root$
|
|
2884
|
+
const Root$7 = styled.div(radioBaseStyle), Input$2 = styled.input(inputElementStyle), Radio = forwardRef(function(props, forwardedRef) {
|
|
3639
2885
|
const { className, disabled, style, customValidity, readOnly, ...restProps } = props, ref = useRef(null);
|
|
3640
2886
|
return useImperativeHandle(
|
|
3641
2887
|
forwardedRef,
|
|
3642
2888
|
() => ref.current
|
|
3643
|
-
), useCustomValidity(ref, customValidity), /* @__PURE__ */ jsxs(Root$
|
|
2889
|
+
), useCustomValidity(ref, customValidity), /* @__PURE__ */ jsxs(Root$7, { className, "data-ui": "Radio", style, children: [
|
|
3644
2890
|
/* @__PURE__ */ jsx(
|
|
3645
|
-
Input$
|
|
2891
|
+
Input$2,
|
|
3646
2892
|
{
|
|
3647
2893
|
"data-read-only": !disabled && readOnly ? "" : void 0,
|
|
3648
2894
|
"data-error": customValidity ? "" : void 0,
|
|
@@ -3791,7 +3037,7 @@ const selectStyle = {
|
|
|
3791
3037
|
root: rootStyle,
|
|
3792
3038
|
input: inputStyle,
|
|
3793
3039
|
iconBox: iconBoxStyle
|
|
3794
|
-
}, Root$
|
|
3040
|
+
}, Root$6 = styled.div(selectStyle.root), Input$1 = styled.select(selectStyle.input), IconBox = styled(Box)(selectStyle.iconBox), Select = forwardRef(function(props, forwardedRef) {
|
|
3795
3041
|
const {
|
|
3796
3042
|
children,
|
|
3797
3043
|
customValidity,
|
|
@@ -3806,9 +3052,9 @@ const selectStyle = {
|
|
|
3806
3052
|
return useImperativeHandle(
|
|
3807
3053
|
forwardedRef,
|
|
3808
3054
|
() => ref.current
|
|
3809
|
-
), useCustomValidity(ref, customValidity), /* @__PURE__ */ jsxs(Root$
|
|
3055
|
+
), useCustomValidity(ref, customValidity), /* @__PURE__ */ jsxs(Root$6, { "data-ui": "Select", children: [
|
|
3810
3056
|
/* @__PURE__ */ jsx(
|
|
3811
|
-
Input$
|
|
3057
|
+
Input$1,
|
|
3812
3058
|
{
|
|
3813
3059
|
"data-read-only": !disabled && readOnly ? "" : void 0,
|
|
3814
3060
|
"data-ui": "Select",
|
|
@@ -3826,223 +3072,83 @@ const selectStyle = {
|
|
|
3826
3072
|
] });
|
|
3827
3073
|
});
|
|
3828
3074
|
Select.displayName = "ForwardRef(Select)";
|
|
3829
|
-
const
|
|
3830
|
-
"&&:not([hidden])": {
|
|
3831
|
-
display: "grid"
|
|
3832
|
-
},
|
|
3833
|
-
'&[data-as="ul"],&[data-as="ol"]': {
|
|
3834
|
-
listStyle: "none"
|
|
3835
|
-
},
|
|
3836
|
-
gridTemplateColumns: "minmax(0, 1fr)",
|
|
3837
|
-
gridAutoRows: "min-content"
|
|
3838
|
-
};
|
|
3839
|
-
function stackBaseStyle() {
|
|
3840
|
-
return BASE_STYLE;
|
|
3841
|
-
}
|
|
3842
|
-
function responsiveStackSpaceStyle(props) {
|
|
3843
|
-
const { media, space } = getTheme_v2(props.theme);
|
|
3844
|
-
return _responsive(media, props.$space, (spaceIndex) => ({
|
|
3845
|
-
gridGap: rem(space[spaceIndex])
|
|
3846
|
-
}));
|
|
3847
|
-
}
|
|
3848
|
-
const Root$e = styled(Box)(stackBaseStyle, responsiveStackSpaceStyle), Stack = forwardRef(function(props, ref) {
|
|
3075
|
+
const Stack = forwardRef(function(props, ref) {
|
|
3849
3076
|
const { as, space, ...restProps } = props;
|
|
3850
3077
|
return /* @__PURE__ */ jsx(
|
|
3851
|
-
|
|
3078
|
+
Box,
|
|
3852
3079
|
{
|
|
3080
|
+
as,
|
|
3853
3081
|
"data-as": typeof as == "string" ? as : void 0,
|
|
3854
3082
|
"data-ui": "Stack",
|
|
3855
3083
|
...restProps,
|
|
3856
|
-
|
|
3084
|
+
direction: "column",
|
|
3085
|
+
display: "flex",
|
|
3857
3086
|
forwardedAs: as,
|
|
3087
|
+
gapY: space,
|
|
3858
3088
|
ref
|
|
3859
3089
|
}
|
|
3860
3090
|
);
|
|
3861
3091
|
});
|
|
3862
3092
|
Stack.displayName = "ForwardRef(Stack)";
|
|
3863
|
-
function
|
|
3864
|
-
return css`
|
|
3865
|
-
position: relative;
|
|
3866
|
-
&:not([hidden]) {
|
|
3867
|
-
display: inline-block;
|
|
3868
|
-
}
|
|
3869
|
-
`;
|
|
3870
|
-
}
|
|
3871
|
-
function switchInputStyles() {
|
|
3872
|
-
return css`
|
|
3873
|
-
position: absolute;
|
|
3874
|
-
top: 0;
|
|
3875
|
-
right: 0;
|
|
3876
|
-
bottom: 0;
|
|
3877
|
-
left: 0;
|
|
3878
|
-
opacity: 0;
|
|
3879
|
-
height: 100%;
|
|
3880
|
-
width: 100%;
|
|
3881
|
-
outline: none;
|
|
3882
|
-
padding: 0;
|
|
3883
|
-
margin: 0;
|
|
3884
|
-
|
|
3885
|
-
/* Place the input element above the representation element */
|
|
3886
|
-
z-index: 1;
|
|
3887
|
-
`;
|
|
3888
|
-
}
|
|
3889
|
-
function switchRepresentationStyles(props) {
|
|
3890
|
-
const { color, input } = getTheme_v2(props.theme);
|
|
3891
|
-
return css`
|
|
3892
|
-
--switch-bg-color: ${color.input.default.enabled.border};
|
|
3893
|
-
--switch-fg-color: ${color.input.default.enabled.bg};
|
|
3894
|
-
--switch-box-shadow: none;
|
|
3895
|
-
|
|
3896
|
-
&:not([hidden]) {
|
|
3897
|
-
display: block;
|
|
3898
|
-
}
|
|
3899
|
-
position: relative;
|
|
3900
|
-
width: ${rem(input.switch.width)};
|
|
3901
|
-
height: ${rem(input.switch.height)};
|
|
3902
|
-
border-radius: ${rem(input.switch.height / 2)};
|
|
3903
|
-
|
|
3904
|
-
/* Make sure it’s not possible to interact with the wrapper element */
|
|
3905
|
-
pointer-events: none;
|
|
3906
|
-
|
|
3907
|
-
&:after {
|
|
3908
|
-
content: '';
|
|
3909
|
-
display: block;
|
|
3910
|
-
position: absolute;
|
|
3911
|
-
top: 0;
|
|
3912
|
-
left: 0;
|
|
3913
|
-
right: 0;
|
|
3914
|
-
bottom: 0;
|
|
3915
|
-
z-index: 1;
|
|
3916
|
-
box-shadow: var(--switch-box-shadow);
|
|
3917
|
-
border-radius: inherit;
|
|
3918
|
-
}
|
|
3919
|
-
|
|
3920
|
-
/* Focus styles */
|
|
3921
|
-
input:focus + && {
|
|
3922
|
-
--switch-box-shadow: ${focusRingStyle({ focusRing: input.switch.focusRing })};
|
|
3923
|
-
}
|
|
3924
|
-
|
|
3925
|
-
input:focus:not(:focus-visible) + && {
|
|
3926
|
-
--switch-box-shadow: none;
|
|
3927
|
-
}
|
|
3928
|
-
|
|
3929
|
-
input:checked + && {
|
|
3930
|
-
--switch-bg-color: ${color.input.default.enabled.fg};
|
|
3931
|
-
--switch-fg-color: ${color.input.default.enabled.bg};
|
|
3932
|
-
}
|
|
3933
|
-
|
|
3934
|
-
@media (hover: hover) {
|
|
3935
|
-
input:not(:disabled):hover + && {
|
|
3936
|
-
--switch-bg-color: ${color.input.default.hovered.border};
|
|
3937
|
-
--switch-fg-color: ${color.input.default.hovered.bg};
|
|
3938
|
-
}
|
|
3939
|
-
|
|
3940
|
-
input:not(:disabled):checked:hover + && {
|
|
3941
|
-
--switch-bg-color: ${color.input.default.enabled.fg};
|
|
3942
|
-
--switch-fg-color: ${color.input.default.enabled.bg};
|
|
3943
|
-
}
|
|
3944
|
-
}
|
|
3945
|
-
|
|
3946
|
-
input:not([data-read-only]):disabled + && {
|
|
3947
|
-
--switch-bg-color: ${color.input.default.disabled.border};
|
|
3948
|
-
--switch-fg-color: ${color.input.default.disabled.bg};
|
|
3949
|
-
}
|
|
3950
|
-
|
|
3951
|
-
input[data-read-only]:disabled + && {
|
|
3952
|
-
--switch-bg-color: ${color.input.default.readOnly.border};
|
|
3953
|
-
--switch-fg-color: ${color.input.default.readOnly.bg};
|
|
3954
|
-
}
|
|
3955
|
-
|
|
3956
|
-
input:checked[data-read-only]:disabled + && {
|
|
3957
|
-
--switch-bg-color: ${color.input.default.readOnly.fg};
|
|
3958
|
-
--switch-fg-color: ${color.input.default.readOnly.bg};
|
|
3959
|
-
}
|
|
3960
|
-
`;
|
|
3961
|
-
}
|
|
3962
|
-
function switchTrackStyles(props) {
|
|
3963
|
-
const { input } = getTheme_v2(props.theme);
|
|
3964
|
-
return css`
|
|
3965
|
-
&:not([hidden]) {
|
|
3966
|
-
display: block;
|
|
3967
|
-
}
|
|
3968
|
-
background-color: var(--switch-bg-color);
|
|
3969
|
-
position: absolute;
|
|
3970
|
-
left: 0;
|
|
3971
|
-
top: 0;
|
|
3972
|
-
width: ${rem(input.switch.width)};
|
|
3973
|
-
height: ${rem(input.switch.height)};
|
|
3974
|
-
border-radius: ${rem(input.switch.height / 2)};
|
|
3975
|
-
`;
|
|
3976
|
-
}
|
|
3977
|
-
function switchThumbStyles(props) {
|
|
3978
|
-
const { $indeterminate } = props, { input } = getTheme_v2(props.theme), trackWidth = input.switch.width, trackHeight = input.switch.height, trackPadding = input.switch.padding, size2 = trackHeight - input.switch.padding * 2, checkedOffset = trackWidth - trackPadding * 2 - size2, indeterminateOffset = trackWidth / 2 - size2 / 2 - trackPadding, checked = $indeterminate !== !0 && props.$checked === !0;
|
|
3979
|
-
return css`
|
|
3980
|
-
&:not([hidden]) {
|
|
3981
|
-
display: block;
|
|
3982
|
-
}
|
|
3983
|
-
position: absolute;
|
|
3984
|
-
left: ${rem(trackPadding)};
|
|
3985
|
-
top: ${rem(trackPadding)};
|
|
3986
|
-
height: ${rem(size2)};
|
|
3987
|
-
width: ${rem(size2)};
|
|
3988
|
-
border-radius: ${rem(size2 / 2)};
|
|
3989
|
-
transition-property: transform;
|
|
3990
|
-
transition-duration: ${input.switch.transitionDurationMs}ms;
|
|
3991
|
-
transition-timing-function: ${input.switch.transitionTimingFunction};
|
|
3992
|
-
background: var(--switch-fg-color);
|
|
3993
|
-
transform: translate3d(0, 0, 0);
|
|
3994
|
-
box-shadow: 0px 1px 0px 0px rgba(0, 0, 0, 0.05);
|
|
3995
|
-
|
|
3996
|
-
${checked && css`
|
|
3997
|
-
transform: translate3d(${checkedOffset}px, 0, 0);
|
|
3998
|
-
`}
|
|
3999
|
-
|
|
4000
|
-
${$indeterminate && css`
|
|
4001
|
-
transform: translate3d(${indeterminateOffset}px, 0, 0);
|
|
4002
|
-
`}
|
|
4003
|
-
`;
|
|
4004
|
-
}
|
|
4005
|
-
const Root$d = styled.span(switchBaseStyles), Input$2 = styled.input(switchInputStyles), Representation = styled.span(switchRepresentationStyles), Track = styled.span(switchTrackStyles), Thumb = styled.span(switchThumbStyles), Switch = forwardRef(function(props, forwardedRef) {
|
|
3093
|
+
const Switch = forwardRef(function(props, forwardedRef) {
|
|
4006
3094
|
const { checked, className, disabled, indeterminate, readOnly, style, ...restProps } = props, ref = useRef(null);
|
|
4007
3095
|
return useImperativeHandle(
|
|
4008
3096
|
forwardedRef,
|
|
4009
3097
|
() => ref.current
|
|
4010
3098
|
), useEffect(() => {
|
|
4011
3099
|
ref.current && (ref.current.indeterminate = indeterminate || !1);
|
|
4012
|
-
}, [indeterminate]), /* @__PURE__ */ jsxs(
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
3100
|
+
}, [indeterminate]), /* @__PURE__ */ jsxs(
|
|
3101
|
+
Box,
|
|
3102
|
+
{
|
|
3103
|
+
className: composeClassNames(className, _switch()),
|
|
3104
|
+
"data-ui": "Switch",
|
|
3105
|
+
display: "inline-block",
|
|
3106
|
+
position: "relative",
|
|
3107
|
+
style,
|
|
3108
|
+
children: [
|
|
3109
|
+
/* @__PURE__ */ jsx(
|
|
3110
|
+
"input",
|
|
3111
|
+
{
|
|
3112
|
+
"data-read-only": !disabled && readOnly ? "" : void 0,
|
|
3113
|
+
...restProps,
|
|
3114
|
+
checked: indeterminate !== !0 && checked,
|
|
3115
|
+
className: "switch-input",
|
|
3116
|
+
disabled: disabled || readOnly,
|
|
3117
|
+
type: "checkbox",
|
|
3118
|
+
ref
|
|
3119
|
+
}
|
|
3120
|
+
),
|
|
3121
|
+
/* @__PURE__ */ jsxs("span", { "aria-hidden": !0, className: "switch-presentation", "data-name": "representation", children: [
|
|
3122
|
+
/* @__PURE__ */ jsx("span", { className: "switch-track" }),
|
|
3123
|
+
/* @__PURE__ */ jsx(
|
|
3124
|
+
"span",
|
|
3125
|
+
{
|
|
3126
|
+
className: "switch-thumb",
|
|
3127
|
+
"data-checked": checked ? "" : void 0,
|
|
3128
|
+
"data-indeterminate": indeterminate ? "" : void 0
|
|
3129
|
+
}
|
|
3130
|
+
)
|
|
3131
|
+
] })
|
|
3132
|
+
]
|
|
3133
|
+
}
|
|
3134
|
+
);
|
|
4029
3135
|
});
|
|
4030
3136
|
Switch.displayName = "ForwardRef(Switch)";
|
|
4031
|
-
const Root$
|
|
3137
|
+
const Root$5 = styled.span(textInputRootStyle), InputRoot = styled.span`
|
|
4032
3138
|
flex: 1;
|
|
4033
3139
|
min-width: 0;
|
|
4034
3140
|
display: block;
|
|
4035
3141
|
position: relative;
|
|
4036
|
-
`, Input
|
|
3142
|
+
`, Input = styled.textarea(
|
|
4037
3143
|
responsiveInputPaddingStyle,
|
|
4038
3144
|
textInputBaseStyle,
|
|
4039
3145
|
textInputFontSizeStyle
|
|
4040
|
-
), Presentation
|
|
3146
|
+
), Presentation = styled.div(
|
|
4041
3147
|
responsiveRadiusStyle,
|
|
4042
3148
|
textInputRepresentationStyle
|
|
4043
3149
|
), TextArea = forwardRef(function(props, forwardedRef) {
|
|
4044
3150
|
const {
|
|
4045
|
-
border
|
|
3151
|
+
border = !0,
|
|
4046
3152
|
customValidity,
|
|
4047
3153
|
disabled = !1,
|
|
4048
3154
|
fontSize: fontSize2 = 2,
|
|
@@ -4055,9 +3161,9 @@ const Root$c = styled.span(textInputRootStyle), InputRoot$1 = styled.span`
|
|
|
4055
3161
|
return useImperativeHandle(
|
|
4056
3162
|
forwardedRef,
|
|
4057
3163
|
() => ref.current
|
|
4058
|
-
), useCustomValidity(ref, customValidity), /* @__PURE__ */ jsx(Root$
|
|
3164
|
+
), useCustomValidity(ref, customValidity), /* @__PURE__ */ jsx(Root$5, { "data-ui": "TextArea", children: /* @__PURE__ */ jsxs(InputRoot, { children: [
|
|
4059
3165
|
/* @__PURE__ */ jsx(
|
|
4060
|
-
Input
|
|
3166
|
+
Input,
|
|
4061
3167
|
{
|
|
4062
3168
|
"data-as": "textarea",
|
|
4063
3169
|
"data-scheme": rootTheme.scheme,
|
|
@@ -4074,13 +3180,13 @@ const Root$c = styled.span(textInputRootStyle), InputRoot$1 = styled.span`
|
|
|
4074
3180
|
}
|
|
4075
3181
|
),
|
|
4076
3182
|
/* @__PURE__ */ jsx(
|
|
4077
|
-
Presentation
|
|
3183
|
+
Presentation,
|
|
4078
3184
|
{
|
|
4079
3185
|
$radius: useArrayProp(radius),
|
|
4080
3186
|
$unstableDisableFocusRing: __unstable_disableFocusRing,
|
|
4081
3187
|
$scheme: rootTheme.scheme,
|
|
4082
3188
|
$tone: rootTheme.tone,
|
|
4083
|
-
"data-border":
|
|
3189
|
+
"data-border": border ? "" : void 0,
|
|
4084
3190
|
"data-scheme": rootTheme.scheme,
|
|
4085
3191
|
"data-tone": rootTheme.tone
|
|
4086
3192
|
}
|
|
@@ -4088,55 +3194,20 @@ const Root$c = styled.span(textInputRootStyle), InputRoot$1 = styled.span`
|
|
|
4088
3194
|
] }) });
|
|
4089
3195
|
});
|
|
4090
3196
|
TextArea.displayName = "ForwardRef(TextArea)";
|
|
4091
|
-
const CLEAR_BUTTON_BOX_STYLE = {
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
|
|
4097
|
-
border-top-right-radius: 0;
|
|
4098
|
-
border-bottom-right-radius: 0;
|
|
4099
|
-
|
|
4100
|
-
& > span {
|
|
4101
|
-
display: block;
|
|
4102
|
-
margin: -1px;
|
|
4103
|
-
}
|
|
4104
|
-
`, Suffix = styled(Card).attrs({ forwardedAs: "span" })`
|
|
4105
|
-
border-top-left-radius: 0;
|
|
4106
|
-
border-bottom-left-radius: 0;
|
|
4107
|
-
|
|
4108
|
-
& > span {
|
|
4109
|
-
display: block;
|
|
4110
|
-
margin: -1px;
|
|
4111
|
-
}
|
|
4112
|
-
`, Input = styled.input(
|
|
4113
|
-
responsiveInputPaddingStyle,
|
|
4114
|
-
textInputBaseStyle,
|
|
4115
|
-
textInputFontSizeStyle
|
|
4116
|
-
), Presentation = styled.span(
|
|
4117
|
-
responsiveRadiusStyle,
|
|
4118
|
-
textInputRepresentationStyle
|
|
4119
|
-
), LeftBox = styled(Box)`
|
|
4120
|
-
position: absolute;
|
|
4121
|
-
top: 0;
|
|
4122
|
-
left: 0;
|
|
4123
|
-
`, RightBox = styled(Box)`
|
|
4124
|
-
position: absolute;
|
|
4125
|
-
top: 0;
|
|
4126
|
-
right: 0;
|
|
4127
|
-
`, RightCard = styled(Card)`
|
|
4128
|
-
background-color: transparent;
|
|
4129
|
-
position: absolute;
|
|
4130
|
-
top: 0;
|
|
4131
|
-
right: 0;
|
|
4132
|
-
`, TextInputClearButton = styled(Button)({
|
|
3197
|
+
const CLEAR_BUTTON_BOX_STYLE = {
|
|
3198
|
+
backgroundColor: "transparent",
|
|
3199
|
+
top: 0,
|
|
3200
|
+
right: 0,
|
|
3201
|
+
zIndex: 2
|
|
3202
|
+
}, TextInputClearButton = styled(Button)({
|
|
4133
3203
|
"&:not([hidden])": {
|
|
4134
3204
|
display: "block"
|
|
4135
3205
|
}
|
|
4136
3206
|
}), TextInput = forwardRef(function(props, forwardedRef) {
|
|
4137
3207
|
const {
|
|
4138
3208
|
__unstable_disableFocusRing,
|
|
4139
|
-
border
|
|
3209
|
+
border = !0,
|
|
3210
|
+
className,
|
|
4140
3211
|
clearButton,
|
|
4141
3212
|
disabled = !1,
|
|
4142
3213
|
fontSize: fontSizeProp = 2,
|
|
@@ -4147,13 +3218,13 @@ const CLEAR_BUTTON_BOX_STYLE = { zIndex: 2 }, Root$b = styled(Card).attrs({ forw
|
|
|
4147
3218
|
prefix,
|
|
4148
3219
|
radius: radiusProp = 2,
|
|
4149
3220
|
readOnly,
|
|
4150
|
-
space:
|
|
3221
|
+
space: _space = 3,
|
|
4151
3222
|
suffix,
|
|
4152
3223
|
customValidity,
|
|
4153
3224
|
type = "text",
|
|
4154
|
-
weight,
|
|
3225
|
+
weight: _width,
|
|
4155
3226
|
...restProps
|
|
4156
|
-
} = props, ref = useRef(null), rootTheme = useRootTheme(), fontSize2 = useArrayProp(fontSizeProp), padding = useArrayProp(paddingProp), radius = useArrayProp(radiusProp),
|
|
3227
|
+
} = props, ref = useRef(null), rootTheme = useRootTheme(), fontSize2 = useArrayProp(fontSizeProp), padding = useArrayProp(paddingProp), radius = useArrayProp(radiusProp), $hasClearButton = !!clearButton;
|
|
4157
3228
|
useImperativeHandle(
|
|
4158
3229
|
forwardedRef,
|
|
4159
3230
|
() => ref.current
|
|
@@ -4166,27 +3237,40 @@ const CLEAR_BUTTON_BOX_STYLE = { zIndex: 2 }, Root$b = styled(Card).attrs({ forw
|
|
|
4166
3237
|
},
|
|
4167
3238
|
[onClear, ref]
|
|
4168
3239
|
), prefixNode = useMemo(
|
|
4169
|
-
() => prefix && /* @__PURE__ */ jsx(
|
|
3240
|
+
() => prefix && /* @__PURE__ */ jsx(
|
|
3241
|
+
Card,
|
|
3242
|
+
{
|
|
3243
|
+
as: "span",
|
|
3244
|
+
borderTop: !0,
|
|
3245
|
+
borderLeft: !0,
|
|
3246
|
+
borderBottom: !0,
|
|
3247
|
+
className: "text-input-prefix",
|
|
3248
|
+
radius,
|
|
3249
|
+
sizing: "border",
|
|
3250
|
+
tone: "inherit",
|
|
3251
|
+
children: /* @__PURE__ */ jsx("span", { children: prefix })
|
|
3252
|
+
}
|
|
3253
|
+
),
|
|
4170
3254
|
[prefix, radius]
|
|
4171
3255
|
), presentationNode = useMemo(
|
|
4172
3256
|
() => /* @__PURE__ */ jsxs(
|
|
4173
|
-
|
|
3257
|
+
Card,
|
|
4174
3258
|
{
|
|
4175
|
-
|
|
4176
|
-
|
|
4177
|
-
|
|
4178
|
-
|
|
4179
|
-
|
|
4180
|
-
$tone: rootTheme.tone,
|
|
4181
|
-
"data-border": border2 ? "" : void 0,
|
|
3259
|
+
as: "span",
|
|
3260
|
+
border,
|
|
3261
|
+
className: "text-input-presentation",
|
|
3262
|
+
"data-border": border ? "" : void 0,
|
|
3263
|
+
"data-disable-focus-ring": __unstable_disableFocusRing ? "" : void 0,
|
|
4182
3264
|
"data-scheme": rootTheme.scheme,
|
|
4183
3265
|
"data-tone": rootTheme.tone,
|
|
3266
|
+
position: "absolute",
|
|
3267
|
+
radius,
|
|
4184
3268
|
children: [
|
|
4185
|
-
IconComponent && /* @__PURE__ */ jsx(
|
|
3269
|
+
IconComponent && /* @__PURE__ */ jsx(Box, { as: "span", padding, position: "absolute", style: { top: 0, left: 0 }, children: /* @__PURE__ */ jsxs(Text, { size: fontSize2, children: [
|
|
4186
3270
|
isValidElement(IconComponent) && IconComponent,
|
|
4187
3271
|
isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})
|
|
4188
3272
|
] }) }),
|
|
4189
|
-
!$hasClearButton && IconRightComponent && /* @__PURE__ */ jsx(
|
|
3273
|
+
!$hasClearButton && IconRightComponent && /* @__PURE__ */ jsx(Box, { as: "span", padding, position: "absolute", style: { top: 0, right: 0 }, children: /* @__PURE__ */ jsxs(Text, { size: fontSize2, children: [
|
|
4190
3274
|
isValidElement(IconRightComponent) && IconRightComponent,
|
|
4191
3275
|
isValidElementType(IconRightComponent) && /* @__PURE__ */ jsx(IconRightComponent, {})
|
|
4192
3276
|
] }) })
|
|
@@ -4195,16 +3279,16 @@ const CLEAR_BUTTON_BOX_STYLE = { zIndex: 2 }, Root$b = styled(Card).attrs({ forw
|
|
|
4195
3279
|
),
|
|
4196
3280
|
[
|
|
4197
3281
|
__unstable_disableFocusRing,
|
|
4198
|
-
|
|
3282
|
+
border,
|
|
4199
3283
|
fontSize2,
|
|
4200
3284
|
IconComponent,
|
|
4201
3285
|
IconRightComponent,
|
|
4202
3286
|
padding,
|
|
4203
3287
|
radius,
|
|
4204
3288
|
rootTheme,
|
|
4205
|
-
$hasClearButton
|
|
4206
|
-
$hasPrefix,
|
|
4207
|
-
$hasSuffix
|
|
3289
|
+
$hasClearButton
|
|
3290
|
+
// $hasPrefix,
|
|
3291
|
+
// $hasSuffix,
|
|
4208
3292
|
]
|
|
4209
3293
|
), clearButtonBoxPadding = useMemo(
|
|
4210
3294
|
() => padding.map((v) => v === 0 ? 0 : v === 1 || v === 2 ? 1 : v - 2),
|
|
@@ -4217,10 +3301,10 @@ const CLEAR_BUTTON_BOX_STYLE = { zIndex: 2 }, Root$b = styled(Card).attrs({ forw
|
|
|
4217
3301
|
[clearButton]
|
|
4218
3302
|
), clearButtonNode = useMemo(
|
|
4219
3303
|
() => !disabled && !readOnly && clearButton && /* @__PURE__ */ jsx(
|
|
4220
|
-
|
|
3304
|
+
Card,
|
|
4221
3305
|
{
|
|
4222
|
-
forwardedAs: "span",
|
|
4223
3306
|
padding: clearButtonBoxPadding,
|
|
3307
|
+
position: "absolute",
|
|
4224
3308
|
style: CLEAR_BUTTON_BOX_STYLE,
|
|
4225
3309
|
tone: customValidity ? "critical" : "inherit",
|
|
4226
3310
|
children: /* @__PURE__ */ jsx(
|
|
@@ -4254,38 +3338,63 @@ const CLEAR_BUTTON_BOX_STYLE = { zIndex: 2 }, Root$b = styled(Card).attrs({ forw
|
|
|
4254
3338
|
readOnly
|
|
4255
3339
|
]
|
|
4256
3340
|
), suffixNode = useMemo(
|
|
4257
|
-
() => suffix && /* @__PURE__ */ jsx(
|
|
3341
|
+
() => suffix && /* @__PURE__ */ jsx(
|
|
3342
|
+
Card,
|
|
3343
|
+
{
|
|
3344
|
+
as: "span",
|
|
3345
|
+
borderTop: !0,
|
|
3346
|
+
borderRight: !0,
|
|
3347
|
+
borderBottom: !0,
|
|
3348
|
+
className: "text-input-suffix",
|
|
3349
|
+
radius,
|
|
3350
|
+
sizing: "border",
|
|
3351
|
+
tone: "inherit",
|
|
3352
|
+
children: /* @__PURE__ */ jsx("span", { children: suffix })
|
|
3353
|
+
}
|
|
3354
|
+
),
|
|
4258
3355
|
[radius, suffix]
|
|
4259
3356
|
);
|
|
4260
|
-
return /* @__PURE__ */ jsxs(
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
|
|
4268
|
-
|
|
4269
|
-
|
|
4270
|
-
|
|
4271
|
-
|
|
4272
|
-
|
|
4273
|
-
|
|
4274
|
-
|
|
4275
|
-
|
|
4276
|
-
|
|
4277
|
-
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
-
|
|
4281
|
-
|
|
4282
|
-
|
|
4283
|
-
|
|
4284
|
-
|
|
4285
|
-
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
|
|
3357
|
+
return /* @__PURE__ */ jsxs(
|
|
3358
|
+
Card,
|
|
3359
|
+
{
|
|
3360
|
+
align: "center",
|
|
3361
|
+
as: "span",
|
|
3362
|
+
className: composeClassNames(className, textInput({ size: fontSizeProp })),
|
|
3363
|
+
"data-ui": "TextInput",
|
|
3364
|
+
display: "flex",
|
|
3365
|
+
tone: rootTheme.tone,
|
|
3366
|
+
children: [
|
|
3367
|
+
prefixNode,
|
|
3368
|
+
/* @__PURE__ */ jsxs(
|
|
3369
|
+
Box,
|
|
3370
|
+
{
|
|
3371
|
+
as: "span",
|
|
3372
|
+
className: "text-input-wrapper",
|
|
3373
|
+
flex: 1,
|
|
3374
|
+
position: "relative",
|
|
3375
|
+
children: [
|
|
3376
|
+
/* @__PURE__ */ jsx(
|
|
3377
|
+
"input",
|
|
3378
|
+
{
|
|
3379
|
+
"data-as": "input",
|
|
3380
|
+
"data-scheme": rootTheme.scheme,
|
|
3381
|
+
"data-tone": rootTheme.tone,
|
|
3382
|
+
...restProps,
|
|
3383
|
+
disabled,
|
|
3384
|
+
readOnly,
|
|
3385
|
+
ref,
|
|
3386
|
+
type
|
|
3387
|
+
}
|
|
3388
|
+
),
|
|
3389
|
+
presentationNode,
|
|
3390
|
+
clearButtonNode
|
|
3391
|
+
]
|
|
3392
|
+
}
|
|
3393
|
+
),
|
|
3394
|
+
suffixNode
|
|
3395
|
+
]
|
|
3396
|
+
}
|
|
3397
|
+
);
|
|
4289
3398
|
});
|
|
4290
3399
|
TextInput.displayName = "ForwardRef(TextInput)";
|
|
4291
3400
|
function useDelayedState(initialState) {
|
|
@@ -4311,12 +3420,7 @@ const DEFAULT_TOOLTIP_ARROW_WIDTH = 15, DEFAULT_TOOLTIP_ARROW_HEIGHT = 6, DEFAUL
|
|
|
4311
3420
|
right: ["right-end", "right-start", "left", "top", "bottom"],
|
|
4312
3421
|
"right-start": ["right", "right-end", "left-start", "top-start", "bottom-start"],
|
|
4313
3422
|
"right-end": ["right", "right-start", "left-end", "top-end", "bottom-end"]
|
|
4314
|
-
}, MotionCard =
|
|
4315
|
-
& > * {
|
|
4316
|
-
opacity: var(${POPOVER_MOTION_CONTENT_OPACITY_PROPERTY}, 1);
|
|
4317
|
-
will-change: opacity;
|
|
4318
|
-
}
|
|
4319
|
-
`, TooltipCard = memo(
|
|
3423
|
+
}, MotionCard = motion(Card), TooltipCard = memo(
|
|
4320
3424
|
forwardRef(function(props, ref) {
|
|
4321
3425
|
const {
|
|
4322
3426
|
animate,
|
|
@@ -4356,6 +3460,8 @@ const DEFAULT_TOOLTIP_ARROW_WIDTH = 15, DEFAULT_TOOLTIP_ARROW_HEIGHT = 6, DEFAUL
|
|
|
4356
3460
|
{
|
|
4357
3461
|
"data-ui": "Tooltip__card",
|
|
4358
3462
|
...restProps,
|
|
3463
|
+
"data-animate": animate ? "" : void 0,
|
|
3464
|
+
className: tooltipCard(),
|
|
4359
3465
|
"data-placement": placement,
|
|
4360
3466
|
padding,
|
|
4361
3467
|
radius,
|
|
@@ -4405,14 +3511,13 @@ function TooltipDelayGroupProvider(props) {
|
|
|
4405
3511
|
return /* @__PURE__ */ jsx(TooltipDelayGroupContext.Provider, { value, children });
|
|
4406
3512
|
}
|
|
4407
3513
|
TooltipDelayGroupProvider.displayName = "TooltipDelayGroupProvider";
|
|
4408
|
-
const
|
|
4409
|
-
pointer-events: none;
|
|
4410
|
-
`, Tooltip = forwardRef(function(props, forwardedRef) {
|
|
3514
|
+
const Tooltip = forwardRef(function(props, forwardedRef) {
|
|
4411
3515
|
const boundaryElementContext = useBoundaryElement(), { layer } = useTheme_v2(), {
|
|
4412
3516
|
animate: _animate = !1,
|
|
4413
3517
|
arrow: arrowProp = !1,
|
|
4414
3518
|
boundaryElement = boundaryElementContext?.element,
|
|
4415
3519
|
children: childProp,
|
|
3520
|
+
className,
|
|
4416
3521
|
content,
|
|
4417
3522
|
disabled,
|
|
4418
3523
|
fallbackPlacements: fallbackPlacementsProp = props.fallbackPlacements ?? DEFAULT_FALLBACK_PLACEMENTS[props.placement ?? "bottom"],
|
|
@@ -4517,8 +3622,8 @@ const Root$a = styled(Layer)`
|
|
|
4517
3622
|
},
|
|
4518
3623
|
[update]
|
|
4519
3624
|
), setFloating = useCallback(
|
|
4520
|
-
(
|
|
4521
|
-
ref.current =
|
|
3625
|
+
(node2) => {
|
|
3626
|
+
ref.current = node2, refs.setFloating(node2);
|
|
4522
3627
|
},
|
|
4523
3628
|
[refs]
|
|
4524
3629
|
), childRef = useRef(null);
|
|
@@ -4545,11 +3650,12 @@ const Root$a = styled(Layer)`
|
|
|
4545
3650
|
return setReferenceElement(childRef.current), () => setReferenceElement(null);
|
|
4546
3651
|
}, [child]), !child) return /* @__PURE__ */ jsx(Fragment, {});
|
|
4547
3652
|
if (disabled) return child;
|
|
4548
|
-
const
|
|
4549
|
-
|
|
3653
|
+
const node = /* @__PURE__ */ jsx(
|
|
3654
|
+
Layer,
|
|
4550
3655
|
{
|
|
4551
3656
|
"data-ui": "Tooltip",
|
|
4552
3657
|
...restProps,
|
|
3658
|
+
className: composeClassNames(className, tooltip()),
|
|
4553
3659
|
ref: setFloating,
|
|
4554
3660
|
style: {
|
|
4555
3661
|
...floatingStyles,
|
|
@@ -4577,7 +3683,7 @@ const Root$a = styled(Layer)`
|
|
|
4577
3683
|
}
|
|
4578
3684
|
)
|
|
4579
3685
|
}
|
|
4580
|
-
), children = showTooltip && (portalProp ? /* @__PURE__ */ jsx(Portal, { __unstable_name: typeof portalProp == "string" ? portalProp : void 0, children:
|
|
3686
|
+
), children = showTooltip && (portalProp ? /* @__PURE__ */ jsx(Portal, { __unstable_name: typeof portalProp == "string" ? portalProp : void 0, children: node }) : node);
|
|
4581
3687
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4582
3688
|
animate ? /* @__PURE__ */ jsx(AnimatePresence, { children }) : children,
|
|
4583
3689
|
child
|
|
@@ -4600,7 +3706,7 @@ function useCloseOnMouseLeave({
|
|
|
4600
3706
|
return window.addEventListener("mousemove", handleMouseMove), () => window.removeEventListener("mousemove", handleMouseMove);
|
|
4601
3707
|
}, [onMouseMove, showTooltip]);
|
|
4602
3708
|
}
|
|
4603
|
-
const Root$
|
|
3709
|
+
const Root$4 = styled.div`
|
|
4604
3710
|
line-height: 0;
|
|
4605
3711
|
`, ListBox = styled(Box)`
|
|
4606
3712
|
& > ul {
|
|
@@ -4660,7 +3766,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
4660
3766
|
"CapsLock"
|
|
4661
3767
|
], AUTOCOMPLETE_POPOVER_PLACEMENT = "bottom-start", AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS = ["bottom-start", "top-start"], DEFAULT_RENDER_VALUE = (value, option) => option ? option.value : value, DEFAULT_FILTER_OPTION = (query, option) => option.value.toLowerCase().indexOf(query.toLowerCase()) > -1, InnerAutocomplete = forwardRef(function(props, forwardedRef) {
|
|
4662
3768
|
const {
|
|
4663
|
-
border
|
|
3769
|
+
border = !0,
|
|
4664
3770
|
customValidity,
|
|
4665
3771
|
disabled,
|
|
4666
3772
|
filterOption: filterOptionProp,
|
|
@@ -4714,13 +3820,13 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
4714
3820
|
setTimeout(() => {
|
|
4715
3821
|
if (popoverMouseWithinRef.current)
|
|
4716
3822
|
return;
|
|
4717
|
-
const
|
|
3823
|
+
const elements2 = (relatedElements || []).concat(
|
|
4718
3824
|
rootElementRef.current ? [rootElementRef.current] : [],
|
|
4719
3825
|
resultsPopoverElementRef.current ? [resultsPopoverElementRef.current] : []
|
|
4720
3826
|
);
|
|
4721
3827
|
let focusInside = !1;
|
|
4722
3828
|
if (document.activeElement) {
|
|
4723
|
-
for (const e of
|
|
3829
|
+
for (const e of elements2)
|
|
4724
3830
|
if (e === document.activeElement || e.contains(document.activeElement)) {
|
|
4725
3831
|
focusInside = !0;
|
|
4726
3832
|
break;
|
|
@@ -4818,7 +3924,10 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
4818
3924
|
}, [disabled, handleClearButtonFocus, loading, value]), openButtonBoxPadding = useMemo(
|
|
4819
3925
|
() => padding.map((v) => v === 0 ? 0 : v === 1 || v === 2 ? 1 : v - 2),
|
|
4820
3926
|
[padding]
|
|
4821
|
-
), openButtonPadding = useMemo(
|
|
3927
|
+
), openButtonPadding = useMemo(
|
|
3928
|
+
() => padding.map((v) => Math.max(v - 1, 0)),
|
|
3929
|
+
[padding]
|
|
3930
|
+
), openButtonProps = useMemo(
|
|
4822
3931
|
() => typeof openButton == "object" ? openButton : EMPTY_RECORD,
|
|
4823
3932
|
[openButton]
|
|
4824
3933
|
), handleOpenClick = useCallback(
|
|
@@ -4862,7 +3971,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
4862
3971
|
autoCapitalize: "off",
|
|
4863
3972
|
autoComplete: "off",
|
|
4864
3973
|
autoCorrect: "off",
|
|
4865
|
-
border
|
|
3974
|
+
border,
|
|
4866
3975
|
clearButton,
|
|
4867
3976
|
customValidity,
|
|
4868
3977
|
disabled,
|
|
@@ -4979,7 +4088,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
4979
4088
|
renderPopover
|
|
4980
4089
|
]);
|
|
4981
4090
|
return /* @__PURE__ */ jsxs(
|
|
4982
|
-
Root$
|
|
4091
|
+
Root$4,
|
|
4983
4092
|
{
|
|
4984
4093
|
"data-ui": "Autocomplete",
|
|
4985
4094
|
onBlur: handleRootBlur,
|
|
@@ -4994,11 +4103,10 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = [
|
|
|
4994
4103
|
);
|
|
4995
4104
|
});
|
|
4996
4105
|
InnerAutocomplete.displayName = "ForwardRef(Autocomplete)";
|
|
4997
|
-
const Autocomplete = InnerAutocomplete,
|
|
4998
|
-
line-height: 0;
|
|
4999
|
-
`, Breadcrumbs = forwardRef(function(props, ref) {
|
|
4106
|
+
const Autocomplete = InnerAutocomplete, Breadcrumbs = forwardRef(function(props, ref) {
|
|
5000
4107
|
const {
|
|
5001
4108
|
children,
|
|
4109
|
+
className,
|
|
5002
4110
|
expandButton: expandButtonProps,
|
|
5003
4111
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
5004
4112
|
gap: _gapProp,
|
|
@@ -5047,60 +4155,21 @@ const Autocomplete = InnerAutocomplete, Root$8 = styled.nav`
|
|
|
5047
4155
|
}
|
|
5048
4156
|
return rawItems;
|
|
5049
4157
|
}, [collapse, expand, expandButtonProps, gapY, maxLength, open, rawItems]), len = items.length;
|
|
5050
|
-
return /* @__PURE__ */ jsx(
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
4158
|
+
return /* @__PURE__ */ jsx(
|
|
4159
|
+
"nav",
|
|
4160
|
+
{
|
|
4161
|
+
"data-ui": "Breadcrumbs",
|
|
4162
|
+
...restProps,
|
|
4163
|
+
className: composeClassNames(className, breadcrumbs()),
|
|
4164
|
+
ref,
|
|
4165
|
+
children: /* @__PURE__ */ jsx(Flex, { align: "flex-start", as: "ol", gapX, gapY, wrap: "wrap", children: items.map((item, itemIndex) => /* @__PURE__ */ jsxs(Flex, { align: "flex-start", as: "li", gapX, gapY, children: [
|
|
4166
|
+
/* @__PURE__ */ jsx(Box, { children: item }),
|
|
4167
|
+
itemIndex < len - 1 && /* @__PURE__ */ jsx(Box, { "aria-hidden": !0, children: separator || /* @__PURE__ */ jsx(Text, { muted: !0, children: "/" }) })
|
|
4168
|
+
] }, itemIndex)) })
|
|
4169
|
+
}
|
|
4170
|
+
);
|
|
5054
4171
|
});
|
|
5055
4172
|
Breadcrumbs.displayName = "ForwardRef(Breadcrumbs)";
|
|
5056
|
-
function dialogStyle({ theme }) {
|
|
5057
|
-
const { color } = getTheme_v2(theme);
|
|
5058
|
-
return {
|
|
5059
|
-
"&:not([hidden])": {
|
|
5060
|
-
display: "flex"
|
|
5061
|
-
},
|
|
5062
|
-
top: 0,
|
|
5063
|
-
left: 0,
|
|
5064
|
-
right: 0,
|
|
5065
|
-
bottom: 0,
|
|
5066
|
-
alignItems: "center",
|
|
5067
|
-
justifyContent: "center",
|
|
5068
|
-
outline: "none",
|
|
5069
|
-
background: color.backdrop
|
|
5070
|
-
};
|
|
5071
|
-
}
|
|
5072
|
-
function responsiveDialogPositionStyle(props) {
|
|
5073
|
-
const { media } = getTheme_v2(props.theme);
|
|
5074
|
-
return _responsive(media, props.$position, (position) => ({ "&&": { position } }));
|
|
5075
|
-
}
|
|
5076
|
-
function animationDialogStyle(props) {
|
|
5077
|
-
return props.$animate ? css`
|
|
5078
|
-
@keyframes zoomIn {
|
|
5079
|
-
from {
|
|
5080
|
-
opacity: 0;
|
|
5081
|
-
transform: scale(0.95);
|
|
5082
|
-
}
|
|
5083
|
-
to {
|
|
5084
|
-
opacity: 1;
|
|
5085
|
-
transform: scale(1);
|
|
5086
|
-
}
|
|
5087
|
-
}
|
|
5088
|
-
@keyframes fadeIn {
|
|
5089
|
-
from {
|
|
5090
|
-
opacity: 0;
|
|
5091
|
-
}
|
|
5092
|
-
to {
|
|
5093
|
-
opacity: 1;
|
|
5094
|
-
}
|
|
5095
|
-
}
|
|
5096
|
-
|
|
5097
|
-
animation: fadeIn 200ms ease-out;
|
|
5098
|
-
// Animates the dialog card.
|
|
5099
|
-
& > [data-ui='DialogCard'] {
|
|
5100
|
-
animation: zoomIn 200ms ease-out;
|
|
5101
|
-
}
|
|
5102
|
-
` : css``;
|
|
5103
|
-
}
|
|
5104
4173
|
const DialogContext = createGlobalScopedContext(
|
|
5105
4174
|
"@sanity/ui/context/dialog",
|
|
5106
4175
|
{ version: 0 }
|
|
@@ -5111,40 +4180,7 @@ function useDialog() {
|
|
|
5111
4180
|
function isTargetWithinScope(boundaryElement, portalElement, target) {
|
|
5112
4181
|
return !boundaryElement || !portalElement ? !0 : containsOrEqualsElement(boundaryElement, target) || containsOrEqualsElement(portalElement, target);
|
|
5113
4182
|
}
|
|
5114
|
-
const
|
|
5115
|
-
&:not([hidden]) {
|
|
5116
|
-
display: flex;
|
|
5117
|
-
}
|
|
5118
|
-
width: 100%;
|
|
5119
|
-
height: 100%;
|
|
5120
|
-
flex-direction: column;
|
|
5121
|
-
align-items: center;
|
|
5122
|
-
justify-content: center;
|
|
5123
|
-
`, DialogCardRoot = styled(Card)`
|
|
5124
|
-
&:not([hidden]) {
|
|
5125
|
-
display: flex;
|
|
5126
|
-
}
|
|
5127
|
-
width: 100%;
|
|
5128
|
-
min-height: 0;
|
|
5129
|
-
max-height: 100%;
|
|
5130
|
-
overflow: hidden;
|
|
5131
|
-
overflow: clip;
|
|
5132
|
-
`, DialogLayout = styled(Flex)`
|
|
5133
|
-
flex: 1;
|
|
5134
|
-
min-height: 0;
|
|
5135
|
-
width: 100%;
|
|
5136
|
-
`, DialogHeader = styled(Box)`
|
|
5137
|
-
position: relative;
|
|
5138
|
-
z-index: 2;
|
|
5139
|
-
`, DialogContent = styled(Box)`
|
|
5140
|
-
position: relative;
|
|
5141
|
-
z-index: 1;
|
|
5142
|
-
overflow: auto;
|
|
5143
|
-
outline: none;
|
|
5144
|
-
`, DialogFooter = styled(Box)`
|
|
5145
|
-
position: relative;
|
|
5146
|
-
z-index: 3;
|
|
5147
|
-
`, DialogCard = forwardRef(function(props, forwardedRef) {
|
|
4183
|
+
const DialogCard = forwardRef(function(props, forwardedRef) {
|
|
5148
4184
|
const {
|
|
5149
4185
|
__unstable_autoFocus: autoFocus,
|
|
5150
4186
|
__unstable_hideCloseButton: hideCloseButton,
|
|
@@ -5181,33 +4217,68 @@ const Root$7 = styled(Layer)(responsivePaddingStyle, dialogStyle, responsiveDial
|
|
|
5181
4217
|
target && !isTargetWithinScope(boundaryElement, portalElement, target) || onClickOutside();
|
|
5182
4218
|
}),
|
|
5183
4219
|
() => [ref.current]
|
|
5184
|
-
), /* @__PURE__ */ jsx(
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
4220
|
+
), /* @__PURE__ */ jsx(
|
|
4221
|
+
Container,
|
|
4222
|
+
{
|
|
4223
|
+
align: "center",
|
|
4224
|
+
className: dialogContainer(),
|
|
4225
|
+
"data-ui": "DialogCard",
|
|
4226
|
+
direction: "column",
|
|
4227
|
+
display: "flex",
|
|
4228
|
+
justify: "center",
|
|
4229
|
+
width,
|
|
4230
|
+
children: /* @__PURE__ */ jsx(
|
|
4231
|
+
Card,
|
|
5189
4232
|
{
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
|
|
4233
|
+
className: dialogCardRoot(),
|
|
4234
|
+
display: "flex",
|
|
4235
|
+
radius,
|
|
4236
|
+
ref,
|
|
4237
|
+
scheme,
|
|
4238
|
+
shadow,
|
|
4239
|
+
children: /* @__PURE__ */ jsxs(Flex, { className: dialogLayout(), direction: "column", flex: 1, children: [
|
|
4240
|
+
showHeader && /* @__PURE__ */ jsx(Box, { className: dialogHeader(), position: "relative", children: /* @__PURE__ */ jsxs(Flex, { align: "flex-start", padding: 3, children: [
|
|
4241
|
+
/* @__PURE__ */ jsx(Box, { flex: 1, padding: 2, children: header && /* @__PURE__ */ jsx(Text, { id: labelId, size: 1, weight: "semibold", children: header }) }),
|
|
4242
|
+
showCloseButton && /* @__PURE__ */ jsx(Box, { flex: "none", children: /* @__PURE__ */ jsx(
|
|
4243
|
+
Button,
|
|
4244
|
+
{
|
|
4245
|
+
"aria-label": "Close dialog",
|
|
4246
|
+
disabled: !onClose,
|
|
4247
|
+
icon: CloseIcon,
|
|
4248
|
+
mode: "bleed",
|
|
4249
|
+
onClick: onClose,
|
|
4250
|
+
padding: 2
|
|
4251
|
+
}
|
|
4252
|
+
) })
|
|
4253
|
+
] }) }),
|
|
4254
|
+
/* @__PURE__ */ jsx(
|
|
4255
|
+
Box,
|
|
4256
|
+
{
|
|
4257
|
+
className: dialogContent(),
|
|
4258
|
+
flex: 1,
|
|
4259
|
+
overflow: "auto",
|
|
4260
|
+
position: "relative",
|
|
4261
|
+
ref: contentRef,
|
|
4262
|
+
tabIndex: -1,
|
|
4263
|
+
children
|
|
4264
|
+
}
|
|
4265
|
+
),
|
|
4266
|
+
footer && /* @__PURE__ */ jsx(Box, { className: dialogFooter(), position: "relative", children: footer })
|
|
4267
|
+
] })
|
|
5196
4268
|
}
|
|
5197
|
-
)
|
|
5198
|
-
|
|
5199
|
-
|
|
5200
|
-
footer && /* @__PURE__ */ jsx(DialogFooter, { children: footer })
|
|
5201
|
-
] }) }) });
|
|
4269
|
+
)
|
|
4270
|
+
}
|
|
4271
|
+
);
|
|
5202
4272
|
});
|
|
5203
4273
|
DialogCard.displayName = "ForwardRef(DialogCard)";
|
|
5204
4274
|
const Dialog = forwardRef(function(props, ref) {
|
|
5205
|
-
const
|
|
4275
|
+
const context = useDialog(), { layer } = useTheme_v2(), {
|
|
5206
4276
|
__unstable_autoFocus: autoFocus = !0,
|
|
5207
4277
|
__unstable_hideCloseButton: hideCloseButton = !1,
|
|
5208
4278
|
cardRadius: cardRadiusProp = 4,
|
|
5209
4279
|
cardShadow = 3,
|
|
5210
4280
|
children,
|
|
4281
|
+
className,
|
|
5211
4282
|
contentRef,
|
|
5212
4283
|
footer,
|
|
5213
4284
|
header,
|
|
@@ -5216,15 +4287,15 @@ const Dialog = forwardRef(function(props, ref) {
|
|
|
5216
4287
|
onClickOutside,
|
|
5217
4288
|
onClose,
|
|
5218
4289
|
onFocus,
|
|
5219
|
-
padding
|
|
4290
|
+
padding = 3,
|
|
5220
4291
|
portal: portalProp,
|
|
5221
|
-
position: positionProp =
|
|
4292
|
+
position: positionProp = context.position || "fixed",
|
|
5222
4293
|
scheme,
|
|
5223
4294
|
width: widthProp = 0,
|
|
5224
|
-
zOffset: zOffsetProp =
|
|
4295
|
+
zOffset: zOffsetProp = context.zOffset || layer.dialog.zOffset,
|
|
5225
4296
|
animate: _animate = !1,
|
|
5226
4297
|
...restProps
|
|
5227
|
-
} = props, animate = usePrefersReducedMotion() ? !1 : _animate, portal = usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = useBoundaryElement().element, cardRadius = useArrayProp(cardRadiusProp),
|
|
4298
|
+
} = props, animate = usePrefersReducedMotion() ? !1 : _animate, portal = usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = useBoundaryElement().element, cardRadius = useArrayProp(cardRadiusProp), position = useArrayProp(positionProp), width = useArrayProp(widthProp), zOffset = useArrayProp(zOffsetProp), preDivRef = useRef(null), postDivRef = useRef(null), cardRef = useRef(null), focusedElementRef = useRef(null), handleFocus = useCallback(
|
|
5228
4299
|
(event) => {
|
|
5229
4300
|
onFocus?.(event);
|
|
5230
4301
|
const target = event.target, cardElement = cardRef.current;
|
|
@@ -5254,19 +4325,21 @@ const Dialog = forwardRef(function(props, ref) {
|
|
|
5254
4325
|
}, 0);
|
|
5255
4326
|
}, [boundaryElement, portalElement]);
|
|
5256
4327
|
return /* @__PURE__ */ jsx(Portal, { __unstable_name: portalProp, children: /* @__PURE__ */ jsxs(
|
|
5257
|
-
|
|
4328
|
+
Layer,
|
|
5258
4329
|
{
|
|
5259
4330
|
...restProps,
|
|
5260
|
-
$animate: animate,
|
|
5261
|
-
$padding: padding,
|
|
5262
|
-
$position: position,
|
|
5263
4331
|
"aria-labelledby": labelId,
|
|
5264
4332
|
"aria-modal": !0,
|
|
4333
|
+
className: composeClassNames(className, dialog()),
|
|
4334
|
+
"data-animate": animate ? "" : void 0,
|
|
5265
4335
|
"data-ui": "Dialog",
|
|
4336
|
+
display: "flex",
|
|
5266
4337
|
id,
|
|
5267
4338
|
onActivate,
|
|
5268
4339
|
onClick: handleRootClick,
|
|
5269
4340
|
onFocus: handleFocus,
|
|
4341
|
+
padding,
|
|
4342
|
+
position,
|
|
5270
4343
|
ref,
|
|
5271
4344
|
role: "dialog",
|
|
5272
4345
|
zOffset,
|
|
@@ -5310,20 +4383,9 @@ function DialogProvider(props) {
|
|
|
5310
4383
|
return /* @__PURE__ */ jsx(DialogContext.Provider, { value: contextValue, children });
|
|
5311
4384
|
}
|
|
5312
4385
|
DialogProvider.displayName = "DialogProvider";
|
|
5313
|
-
const
|
|
5314
|
-
font: inherit;
|
|
5315
|
-
padding: 1px;
|
|
5316
|
-
|
|
5317
|
-
&:not([hidden]) {
|
|
5318
|
-
display: block;
|
|
5319
|
-
}
|
|
5320
|
-
`, Key = styled(KBD)`
|
|
5321
|
-
&:not([hidden]) {
|
|
5322
|
-
display: block;
|
|
5323
|
-
}
|
|
5324
|
-
`, Hotkeys = forwardRef(function(props, ref) {
|
|
4386
|
+
const Hotkeys = forwardRef(function(props, ref) {
|
|
5325
4387
|
const { fontSize: fontSize2, keys, padding, radius, space: spaceProp = 0.5, ...restProps } = props, space = useArrayProp(spaceProp);
|
|
5326
|
-
return !keys || keys.length === 0 ? /* @__PURE__ */ jsx(Fragment, {}) : /* @__PURE__ */ jsx(
|
|
4388
|
+
return !keys || keys.length === 0 ? /* @__PURE__ */ jsx(Fragment, {}) : /* @__PURE__ */ jsx(Box, { as: "kbd", "data-ui": "Hotkeys", ...restProps, display: "flex", gap: spaceProp, ref, children: /* @__PURE__ */ jsx(Inline, { as: "span", space, children: keys.map((key2, i) => /* @__PURE__ */ jsx(KBD, { display: "block", fontSize: fontSize2, padding, radius, children: key2 }, i)) }) });
|
|
5327
4389
|
});
|
|
5328
4390
|
Hotkeys.displayName = "ForwardRef(Hotkeys)";
|
|
5329
4391
|
const MenuContext = createGlobalScopedContext(
|
|
@@ -5333,8 +4395,8 @@ const MenuContext = createGlobalScopedContext(
|
|
|
5333
4395
|
function _isFocusable(element) {
|
|
5334
4396
|
return isHTMLAnchorElement(element) && element.getAttribute("data-disabled") !== "true" || isHTMLButtonElement(element) && !element.disabled;
|
|
5335
4397
|
}
|
|
5336
|
-
function _getFocusableElements(
|
|
5337
|
-
return
|
|
4398
|
+
function _getFocusableElements(elements2) {
|
|
4399
|
+
return elements2.filter(_isFocusable);
|
|
5338
4400
|
}
|
|
5339
4401
|
function _getDOMPath(rootElement, el) {
|
|
5340
4402
|
const path = [];
|
|
@@ -5350,10 +4412,10 @@ function _getDOMPath(rootElement, el) {
|
|
|
5350
4412
|
return path;
|
|
5351
4413
|
}
|
|
5352
4414
|
const EMPTY_PATH = [];
|
|
5353
|
-
function _sortElements(rootElement,
|
|
4415
|
+
function _sortElements(rootElement, elements2) {
|
|
5354
4416
|
if (!rootElement) return;
|
|
5355
4417
|
const map = /* @__PURE__ */ new WeakMap();
|
|
5356
|
-
for (const el of
|
|
4418
|
+
for (const el of elements2)
|
|
5357
4419
|
map.set(el, _getDOMPath(rootElement, el));
|
|
5358
4420
|
const _sort = (a, b) => {
|
|
5359
4421
|
const _a = map.get(a) || EMPTY_PATH, _b = map.get(b) || EMPTY_PATH, len = Math.max(_a.length, _b.length);
|
|
@@ -5364,7 +4426,7 @@ function _sortElements(rootElement, elements) {
|
|
|
5364
4426
|
}
|
|
5365
4427
|
return 0;
|
|
5366
4428
|
};
|
|
5367
|
-
|
|
4429
|
+
elements2.sort(_sort);
|
|
5368
4430
|
}
|
|
5369
4431
|
function useMenuController(props) {
|
|
5370
4432
|
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) => {
|
|
@@ -5471,7 +4533,7 @@ function useMenuController(props) {
|
|
|
5471
4533
|
mount
|
|
5472
4534
|
};
|
|
5473
4535
|
}
|
|
5474
|
-
const Root$
|
|
4536
|
+
const Root$3 = styled(Box)`
|
|
5475
4537
|
outline: none;
|
|
5476
4538
|
overflow: auto;
|
|
5477
4539
|
`, Menu = forwardRef(function(props, forwardedRef) {
|
|
@@ -5546,7 +4608,7 @@ const Root$5 = styled(Box)`
|
|
|
5546
4608
|
]
|
|
5547
4609
|
);
|
|
5548
4610
|
return /* @__PURE__ */ jsx(MenuContext.Provider, { value, children: /* @__PURE__ */ jsx(
|
|
5549
|
-
Root$
|
|
4611
|
+
Root$3,
|
|
5550
4612
|
{
|
|
5551
4613
|
"data-ui": "Menu",
|
|
5552
4614
|
...restProps,
|
|
@@ -5646,7 +4708,7 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
|
|
|
5646
4708
|
registerElement,
|
|
5647
4709
|
shouldFocus
|
|
5648
4710
|
]
|
|
5649
|
-
), menu = menuProp && cloneElement(menuProp, menuProps), ref = useRef(null),
|
|
4711
|
+
), menu = menuProp && cloneElement(menuProp, menuProps), ref = useRef(null), button2 = useMemo(
|
|
5650
4712
|
() => buttonProp && cloneElement(buttonProp, {
|
|
5651
4713
|
"data-ui": "MenuButton",
|
|
5652
4714
|
id,
|
|
@@ -5664,9 +4726,9 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
|
|
|
5664
4726
|
forwardedRef,
|
|
5665
4727
|
() => ref.current
|
|
5666
4728
|
), useEffect(() => {
|
|
5667
|
-
if (
|
|
4729
|
+
if (button2)
|
|
5668
4730
|
return setButtonElement(ref.current), () => setButtonElement(null);
|
|
5669
|
-
}, [
|
|
4731
|
+
}, [button2]);
|
|
5670
4732
|
const popoverProps = useMemo(
|
|
5671
4733
|
() => ({
|
|
5672
4734
|
boundaryElement: deprecated_boundaryElement,
|
|
@@ -5688,7 +4750,7 @@ const MenuButton = forwardRef(function(props, forwardedRef) {
|
|
|
5688
4750
|
popover
|
|
5689
4751
|
]
|
|
5690
4752
|
);
|
|
5691
|
-
return /* @__PURE__ */ jsx(Popover, { "data-ui": "MenuButton__popover", ...popoverProps, content: menu, open, children:
|
|
4753
|
+
return /* @__PURE__ */ jsx(Popover, { "data-ui": "MenuButton__popover", ...popoverProps, content: menu, open, children: button2 || /* @__PURE__ */ jsx(Fragment, {}) });
|
|
5692
4754
|
});
|
|
5693
4755
|
MenuButton.displayName = "ForwardRef(MenuButton)";
|
|
5694
4756
|
const MenuDivider = styled.hr`
|
|
@@ -5698,107 +4760,18 @@ const MenuDivider = styled.hr`
|
|
|
5698
4760
|
margin: 0;
|
|
5699
4761
|
`;
|
|
5700
4762
|
MenuDivider.displayName = "MenuDivider";
|
|
5701
|
-
function
|
|
5702
|
-
|
|
5703
|
-
|
|
5704
|
-
|
|
5705
|
-
|
|
5706
|
-
|
|
5707
|
-
|
|
5708
|
-
|
|
5709
|
-
outline: none;
|
|
5710
|
-
font: inherit;
|
|
5711
|
-
text-align: inherit;
|
|
5712
|
-
border: 0;
|
|
5713
|
-
width: -moz-available;
|
|
5714
|
-
width: -webkit-fill-available;
|
|
5715
|
-
width: stretch;
|
|
5716
|
-
}
|
|
5717
|
-
|
|
5718
|
-
/* &:is(a) */
|
|
5719
|
-
&[data-as='a'] {
|
|
5720
|
-
text-decoration: none;
|
|
5721
|
-
}
|
|
5722
|
-
`;
|
|
5723
|
-
}
|
|
5724
|
-
function selectableColorStyle(props) {
|
|
5725
|
-
const { $tone } = props, { color, style } = getTheme_v2(props.theme), tone = color.selectable[$tone];
|
|
5726
|
-
return css`
|
|
5727
|
-
${_cardColorStyle(color, tone.enabled)}
|
|
5728
|
-
|
|
5729
|
-
background-color: var(--card-bg-color);
|
|
5730
|
-
color: var(--card-fg-color);
|
|
5731
|
-
outline: none;
|
|
5732
|
-
|
|
5733
|
-
/* &:is(button) */
|
|
5734
|
-
&[data-as='button'] {
|
|
5735
|
-
&:disabled {
|
|
5736
|
-
${_cardColorStyle(color, tone.disabled)}
|
|
5737
|
-
}
|
|
5738
|
-
|
|
5739
|
-
&:not(:disabled) {
|
|
5740
|
-
&[aria-pressed='true'] {
|
|
5741
|
-
${_cardColorStyle(color, tone.pressed)}
|
|
5742
|
-
}
|
|
5743
|
-
|
|
5744
|
-
&[data-selected],
|
|
5745
|
-
&[aria-selected='true'] > & {
|
|
5746
|
-
${_cardColorStyle(color, tone.selected)}
|
|
5747
|
-
}
|
|
5748
|
-
|
|
5749
|
-
@media (hover: hover) {
|
|
5750
|
-
&:not([data-selected]) {
|
|
5751
|
-
&[data-hovered],
|
|
5752
|
-
&:hover {
|
|
5753
|
-
${_cardColorStyle(color, tone.hovered)}
|
|
5754
|
-
}
|
|
5755
|
-
|
|
5756
|
-
&:active {
|
|
5757
|
-
${_cardColorStyle(color, tone.pressed)}
|
|
5758
|
-
}
|
|
5759
|
-
}
|
|
5760
|
-
}
|
|
5761
|
-
}
|
|
5762
|
-
}
|
|
5763
|
-
|
|
5764
|
-
/* &:is(a) */
|
|
5765
|
-
&[data-as='a'] {
|
|
5766
|
-
&[data-disabled] {
|
|
5767
|
-
${_cardColorStyle(color, tone.disabled)}
|
|
5768
|
-
}
|
|
5769
|
-
|
|
5770
|
-
&:not([data-disabled]) {
|
|
5771
|
-
&[data-pressed] {
|
|
5772
|
-
${_cardColorStyle(color, tone.pressed)}
|
|
5773
|
-
}
|
|
5774
|
-
|
|
5775
|
-
&[data-selected] {
|
|
5776
|
-
${_cardColorStyle(color, tone.selected)}
|
|
5777
|
-
}
|
|
5778
|
-
|
|
5779
|
-
@media (hover: hover) {
|
|
5780
|
-
&:not([data-selected]) {
|
|
5781
|
-
&[data-hovered],
|
|
5782
|
-
&:hover {
|
|
5783
|
-
${_cardColorStyle(color, tone.hovered)}
|
|
5784
|
-
}
|
|
5785
|
-
&:active {
|
|
5786
|
-
${_cardColorStyle(color, tone.pressed)}
|
|
5787
|
-
}
|
|
5788
|
-
}
|
|
5789
|
-
}
|
|
5790
|
-
}
|
|
4763
|
+
const Selectable = forwardRef(function(props, ref) {
|
|
4764
|
+
const { className, radius, tone, ...restProps } = props;
|
|
4765
|
+
return /* @__PURE__ */ jsx(
|
|
4766
|
+
Box,
|
|
4767
|
+
{
|
|
4768
|
+
...restProps,
|
|
4769
|
+
className: composeClassNames(className, selectable({ radius, tone })),
|
|
4770
|
+
ref
|
|
5791
4771
|
}
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
}
|
|
5796
|
-
const Selectable = styled(Box)(
|
|
5797
|
-
responsiveRadiusStyle,
|
|
5798
|
-
selectableBaseStyle,
|
|
5799
|
-
selectableColorStyle
|
|
5800
|
-
);
|
|
5801
|
-
Selectable.displayName = "Selectable";
|
|
4772
|
+
);
|
|
4773
|
+
});
|
|
4774
|
+
Selectable.displayName = "ForwardRef(Selectable)";
|
|
5802
4775
|
function useMenu() {
|
|
5803
4776
|
const value = useContext(MenuContext);
|
|
5804
4777
|
if (!value)
|
|
@@ -5818,10 +4791,10 @@ function MenuGroup(props) {
|
|
|
5818
4791
|
popover,
|
|
5819
4792
|
radius = 2,
|
|
5820
4793
|
space = 3,
|
|
5821
|
-
text,
|
|
4794
|
+
text: text2,
|
|
5822
4795
|
tone = "default",
|
|
5823
4796
|
...restProps
|
|
5824
|
-
} = props, menu = useMenu(), {
|
|
4797
|
+
} = props, menu = useMenu(), {
|
|
5825
4798
|
activeElement,
|
|
5826
4799
|
mount,
|
|
5827
4800
|
onClickOutside,
|
|
@@ -5887,21 +4860,20 @@ function MenuGroup(props) {
|
|
|
5887
4860
|
"aria-pressed": as === "button" ? withinMenu : void 0,
|
|
5888
4861
|
"data-pressed": as !== "button" ? withinMenu : void 0,
|
|
5889
4862
|
"data-selected": !withinMenu && active ? "" : void 0,
|
|
5890
|
-
$radius: useArrayProp(radius),
|
|
5891
|
-
$tone: tone,
|
|
5892
|
-
$scheme: scheme,
|
|
5893
4863
|
onClick: handleClick,
|
|
5894
4864
|
onKeyDown: handleKeyDown,
|
|
5895
4865
|
onMouseEnter: handleMouseEnter,
|
|
4866
|
+
radius,
|
|
5896
4867
|
ref: setRootElement,
|
|
5897
4868
|
tabIndex: -1,
|
|
4869
|
+
tone,
|
|
5898
4870
|
type: as === "button" ? "button" : void 0,
|
|
5899
4871
|
children: /* @__PURE__ */ jsxs(Flex, { gap: space, padding, children: [
|
|
5900
4872
|
IconComponent && /* @__PURE__ */ jsxs(Text, { size: fontSize2, children: [
|
|
5901
4873
|
isValidElement(IconComponent) && IconComponent,
|
|
5902
4874
|
isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})
|
|
5903
4875
|
] }),
|
|
5904
|
-
/* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { size: fontSize2, textOverflow: "ellipsis", weight: "medium", children:
|
|
4876
|
+
/* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { size: fontSize2, textOverflow: "ellipsis", weight: "medium", children: text2 }) }),
|
|
5905
4877
|
/* @__PURE__ */ jsx(Text, { size: fontSize2, children: /* @__PURE__ */ jsx(ChevronRightIcon, {}) })
|
|
5906
4878
|
] })
|
|
5907
4879
|
}
|
|
@@ -5929,10 +4901,10 @@ const MenuItem = forwardRef(function(props, forwardedRef) {
|
|
|
5929
4901
|
radius = 2,
|
|
5930
4902
|
selected: selectedProp,
|
|
5931
4903
|
space = 3,
|
|
5932
|
-
text,
|
|
4904
|
+
text: text2,
|
|
5933
4905
|
tone = "default",
|
|
5934
4906
|
...restProps
|
|
5935
|
-
} = props,
|
|
4907
|
+
} = props, menu = useMenu(), {
|
|
5936
4908
|
activeElement,
|
|
5937
4909
|
mount,
|
|
5938
4910
|
onItemClick,
|
|
@@ -5956,7 +4928,7 @@ const MenuItem = forwardRef(function(props, forwardedRef) {
|
|
|
5956
4928
|
paddingLeft
|
|
5957
4929
|
}),
|
|
5958
4930
|
[padding, paddingX, paddingY, paddingTop, paddingRight, paddingBottom, paddingLeft]
|
|
5959
|
-
),
|
|
4931
|
+
), setRef = useCallback((el) => {
|
|
5960
4932
|
ref.current = el, setRootElement(el);
|
|
5961
4933
|
}, []);
|
|
5962
4934
|
return /* @__PURE__ */ jsxs(
|
|
@@ -5965,14 +4937,11 @@ const MenuItem = forwardRef(function(props, forwardedRef) {
|
|
|
5965
4937
|
"data-ui": "MenuItem",
|
|
5966
4938
|
...restProps,
|
|
5967
4939
|
"aria-pressed": as === "button" && pressed,
|
|
4940
|
+
as,
|
|
5968
4941
|
"data-pressed": as !== "button" && pressed ? "" : void 0,
|
|
5969
4942
|
"data-selected": active ? "" : void 0,
|
|
5970
4943
|
"data-disabled": disabled ? "" : void 0,
|
|
5971
|
-
|
|
5972
|
-
$radius: useArrayProp(radius),
|
|
5973
|
-
$padding: useArrayProp(0),
|
|
5974
|
-
$tone: disabled ? "default" : tone,
|
|
5975
|
-
$scheme: scheme,
|
|
4944
|
+
radius,
|
|
5976
4945
|
disabled,
|
|
5977
4946
|
onClick: handleClick,
|
|
5978
4947
|
onMouseEnter: onItemMouseEnter,
|
|
@@ -5980,18 +4949,18 @@ const MenuItem = forwardRef(function(props, forwardedRef) {
|
|
|
5980
4949
|
ref: setRef,
|
|
5981
4950
|
role: "menuitem",
|
|
5982
4951
|
tabIndex: -1,
|
|
4952
|
+
tone,
|
|
5983
4953
|
type: as === "button" ? "button" : void 0,
|
|
5984
4954
|
children: [
|
|
5985
|
-
(IconComponent ||
|
|
4955
|
+
(IconComponent || text2 || IconRightComponent) && /* @__PURE__ */ jsxs(Flex, { as: "span", gap: space, align: "center", ...paddingProps, children: [
|
|
5986
4956
|
IconComponent && /* @__PURE__ */ jsxs(Text, { size: fontSize2, children: [
|
|
5987
4957
|
isValidElement(IconComponent) && IconComponent,
|
|
5988
4958
|
isValidElementType(IconComponent) && /* @__PURE__ */ jsx(IconComponent, {})
|
|
5989
4959
|
] }),
|
|
5990
|
-
|
|
4960
|
+
text2 && /* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { size: fontSize2, textOverflow: "ellipsis", weight: "medium", children: text2 }) }),
|
|
5991
4961
|
hotkeys && /* @__PURE__ */ jsx(
|
|
5992
4962
|
Hotkeys,
|
|
5993
4963
|
{
|
|
5994
|
-
fontSize: hotkeysFontSize,
|
|
5995
4964
|
keys: hotkeys,
|
|
5996
4965
|
style: { marginTop: -4, marginBottom: -4 }
|
|
5997
4966
|
}
|
|
@@ -6043,7 +5012,7 @@ const keyframe = keyframes`
|
|
|
6043
5012
|
@media screen and (prefers-reduced-motion: reduce) {
|
|
6044
5013
|
background-color: var(--card-skeleton-color-from);
|
|
6045
5014
|
}
|
|
6046
|
-
`, Root$
|
|
5015
|
+
`, Root$2 = styled(Box)(
|
|
6047
5016
|
responsiveRadiusStyle,
|
|
6048
5017
|
skeletonStyle
|
|
6049
5018
|
), Skeleton = forwardRef(function(props, ref) {
|
|
@@ -6058,7 +5027,7 @@ const keyframe = keyframes`
|
|
|
6058
5027
|
clearTimeout(timeout);
|
|
6059
5028
|
};
|
|
6060
5029
|
}, [delay]), /* @__PURE__ */ jsx(
|
|
6061
|
-
Root$
|
|
5030
|
+
Root$2,
|
|
6062
5031
|
{
|
|
6063
5032
|
...restProps,
|
|
6064
5033
|
$animated: animated,
|
|
@@ -6069,7 +5038,7 @@ const keyframe = keyframes`
|
|
|
6069
5038
|
);
|
|
6070
5039
|
});
|
|
6071
5040
|
Skeleton.displayName = "ForwardRef(Skeleton)";
|
|
6072
|
-
const Root$
|
|
5041
|
+
const Root$1 = styled(Skeleton)((props) => {
|
|
6073
5042
|
const { $size, $style } = props, { font, media } = getTheme_v2(props.theme), fontStyle = font[$style];
|
|
6074
5043
|
return _responsive(media, $size, (sizeIndex) => {
|
|
6075
5044
|
const fontSize2 = fontStyle.sizes[sizeIndex];
|
|
@@ -6077,33 +5046,31 @@ const Root$3 = styled(Skeleton)((props) => {
|
|
|
6077
5046
|
});
|
|
6078
5047
|
}), TextSkeleton = forwardRef(function(props, ref) {
|
|
6079
5048
|
const { size: size2 = 2, ...restProps } = props, $size = useArrayProp(size2);
|
|
6080
|
-
return /* @__PURE__ */ jsx(Root$
|
|
5049
|
+
return /* @__PURE__ */ jsx(Root$1, { ...restProps, $size, ref, $style: "text" });
|
|
6081
5050
|
});
|
|
6082
5051
|
TextSkeleton.displayName = "ForwardRef(TextSkeleton)";
|
|
6083
5052
|
const LabelSkeleton = forwardRef(function(props, ref) {
|
|
6084
5053
|
const { size: size2 = 2, ...restProps } = props, $size = useArrayProp(size2);
|
|
6085
|
-
return /* @__PURE__ */ jsx(Root$
|
|
5054
|
+
return /* @__PURE__ */ jsx(Root$1, { ...restProps, $size, ref, $style: "label" });
|
|
6086
5055
|
});
|
|
6087
5056
|
LabelSkeleton.displayName = "ForwardRef(LabelSkeleton)";
|
|
6088
5057
|
const HeadingSkeleton = forwardRef(function(props, ref) {
|
|
6089
5058
|
const { size: size2 = 2, ...restProps } = props, $size = useArrayProp(size2);
|
|
6090
|
-
return /* @__PURE__ */ jsx(Root$
|
|
5059
|
+
return /* @__PURE__ */ jsx(Root$1, { ...restProps, $size, ref, $style: "heading" });
|
|
6091
5060
|
});
|
|
6092
5061
|
HeadingSkeleton.displayName = "ForwardRef(HeadingSkeleton)";
|
|
6093
5062
|
const CodeSkeleton = forwardRef(function(props, ref) {
|
|
6094
5063
|
const { size: size2 = 2, ...restProps } = props, $size = useArrayProp(size2);
|
|
6095
|
-
return /* @__PURE__ */ jsx(Root$
|
|
5064
|
+
return /* @__PURE__ */ jsx(Root$1, { ...restProps, $size, ref, $style: "code" });
|
|
6096
5065
|
});
|
|
6097
5066
|
CodeSkeleton.displayName = "ForwardRef(CodeSkeleton)";
|
|
6098
|
-
const
|
|
6099
|
-
max-width: 100%;
|
|
6100
|
-
`, Tab = forwardRef(function(props, forwardedRef) {
|
|
5067
|
+
const Tab = forwardRef(function(props, forwardedRef) {
|
|
6101
5068
|
const {
|
|
6102
5069
|
icon,
|
|
6103
5070
|
id,
|
|
6104
5071
|
focused,
|
|
6105
5072
|
fontSize: fontSize2 = 1,
|
|
6106
|
-
label,
|
|
5073
|
+
label: label2,
|
|
6107
5074
|
onClick,
|
|
6108
5075
|
onFocus,
|
|
6109
5076
|
padding = 2,
|
|
@@ -6125,7 +5092,7 @@ const CustomButton = styled(Button)`
|
|
|
6125
5092
|
return useEffect(() => {
|
|
6126
5093
|
focused && !focusedRef.current && (ref.current && ref.current.focus(), focusedRef.current = !0);
|
|
6127
5094
|
}, [focused]), /* @__PURE__ */ jsx(
|
|
6128
|
-
|
|
5095
|
+
Button,
|
|
6129
5096
|
{
|
|
6130
5097
|
"data-ui": "Tab",
|
|
6131
5098
|
...restProps,
|
|
@@ -6142,7 +5109,7 @@ const CustomButton = styled(Button)`
|
|
|
6142
5109
|
role: "tab",
|
|
6143
5110
|
selected,
|
|
6144
5111
|
tabIndex: selected ? 0 : -1,
|
|
6145
|
-
text:
|
|
5112
|
+
text: label2,
|
|
6146
5113
|
type: "button"
|
|
6147
5114
|
}
|
|
6148
5115
|
);
|
|
@@ -6259,18 +5226,19 @@ const STATUS_CARD_TONE = {
|
|
|
6259
5226
|
warning: "alert",
|
|
6260
5227
|
success: "alert",
|
|
6261
5228
|
info: "alert"
|
|
6262
|
-
}, Root
|
|
5229
|
+
}, Root = styled(Card)(
|
|
6263
5230
|
rootStyles
|
|
6264
5231
|
);
|
|
6265
5232
|
function Toast(props) {
|
|
6266
5233
|
const { closable, description, duration, onClose, radius = 3, title, status, ...restProps } = props, cardTone = status ? STATUS_CARD_TONE[status] : "default", buttonTone = status ? BUTTON_TONE[status] : "default", role = status ? ROLES[status] : "status";
|
|
6267
5234
|
return /* @__PURE__ */ jsx(
|
|
6268
|
-
Root
|
|
5235
|
+
Root,
|
|
6269
5236
|
{
|
|
6270
5237
|
"data-ui": "Toast",
|
|
6271
5238
|
role,
|
|
6272
5239
|
...restProps,
|
|
6273
5240
|
marginTop: 3,
|
|
5241
|
+
pointerEvents: "auto",
|
|
6274
5242
|
radius,
|
|
6275
5243
|
shadow: 2,
|
|
6276
5244
|
tone: cardTone,
|
|
@@ -6308,21 +5276,7 @@ const subscribe = () => () => {
|
|
|
6308
5276
|
}, ToastContext = createGlobalScopedContext(
|
|
6309
5277
|
"@sanity/ui/context/toast",
|
|
6310
5278
|
null
|
|
6311
|
-
)
|
|
6312
|
-
position: fixed;
|
|
6313
|
-
top: 0;
|
|
6314
|
-
left: 0;
|
|
6315
|
-
right: 0;
|
|
6316
|
-
bottom: 0;
|
|
6317
|
-
pointer-events: none;
|
|
6318
|
-
`, ToastContainer = styled.div`
|
|
6319
|
-
box-sizing: border-box;
|
|
6320
|
-
position: absolute;
|
|
6321
|
-
right: 0;
|
|
6322
|
-
bottom: 0;
|
|
6323
|
-
max-width: 420px;
|
|
6324
|
-
width: 100%;
|
|
6325
|
-
`;
|
|
5279
|
+
);
|
|
6326
5280
|
let toastId = 0;
|
|
6327
5281
|
function ToastProvider(props) {
|
|
6328
5282
|
const { children, padding = 4, paddingX, paddingY, zOffset } = props, [state, _setState] = useState([]), toastsRef = useRef({}), mounted = useMounted(), prefersReducedMotion = usePrefersReducedMotion(), variants = useMemo(
|
|
@@ -6377,29 +5331,55 @@ function ToastProvider(props) {
|
|
|
6377
5331
|
[]
|
|
6378
5332
|
), /* @__PURE__ */ jsxs(ToastContext.Provider, { value, children: [
|
|
6379
5333
|
children,
|
|
6380
|
-
mounted && /* @__PURE__ */ jsx(
|
|
6381
|
-
|
|
5334
|
+
mounted && /* @__PURE__ */ jsx(
|
|
5335
|
+
Layer,
|
|
6382
5336
|
{
|
|
6383
|
-
|
|
6384
|
-
|
|
6385
|
-
|
|
6386
|
-
|
|
6387
|
-
|
|
6388
|
-
|
|
5337
|
+
className: void 0,
|
|
5338
|
+
"data-ui": "ToastProvider",
|
|
5339
|
+
inset: 0,
|
|
5340
|
+
pointerEvents: "none",
|
|
5341
|
+
position: "fixed",
|
|
5342
|
+
zOffset,
|
|
5343
|
+
width: "fill",
|
|
6389
5344
|
children: /* @__PURE__ */ jsx(
|
|
6390
|
-
|
|
5345
|
+
Box,
|
|
6391
5346
|
{
|
|
6392
|
-
|
|
6393
|
-
|
|
6394
|
-
|
|
6395
|
-
|
|
6396
|
-
|
|
6397
|
-
|
|
5347
|
+
className: void 0,
|
|
5348
|
+
position: "absolute",
|
|
5349
|
+
sizing: "border",
|
|
5350
|
+
style: {
|
|
5351
|
+
// todo: move to css
|
|
5352
|
+
right: 0,
|
|
5353
|
+
bottom: 0,
|
|
5354
|
+
maxWidth: 420
|
|
5355
|
+
},
|
|
5356
|
+
children: /* @__PURE__ */ jsx(Box, { padding, paddingX, paddingY, children: /* @__PURE__ */ jsx(AnimatePresence, { initial: !1, children: state.map(({ dismiss, id, params }) => /* @__PURE__ */ jsx(
|
|
5357
|
+
motion.div,
|
|
5358
|
+
{
|
|
5359
|
+
layout: "position",
|
|
5360
|
+
initial: "initial",
|
|
5361
|
+
animate: "animate",
|
|
5362
|
+
exit: "exit",
|
|
5363
|
+
variants,
|
|
5364
|
+
transition: prefersReducedMotion ? { duration: 0 } : { type: "spring", damping: 30, stiffness: 400 },
|
|
5365
|
+
children: /* @__PURE__ */ jsx(
|
|
5366
|
+
Toast,
|
|
5367
|
+
{
|
|
5368
|
+
closable: params.closable,
|
|
5369
|
+
description: params.description,
|
|
5370
|
+
onClose: dismiss,
|
|
5371
|
+
status: params.status,
|
|
5372
|
+
title: params.title,
|
|
5373
|
+
duration: params.duration
|
|
5374
|
+
}
|
|
5375
|
+
)
|
|
5376
|
+
},
|
|
5377
|
+
id
|
|
5378
|
+
)) }) })
|
|
6398
5379
|
}
|
|
6399
5380
|
)
|
|
6400
|
-
}
|
|
6401
|
-
|
|
6402
|
-
)) }) }) }) })
|
|
5381
|
+
}
|
|
5382
|
+
)
|
|
6403
5383
|
] });
|
|
6404
5384
|
}
|
|
6405
5385
|
ToastProvider.displayName = "ToastProvider";
|
|
@@ -6589,92 +5569,6 @@ const TreeContext = createGlobalScopedContext(
|
|
|
6589
5569
|
})
|
|
6590
5570
|
);
|
|
6591
5571
|
Tree.displayName = "Memo(ForwardRef(Tree))";
|
|
6592
|
-
function treeItemRootStyle() {
|
|
6593
|
-
return css`
|
|
6594
|
-
&[role='none'] > [role='treeitem'] {
|
|
6595
|
-
outline: none;
|
|
6596
|
-
cursor: default;
|
|
6597
|
-
border-radius: 3px;
|
|
6598
|
-
|
|
6599
|
-
background-color: var(--card-bg-color);
|
|
6600
|
-
color: var(--treeitem-fg-color);
|
|
6601
|
-
|
|
6602
|
-
&:focus {
|
|
6603
|
-
position: relative;
|
|
6604
|
-
}
|
|
6605
|
-
}
|
|
6606
|
-
|
|
6607
|
-
&[role='treeitem'] {
|
|
6608
|
-
outline: none;
|
|
6609
|
-
|
|
6610
|
-
& > div {
|
|
6611
|
-
cursor: default;
|
|
6612
|
-
border-radius: 3px;
|
|
6613
|
-
|
|
6614
|
-
background-color: var(--card-bg-color);
|
|
6615
|
-
color: var(--treeitem-fg-color);
|
|
6616
|
-
}
|
|
6617
|
-
|
|
6618
|
-
&:focus > div {
|
|
6619
|
-
position: relative;
|
|
6620
|
-
}
|
|
6621
|
-
}
|
|
6622
|
-
`;
|
|
6623
|
-
}
|
|
6624
|
-
function treeItemRootColorStyle(props) {
|
|
6625
|
-
const $tone = "default", { color } = getTheme_v2(props.theme), tone = color.selectable[$tone];
|
|
6626
|
-
return css`
|
|
6627
|
-
&[role='none'] {
|
|
6628
|
-
& > [role='treeitem'] {
|
|
6629
|
-
${_cardColorStyle(color, tone.enabled)}
|
|
6630
|
-
}
|
|
6631
|
-
|
|
6632
|
-
&[data-selected] > [role='treeitem'] {
|
|
6633
|
-
${_cardColorStyle(color, tone.pressed)}
|
|
6634
|
-
}
|
|
6635
|
-
|
|
6636
|
-
@media (hover: hover) {
|
|
6637
|
-
&:not([data-selected]) > [role='treeitem']:not(:focus):hover {
|
|
6638
|
-
${_cardColorStyle(color, tone.hovered)}
|
|
6639
|
-
}
|
|
6640
|
-
|
|
6641
|
-
& > [role='treeitem']:focus {
|
|
6642
|
-
${_cardColorStyle(color, tone.selected)}
|
|
6643
|
-
}
|
|
6644
|
-
}
|
|
6645
|
-
}
|
|
6646
|
-
|
|
6647
|
-
&[role='treeitem'] {
|
|
6648
|
-
& > [data-ui='TreeItem__box'] {
|
|
6649
|
-
${_cardColorStyle(color, tone.enabled)}
|
|
6650
|
-
}
|
|
6651
|
-
|
|
6652
|
-
&[data-selected] > [data-ui='TreeItem__box'] {
|
|
6653
|
-
${_cardColorStyle(color, tone.pressed)}
|
|
6654
|
-
}
|
|
6655
|
-
|
|
6656
|
-
@media (hover: hover) {
|
|
6657
|
-
&:not([data-selected]):not(:focus) > [data-ui='TreeItem__box']:hover {
|
|
6658
|
-
${_cardColorStyle(color, tone.hovered)}
|
|
6659
|
-
}
|
|
6660
|
-
|
|
6661
|
-
&:focus > [data-ui='TreeItem__box'] {
|
|
6662
|
-
${_cardColorStyle(color, tone.selected)}
|
|
6663
|
-
}
|
|
6664
|
-
}
|
|
6665
|
-
}
|
|
6666
|
-
`;
|
|
6667
|
-
}
|
|
6668
|
-
function treeItemBoxStyle(props) {
|
|
6669
|
-
const { $level } = props, { space } = getTheme_v2(props.theme);
|
|
6670
|
-
return css`
|
|
6671
|
-
padding-left: ${rem(space[2] * $level)};
|
|
6672
|
-
|
|
6673
|
-
&[data-as='a'] {
|
|
6674
|
-
text-decoration: none;
|
|
6675
|
-
}
|
|
6676
|
-
`;
|
|
6677
|
-
}
|
|
6678
5572
|
function useTree() {
|
|
6679
5573
|
const tree = useContext(TreeContext);
|
|
6680
5574
|
if (!tree)
|
|
@@ -6696,13 +5590,14 @@ const TreeGroup = memo(function(props) {
|
|
|
6696
5590
|
children
|
|
6697
5591
|
}
|
|
6698
5592
|
);
|
|
6699
|
-
}),
|
|
5593
|
+
}), ToggleArrowText = styled(Text)`
|
|
6700
5594
|
& > svg {
|
|
6701
5595
|
transition: transform 100ms;
|
|
6702
5596
|
}
|
|
6703
5597
|
`, TreeItem = memo(function(props) {
|
|
6704
5598
|
const {
|
|
6705
5599
|
children,
|
|
5600
|
+
className,
|
|
6706
5601
|
expanded: expandedProp = !1,
|
|
6707
5602
|
fontSize: fontSize2 = 1,
|
|
6708
5603
|
href,
|
|
@@ -6714,7 +5609,7 @@ const TreeGroup = memo(function(props) {
|
|
|
6714
5609
|
padding = 2,
|
|
6715
5610
|
selected = !1,
|
|
6716
5611
|
space = 2,
|
|
6717
|
-
text,
|
|
5612
|
+
text: text2,
|
|
6718
5613
|
weight,
|
|
6719
5614
|
...restProps
|
|
6720
5615
|
} = props, rootRef = useRef(null), treeitemRef = useRef(null), tree = useTree(), { path, registerItem, setExpanded, setFocusedElement } = tree, _id = useId(), id = idProp || _id, itemPath = useMemo(() => path.concat([id || ""]), [id, path]), itemKey = itemPath.join("/"), itemState = tree.state[itemKey], focused = tree.focusedElement === rootRef.current, expanded = itemState?.expanded === void 0 ? expandedProp : itemState?.expanded || !1, tabIndex = tree.focusedElement && tree.focusedElement === rootRef.current ? 0 : -1, contextValue = useMemo(
|
|
@@ -6737,11 +5632,10 @@ const TreeGroup = memo(function(props) {
|
|
|
6737
5632
|
if (rootRef.current)
|
|
6738
5633
|
return registerItem(rootRef.current, itemPath.join("/"), expanded, selected);
|
|
6739
5634
|
}, [expanded, itemPath, registerItem, selected]);
|
|
6740
|
-
const content = /* @__PURE__ */ jsxs(Flex, { padding, children: [
|
|
5635
|
+
const content = /* @__PURE__ */ jsxs(Flex, { gap: space, padding, children: [
|
|
6741
5636
|
/* @__PURE__ */ jsxs(
|
|
6742
5637
|
Box,
|
|
6743
5638
|
{
|
|
6744
|
-
marginRight: space,
|
|
6745
5639
|
style: {
|
|
6746
5640
|
visibility: IconComponent || children ? "visible" : "hidden",
|
|
6747
5641
|
pointerEvents: "none"
|
|
@@ -6752,24 +5646,25 @@ const TreeGroup = memo(function(props) {
|
|
|
6752
5646
|
]
|
|
6753
5647
|
}
|
|
6754
5648
|
),
|
|
6755
|
-
/* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { muted, size: fontSize2, textOverflow: "ellipsis", weight, children:
|
|
5649
|
+
/* @__PURE__ */ jsx(Box, { flex: 1, children: /* @__PURE__ */ jsx(Text, { muted, size: fontSize2, textOverflow: "ellipsis", weight, children: text2 }) })
|
|
6756
5650
|
] });
|
|
6757
5651
|
return href ? /* @__PURE__ */ jsxs(
|
|
6758
|
-
|
|
5652
|
+
Box,
|
|
6759
5653
|
{
|
|
6760
5654
|
"data-selected": selected ? "" : void 0,
|
|
6761
5655
|
"data-tree-id": id,
|
|
6762
5656
|
"data-tree-key": itemKey,
|
|
6763
5657
|
"data-ui": "TreeItem",
|
|
6764
5658
|
...restProps,
|
|
5659
|
+
as: "li",
|
|
5660
|
+
className: composeClassNames(className, treeItem()),
|
|
6765
5661
|
onClick: handleClick,
|
|
6766
5662
|
ref: rootRef,
|
|
6767
5663
|
role: "none",
|
|
6768
5664
|
children: [
|
|
6769
5665
|
/* @__PURE__ */ jsx(
|
|
6770
|
-
|
|
5666
|
+
Box,
|
|
6771
5667
|
{
|
|
6772
|
-
$level: tree.level,
|
|
6773
5668
|
"aria-expanded": expanded,
|
|
6774
5669
|
as: linkAs,
|
|
6775
5670
|
"data-ui": "TreeItem__box",
|
|
@@ -6777,6 +5672,9 @@ const TreeGroup = memo(function(props) {
|
|
|
6777
5672
|
ref: treeitemRef,
|
|
6778
5673
|
role: "treeitem",
|
|
6779
5674
|
tabIndex,
|
|
5675
|
+
style: {
|
|
5676
|
+
paddingLeft: `calc(var(--space-2) * ${tree.level})`
|
|
5677
|
+
},
|
|
6780
5678
|
children: content
|
|
6781
5679
|
}
|
|
6782
5680
|
),
|
|
@@ -6784,7 +5682,7 @@ const TreeGroup = memo(function(props) {
|
|
|
6784
5682
|
]
|
|
6785
5683
|
}
|
|
6786
5684
|
) : /* @__PURE__ */ jsxs(
|
|
6787
|
-
|
|
5685
|
+
Box,
|
|
6788
5686
|
{
|
|
6789
5687
|
"data-selected": selected ? "" : void 0,
|
|
6790
5688
|
"data-ui": "TreeItem",
|
|
@@ -6798,7 +5696,17 @@ const TreeGroup = memo(function(props) {
|
|
|
6798
5696
|
role: "treeitem",
|
|
6799
5697
|
tabIndex,
|
|
6800
5698
|
children: [
|
|
6801
|
-
/* @__PURE__ */ jsx(
|
|
5699
|
+
/* @__PURE__ */ jsx(
|
|
5700
|
+
Box,
|
|
5701
|
+
{
|
|
5702
|
+
as: "div",
|
|
5703
|
+
"data-ui": "TreeItem__box",
|
|
5704
|
+
style: {
|
|
5705
|
+
paddingLeft: `calc(var(--space-2) * ${tree.level})`
|
|
5706
|
+
},
|
|
5707
|
+
children: content
|
|
5708
|
+
}
|
|
5709
|
+
),
|
|
6802
5710
|
/* @__PURE__ */ jsx(TreeContext.Provider, { value: contextValue, children: children && /* @__PURE__ */ jsx(TreeGroup, { expanded, children }) })
|
|
6803
5711
|
]
|
|
6804
5712
|
}
|
|
@@ -6897,6 +5805,7 @@ export {
|
|
|
6897
5805
|
isHTMLTextAreaElement,
|
|
6898
5806
|
multiply,
|
|
6899
5807
|
parseColor,
|
|
5808
|
+
px,
|
|
6900
5809
|
rem,
|
|
6901
5810
|
responsiveCodeFontStyle,
|
|
6902
5811
|
responsiveHeadingFont,
|