@sanity/ui 0.37.11 → 0.37.14-next.5
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/lib/dts/src/components/autocomplete/autocomplete.d.ts +2 -2
- package/lib/dts/src/components/autocomplete/autocomplete.d.ts.map +1 -1
- package/lib/dts/src/components/autocomplete/autocomplete.styles.d.ts +1 -1
- package/lib/dts/src/components/autocomplete/autocomplete.styles.d.ts.map +1 -1
- package/lib/dts/src/components/autocomplete/constants.d.ts +0 -4
- package/lib/dts/src/components/autocomplete/constants.d.ts.map +1 -1
- package/lib/dts/src/components/breadcrumbs/breadcrumbs.d.ts.map +1 -1
- package/lib/dts/src/components/dialog/dialog.d.ts.map +1 -1
- package/lib/dts/src/components/dialog/styles.d.ts +1 -1
- package/lib/dts/src/components/dialog/styles.d.ts.map +1 -1
- package/lib/dts/src/components/hotkeys/hotkeys.d.ts.map +1 -1
- package/lib/dts/src/components/menu/menuButton.d.ts.map +1 -1
- package/lib/dts/src/components/menu/menuGroup.d.ts.map +1 -1
- package/lib/dts/src/components/menu/menuItem.d.ts.map +1 -1
- package/lib/dts/src/components/skeleton/skeleton.d.ts.map +1 -1
- package/lib/dts/src/constants.d.ts +10 -0
- package/lib/dts/src/constants.d.ts.map +1 -1
- package/lib/dts/src/hooks/_internal/useUnique.d.ts +2 -3
- package/lib/dts/src/hooks/_internal/useUnique.d.ts.map +1 -1
- package/lib/dts/src/hooks/index.d.ts +2 -1
- package/lib/dts/src/hooks/index.d.ts.map +1 -1
- package/lib/dts/src/hooks/useArrayProp.d.ts +7 -0
- package/lib/dts/src/hooks/useArrayProp.d.ts.map +1 -0
- package/lib/dts/src/hooks/useElementRect/useElementRect.d.ts +1 -1
- package/lib/dts/src/hooks/useElementRect/useElementRect.d.ts.map +1 -1
- package/lib/dts/src/hooks/useElementSize.d.ts +7 -0
- package/lib/dts/src/hooks/useElementSize.d.ts.map +1 -0
- package/lib/dts/src/index.d.ts +1 -0
- package/lib/dts/src/index.d.ts.map +1 -1
- package/lib/dts/src/observers/elementSizeObserver.d.ts +37 -0
- package/lib/dts/src/observers/elementSizeObserver.d.ts.map +1 -0
- package/lib/dts/src/observers/index.d.ts +3 -0
- package/lib/dts/src/observers/index.d.ts.map +1 -0
- package/lib/dts/src/observers/resizeObserver.d.ts +5 -0
- package/lib/dts/src/observers/resizeObserver.d.ts.map +1 -0
- package/lib/dts/src/primitives/_selectable/selectable.d.ts +1 -2
- package/lib/dts/src/primitives/_selectable/selectable.d.ts.map +1 -1
- package/lib/dts/src/primitives/avatar/avatar.d.ts.map +1 -1
- package/lib/dts/src/primitives/avatar/avatarCounter.d.ts +1 -0
- package/lib/dts/src/primitives/avatar/avatarCounter.d.ts.map +1 -1
- package/lib/dts/src/primitives/avatar/avatarStack.d.ts +1 -0
- package/lib/dts/src/primitives/avatar/avatarStack.d.ts.map +1 -1
- package/lib/dts/src/primitives/avatar/styles.d.ts.map +1 -1
- package/lib/dts/src/primitives/badge/badge.d.ts.map +1 -1
- package/lib/dts/src/primitives/box/box.d.ts.map +1 -1
- package/lib/dts/src/primitives/button/button.d.ts.map +1 -1
- package/lib/dts/src/primitives/card/card.d.ts.map +1 -1
- package/lib/dts/src/primitives/code/code.d.ts.map +1 -1
- package/lib/dts/src/primitives/container/container.d.ts.map +1 -1
- package/lib/dts/src/primitives/container/styles.d.ts.map +1 -1
- package/lib/dts/src/primitives/container/types.d.ts +1 -1
- package/lib/dts/src/primitives/container/types.d.ts.map +1 -1
- package/lib/dts/src/primitives/flex/flex.d.ts.map +1 -1
- package/lib/dts/src/primitives/grid/grid.d.ts.map +1 -1
- package/lib/dts/src/primitives/heading/heading.d.ts.map +1 -1
- package/lib/dts/src/primitives/inline/inline.d.ts.map +1 -1
- package/lib/dts/src/primitives/inline/styles.d.ts.map +1 -1
- package/lib/dts/src/primitives/inline/types.d.ts +1 -1
- package/lib/dts/src/primitives/inline/types.d.ts.map +1 -1
- package/lib/dts/src/primitives/kbd/kbd.d.ts.map +1 -1
- package/lib/dts/src/primitives/label/label.d.ts.map +1 -1
- package/lib/dts/src/primitives/popover/popover.d.ts +6 -5
- package/lib/dts/src/primitives/popover/popover.d.ts.map +1 -1
- package/lib/dts/src/primitives/popover/{arrow.d.ts → popoverArrow.d.ts} +1 -1
- package/lib/dts/src/primitives/popover/popoverArrow.d.ts.map +1 -0
- package/lib/dts/src/primitives/popover/popoverCard.d.ts +33 -0
- package/lib/dts/src/primitives/popover/popoverCard.d.ts.map +1 -0
- package/lib/dts/src/primitives/select/styles.d.ts +5 -1
- package/lib/dts/src/primitives/select/styles.d.ts.map +1 -1
- package/lib/dts/src/primitives/stack/stack.d.ts.map +1 -1
- package/lib/dts/src/primitives/stack/styles.d.ts +1 -1
- package/lib/dts/src/primitives/stack/styles.d.ts.map +1 -1
- package/lib/dts/src/primitives/text/text.d.ts.map +1 -1
- package/lib/dts/src/primitives/textArea/textArea.d.ts.map +1 -1
- package/lib/dts/src/primitives/textInput/textInput.d.ts.map +1 -1
- package/lib/dts/src/primitives/tooltip/tooltip.d.ts +2 -0
- package/lib/dts/src/primitives/tooltip/tooltip.d.ts.map +1 -1
- package/lib/dts/src/primitives/tooltip/tooltipArrow.d.ts.map +1 -1
- package/lib/dts/src/primitives/types.d.ts +1 -1
- package/lib/dts/src/primitives/types.d.ts.map +1 -1
- package/lib/dts/src/styles/border/types.d.ts +5 -5
- package/lib/dts/src/styles/border/types.d.ts.map +1 -1
- package/lib/dts/src/styles/box/types.d.ts +4 -4
- package/lib/dts/src/styles/box/types.d.ts.map +1 -1
- package/lib/dts/src/styles/flex/flexItemStyle.d.ts.map +1 -1
- package/lib/dts/src/styles/flex/types.d.ts +6 -6
- package/lib/dts/src/styles/flex/types.d.ts.map +1 -1
- package/lib/dts/src/styles/font/responsiveFont.d.ts +1 -1
- package/lib/dts/src/styles/font/responsiveFont.d.ts.map +1 -1
- package/lib/dts/src/styles/font/types.d.ts +3 -3
- package/lib/dts/src/styles/font/types.d.ts.map +1 -1
- package/lib/dts/src/styles/grid/types.d.ts +14 -14
- package/lib/dts/src/styles/grid/types.d.ts.map +1 -1
- package/lib/dts/src/styles/helpers.d.ts +4 -4
- package/lib/dts/src/styles/helpers.d.ts.map +1 -1
- package/lib/dts/src/styles/input/responsiveInputPaddingStyle.d.ts +12 -12
- package/lib/dts/src/styles/input/responsiveInputPaddingStyle.d.ts.map +1 -1
- package/lib/dts/src/styles/input/textInputStyle.d.ts +4 -1
- package/lib/dts/src/styles/input/textInputStyle.d.ts.map +1 -1
- package/lib/dts/src/styles/margin/types.d.ts +7 -7
- package/lib/dts/src/styles/margin/types.d.ts.map +1 -1
- package/lib/dts/src/styles/padding/types.d.ts +7 -7
- package/lib/dts/src/styles/padding/types.d.ts.map +1 -1
- package/lib/dts/src/styles/radius/types.d.ts +1 -1
- package/lib/dts/src/styles/radius/types.d.ts.map +1 -1
- package/lib/dts/src/styles/shadow/shadowStyle.d.ts.map +1 -1
- package/lib/dts/src/styles/shadow/types.d.ts +1 -1
- package/lib/dts/src/styles/shadow/types.d.ts.map +1 -1
- package/lib/dts/src/theme/lib/theme/fonts.d.ts +1 -3
- package/lib/dts/src/theme/lib/theme/fonts.d.ts.map +1 -1
- package/lib/dts/src/theme/studioTheme/fonts.d.ts.map +1 -1
- package/lib/dts/src/types/index.d.ts +2 -1
- package/lib/dts/src/types/index.d.ts.map +1 -1
- package/lib/dts/src/types/placement.d.ts +7 -0
- package/lib/dts/src/types/placement.d.ts.map +1 -0
- package/lib/dts/src/types/text.d.ts +5 -0
- package/lib/dts/src/types/text.d.ts.map +1 -0
- package/lib/dts/src/utils/elementQuery/elementQuery.d.ts.map +1 -1
- package/lib/dts/src/utils/index.d.ts +0 -1
- package/lib/dts/src/utils/index.d.ts.map +1 -1
- package/lib/dts/src/utils/virtualList/virtualList.d.ts.map +1 -1
- package/lib/sanity-ui.js +1214 -1054
- package/lib/sanity-ui.js.map +1 -1
- package/lib/{sanity-ui.modern.js → sanity-ui.modern.mjs} +1246 -1120
- package/lib/sanity-ui.modern.mjs.map +1 -0
- package/lib/sanity-ui.module.js +1106 -947
- package/lib/sanity-ui.module.js.map +1 -1
- package/package.json +10 -11
- package/src/__workshop__/color/overview.tsx +9 -11
- package/src/components/autocomplete/__workshop__/async.tsx +14 -12
- package/src/components/autocomplete/__workshop__/constrainedHeight.tsx +36 -0
- package/src/components/autocomplete/autocomplete.styles.tsx +0 -6
- package/src/components/autocomplete/autocomplete.tsx +14 -7
- package/src/components/autocomplete/constants.ts +3 -8
- package/src/components/breadcrumbs/breadcrumbs.tsx +3 -2
- package/src/components/dialog/dialog.tsx +17 -9
- package/src/components/dialog/styles.ts +3 -3
- package/src/components/hotkeys/hotkeys.tsx +3 -1
- package/src/components/menu/__workshop__/constrainedInBoundary.tsx +11 -14
- package/src/components/menu/__workshop__/groups.tsx +1 -1
- package/src/components/menu/menuButton.tsx +21 -13
- package/src/components/menu/menuGroup.tsx +3 -2
- package/src/components/menu/menuItem.tsx +4 -5
- package/src/components/skeleton/skeleton.tsx +10 -1
- package/src/components/skeleton/textSkeleton.tsx +7 -7
- package/src/constants.ts +17 -0
- package/src/hooks/_internal/useUnique.ts +4 -5
- package/src/hooks/index.ts +2 -1
- package/src/hooks/useArrayProp.ts +23 -0
- package/src/hooks/useElementRect/useElementRect.ts +4 -16
- package/src/hooks/useElementSize.ts +18 -0
- package/src/index.ts +1 -0
- package/src/observers/elementSizeObserver.ts +116 -0
- package/src/observers/index.ts +2 -0
- package/src/{utils → observers}/resizeObserver.ts +1 -4
- package/src/primitives/_selectable/selectable.tsx +5 -4
- package/src/primitives/avatar/avatar.tsx +7 -5
- package/src/primitives/avatar/avatarCounter.tsx +14 -12
- package/src/primitives/avatar/avatarStack.tsx +19 -13
- package/src/primitives/avatar/styles.ts +2 -2
- package/src/primitives/badge/badge.tsx +3 -2
- package/src/primitives/box/box.tsx +27 -26
- package/src/primitives/button/button.tsx +22 -10
- package/src/primitives/card/card.tsx +13 -11
- package/src/primitives/checkbox/__workshop__/example.tsx +4 -2
- package/src/primitives/checkbox/__workshop__/props.tsx +4 -2
- package/src/primitives/checkbox/__workshop__/readOnly.tsx +4 -2
- package/src/primitives/code/__workshop__/props.tsx +1 -1
- package/src/primitives/code/code.tsx +2 -1
- package/src/primitives/container/container.tsx +10 -1
- package/src/primitives/container/styles.ts +2 -2
- package/src/primitives/container/types.ts +1 -1
- package/src/primitives/flex/flex.tsx +6 -5
- package/src/primitives/grid/__workshop__/responsive.tsx +13 -12
- package/src/primitives/grid/grid.tsx +9 -8
- package/src/primitives/heading/__workshop__/opticalAlignment.tsx +19 -7
- package/src/primitives/heading/heading.tsx +3 -2
- package/src/primitives/inline/inline.tsx +12 -6
- package/src/primitives/inline/styles.ts +2 -2
- package/src/primitives/inline/types.ts +1 -1
- package/src/primitives/kbd/kbd.tsx +2 -1
- package/src/primitives/label/label.tsx +4 -3
- package/src/primitives/popover/__workshop__/{margins.tsx → MarginsStory.tsx} +1 -1
- package/src/primitives/popover/__workshop__/{matchReferenceWidth.tsx → MatchReferenceWidthStory.tsx} +0 -0
- package/src/primitives/popover/__workshop__/{plain.tsx → PlainStory.tsx} +13 -14
- package/src/primitives/popover/__workshop__/{recursive.tsx → RecursiveStory.tsx} +4 -1
- package/src/primitives/popover/__workshop__/RightAlignedStory.tsx +61 -0
- package/src/primitives/popover/__workshop__/TestStory.tsx +80 -0
- package/src/primitives/popover/__workshop__/index.ts +10 -5
- package/src/primitives/popover/popover.tsx +245 -193
- package/src/primitives/popover/{arrow.tsx → popoverArrow.tsx} +5 -5
- package/src/primitives/popover/popoverCard.tsx +160 -0
- package/src/primitives/select/select.tsx +9 -9
- package/src/primitives/select/styles.ts +10 -4
- package/src/primitives/stack/stack.tsx +2 -1
- package/src/primitives/stack/styles.ts +3 -3
- package/src/primitives/text/__workshop__/opticalAlignment.tsx +15 -5
- package/src/primitives/text/text.tsx +3 -2
- package/src/primitives/textArea/__workshop__/plain.tsx +23 -18
- package/src/primitives/textArea/textArea.tsx +17 -5
- package/src/primitives/textInput/__workshop__/clearButton.tsx +14 -8
- package/src/primitives/textInput/__workshop__/index.ts +2 -2
- package/src/primitives/textInput/__workshop__/plain.tsx +39 -32
- package/src/primitives/textInput/__workshop__/tones.tsx +97 -75
- package/src/primitives/textInput/__workshop__/typed.tsx +8 -2
- package/src/primitives/textInput/textInput.tsx +43 -12
- package/src/primitives/tooltip/__workshop__/props.tsx +7 -1
- package/src/primitives/tooltip/tooltip.tsx +162 -85
- package/src/primitives/tooltip/tooltipArrow.tsx +25 -10
- package/src/primitives/types.ts +1 -1
- package/src/styles/border/borderStyle.ts +6 -6
- package/src/styles/border/types.ts +5 -5
- package/src/styles/box/boxStyle.ts +5 -5
- package/src/styles/box/types.ts +4 -4
- package/src/styles/flex/flexItemStyle.ts +5 -4
- package/src/styles/flex/flexStyle.ts +6 -6
- package/src/styles/flex/types.ts +6 -6
- package/src/styles/font/responsiveFont.ts +7 -27
- package/src/styles/font/textAlignStyle.ts +2 -2
- package/src/styles/font/types.ts +4 -3
- package/src/styles/grid/gridItemStyle.ts +7 -7
- package/src/styles/grid/gridStyle.ts +9 -9
- package/src/styles/grid/types.ts +14 -14
- package/src/styles/helpers.ts +9 -9
- package/src/styles/input/responsiveInputPaddingStyle.ts +24 -27
- package/src/styles/input/textInputStyle.ts +89 -79
- package/src/styles/margin/marginStyle.ts +8 -8
- package/src/styles/margin/marginsStyle.test.ts +1 -1
- package/src/styles/margin/types.ts +7 -7
- package/src/styles/padding/paddingStyle.test.ts +1 -1
- package/src/styles/padding/paddingStyle.ts +8 -8
- package/src/styles/padding/types.ts +7 -7
- package/src/styles/radius/radiusStyle.ts +2 -2
- package/src/styles/radius/types.ts +1 -1
- package/src/styles/shadow/shadowStyle.ts +2 -5
- package/src/styles/shadow/types.ts +1 -1
- package/src/theme/lib/theme/fonts.ts +1 -3
- package/src/theme/studioTheme/fonts.ts +5 -9
- package/src/types/index.ts +2 -2
- package/src/types/placement.ts +18 -0
- package/src/types/text.ts +4 -0
- package/src/utils/elementQuery/elementQuery.tsx +5 -18
- package/src/utils/index.ts +0 -1
- package/src/utils/layer/layer.tsx +1 -1
- package/src/utils/layer/layerProvider.tsx +2 -2
- package/src/utils/virtualList/virtualList.tsx +8 -7
- package/lib/dts/src/hooks/useResponsiveProp.d.ts +0 -6
- package/lib/dts/src/hooks/useResponsiveProp.d.ts.map +0 -1
- package/lib/dts/src/primitives/popover/arrow.d.ts.map +0 -1
- package/lib/dts/src/primitives/popover/modifiers/getPopoverModifiers.d.ts +0 -4
- package/lib/dts/src/primitives/popover/modifiers/getPopoverModifiers.d.ts.map +0 -1
- package/lib/dts/src/primitives/popover/modifiers/index.d.ts +0 -2
- package/lib/dts/src/primitives/popover/modifiers/index.d.ts.map +0 -1
- package/lib/dts/src/primitives/popover/modifiers/types.d.ts +0 -18
- package/lib/dts/src/primitives/popover/modifiers/types.d.ts.map +0 -1
- package/lib/dts/src/primitives/popover/modifiers/usePopoverModifiers.d.ts +0 -4
- package/lib/dts/src/primitives/popover/modifiers/usePopoverModifiers.d.ts.map +0 -1
- package/lib/dts/src/types/common.d.ts +0 -11
- package/lib/dts/src/types/common.d.ts.map +0 -1
- package/lib/dts/src/utils/resizeObserver.d.ts +0 -6
- package/lib/dts/src/utils/resizeObserver.d.ts.map +0 -1
- package/lib/sanity-ui.modern.js.map +0 -1
- package/src/hooks/useResponsiveProp.ts +0 -10
- package/src/primitives/popover/__workshop__/rightAligned.tsx +0 -57
- package/src/primitives/popover/modifiers/getPopoverModifiers.ts +0 -137
- package/src/primitives/popover/modifiers/index.ts +0 -1
- package/src/primitives/popover/modifiers/types.ts +0 -18
- package/src/primitives/popover/modifiers/usePopoverModifiers.ts +0 -58
- package/src/types/common.ts +0 -12
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { useId } from '@reach/auto-id';
|
|
2
|
-
import React, { useState, useRef, useEffect, createContext, useContext,
|
|
2
|
+
import React, { useMemo, useState, useRef, useEffect, createContext, useContext, useLayoutEffect, forwardRef, useCallback, cloneElement, isValidElement, createElement, memo, useReducer, Children, Fragment } from 'react';
|
|
3
3
|
import ReactIs, { isElement, isFragment, isValidElementType } from 'react-is';
|
|
4
4
|
import styled, { ThemeProvider as ThemeProvider$1, useTheme as useTheme$1, css, keyframes } from 'styled-components';
|
|
5
|
+
import { ResizeObserver } from '@juggle/resize-observer';
|
|
5
6
|
import { white as white$1, black as black$1, hues } from '@sanity/color';
|
|
6
7
|
import { SpinnerIcon, CheckmarkIcon, RemoveIcon, SelectIcon, CloseIcon, ChevronDownIcon, ChevronRightIcon, ToggleArrowRightIcon } from '@sanity/icons';
|
|
7
8
|
import Refractor from 'react-refractor';
|
|
8
|
-
import {
|
|
9
|
-
import { ResizeObserver as ResizeObserver$1 } from '@juggle/resize-observer';
|
|
9
|
+
import { flip, size as size$1, offset, shift, arrow, useFloating, autoUpdate } from '@floating-ui/react-dom';
|
|
10
10
|
import ReactDOM from 'react-dom';
|
|
11
|
-
import maxSizeModifier from 'popper-max-size-modifier';
|
|
12
11
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
13
12
|
|
|
14
13
|
function _extends() {
|
|
@@ -44,8 +43,232 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
44
43
|
return target;
|
|
45
44
|
}
|
|
46
45
|
|
|
46
|
+
/**
|
|
47
|
+
* @internal
|
|
48
|
+
*/
|
|
47
49
|
const EMPTY_ARRAY = [];
|
|
48
|
-
|
|
50
|
+
/**
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
const EMPTY_RECORD = {};
|
|
55
|
+
/**
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
|
|
59
|
+
const FLOATING_STATIC_SIDES = {
|
|
60
|
+
top: 'bottom',
|
|
61
|
+
right: 'left',
|
|
62
|
+
bottom: 'top',
|
|
63
|
+
left: 'right'
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @internal
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
function _fillCSSObject(keys, value) {
|
|
71
|
+
return keys.reduce((style, key) => {
|
|
72
|
+
style[key] = value;
|
|
73
|
+
return style;
|
|
74
|
+
}, {});
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* @public
|
|
78
|
+
*/
|
|
79
|
+
|
|
80
|
+
function rem(pixelValue) {
|
|
81
|
+
if (pixelValue === 0) return 0;
|
|
82
|
+
return `${pixelValue / 16}rem`;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
|
|
88
|
+
function _responsive(media, values, callback) {
|
|
89
|
+
const statements = values.map(callback);
|
|
90
|
+
return statements.map((statement, mediaIndex) => {
|
|
91
|
+
if (mediaIndex === 0) return statement;
|
|
92
|
+
return {
|
|
93
|
+
[`@media screen and (min-width: ${media[mediaIndex - 1]}px)`]: statement
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* @internal
|
|
99
|
+
*/
|
|
100
|
+
|
|
101
|
+
function _getArrayProp(val, defaultVal) {
|
|
102
|
+
if (val === undefined) return defaultVal || EMPTY_ARRAY;
|
|
103
|
+
return Array.isArray(val) ? val : [val];
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* @internal
|
|
107
|
+
*/
|
|
108
|
+
|
|
109
|
+
function _getResponsiveSpace(theme, props, spaceIndexes = EMPTY_ARRAY) {
|
|
110
|
+
if (!Array.isArray(spaceIndexes)) {
|
|
111
|
+
throw new Error('the property must be array of numbers');
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
if (spaceIndexes.length === 0) {
|
|
115
|
+
return null;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return _responsive(theme.sanity.media, spaceIndexes, spaceIndex => _fillCSSObject(props, rem(theme.sanity.space[spaceIndex])));
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* A utility function getting responsive font styles.
|
|
123
|
+
* @internal
|
|
124
|
+
*/
|
|
125
|
+
|
|
126
|
+
function responsiveFont(fontKey, props) {
|
|
127
|
+
const {
|
|
128
|
+
$size,
|
|
129
|
+
$weight,
|
|
130
|
+
theme
|
|
131
|
+
} = props;
|
|
132
|
+
const {
|
|
133
|
+
fonts,
|
|
134
|
+
media
|
|
135
|
+
} = theme.sanity;
|
|
136
|
+
const {
|
|
137
|
+
family,
|
|
138
|
+
sizes,
|
|
139
|
+
weights
|
|
140
|
+
} = fonts[fontKey];
|
|
141
|
+
const fontWeight = $weight && weights[$weight] || weights.regular; // @todo: make this configurable
|
|
142
|
+
|
|
143
|
+
const defaultSize = sizes[2];
|
|
144
|
+
const base = {
|
|
145
|
+
position: 'relative',
|
|
146
|
+
fontFamily: family,
|
|
147
|
+
fontWeight,
|
|
148
|
+
padding: '1px 0',
|
|
149
|
+
margin: 0,
|
|
150
|
+
'&:before': {
|
|
151
|
+
content: '""',
|
|
152
|
+
display: 'block',
|
|
153
|
+
height: 0
|
|
154
|
+
},
|
|
155
|
+
'&:after': {
|
|
156
|
+
content: '""',
|
|
157
|
+
display: 'block',
|
|
158
|
+
height: 0
|
|
159
|
+
},
|
|
160
|
+
'& > code, & > span': {
|
|
161
|
+
display: 'block'
|
|
162
|
+
},
|
|
163
|
+
'&:not([hidden])': {
|
|
164
|
+
display: 'block'
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
const resp = _responsive(media, $size, sizeIndex => fontSize(sizes[sizeIndex] || defaultSize));
|
|
169
|
+
|
|
170
|
+
return [base, ...resp];
|
|
171
|
+
}
|
|
172
|
+
function fontSize(size) {
|
|
173
|
+
const {
|
|
174
|
+
ascenderHeight,
|
|
175
|
+
descenderHeight,
|
|
176
|
+
fontSize,
|
|
177
|
+
iconSize,
|
|
178
|
+
letterSpacing,
|
|
179
|
+
lineHeight
|
|
180
|
+
} = size;
|
|
181
|
+
const negHeight = ascenderHeight + descenderHeight;
|
|
182
|
+
const capHeight = lineHeight - negHeight;
|
|
183
|
+
const iconOffset = (capHeight - iconSize) / 2;
|
|
184
|
+
const customIconSize = Math.floor(fontSize * 1.125 / 2) * 2 + 1;
|
|
185
|
+
const customIconOffset = (capHeight - customIconSize) / 2;
|
|
186
|
+
return {
|
|
187
|
+
fontSize: rem(fontSize),
|
|
188
|
+
lineHeight: `calc(${lineHeight} / ${fontSize})`,
|
|
189
|
+
letterSpacing: rem(letterSpacing),
|
|
190
|
+
transform: `translateY(${rem(descenderHeight)})`,
|
|
191
|
+
'&:before': {
|
|
192
|
+
marginTop: `calc(${rem(0 - negHeight)} - 1px)`
|
|
193
|
+
},
|
|
194
|
+
'&:after': {
|
|
195
|
+
marginBottom: '-1px'
|
|
196
|
+
},
|
|
197
|
+
'& svg:not([data-sanity-icon])': {
|
|
198
|
+
fontSize: `calc(${customIconSize} / 16 * 1rem)`,
|
|
199
|
+
margin: rem(customIconOffset)
|
|
200
|
+
},
|
|
201
|
+
'& [data-sanity-icon]': {
|
|
202
|
+
fontSize: `calc(${iconSize} / 16 * 1rem)`,
|
|
203
|
+
margin: rem(iconOffset)
|
|
204
|
+
}
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Get responsive CSS for the `code` font style.
|
|
210
|
+
* @internal
|
|
211
|
+
*/
|
|
212
|
+
|
|
213
|
+
function responsiveCodeFontStyle(props) {
|
|
214
|
+
return responsiveFont('code', props);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Get responsive CSS for the `heading` font style.
|
|
219
|
+
* @internal
|
|
220
|
+
*/
|
|
221
|
+
|
|
222
|
+
function responsiveHeadingFont(props) {
|
|
223
|
+
return responsiveFont('heading', props);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Get responsive CSS for the `label` font style.
|
|
228
|
+
* @internal
|
|
229
|
+
*/
|
|
230
|
+
|
|
231
|
+
function responsiveLabelFont(props) {
|
|
232
|
+
return responsiveFont('label', props);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Get responsive text align styles.
|
|
237
|
+
* @internal
|
|
238
|
+
*/
|
|
239
|
+
|
|
240
|
+
function responsiveTextAlignStyle(props) {
|
|
241
|
+
const {
|
|
242
|
+
theme
|
|
243
|
+
} = props;
|
|
244
|
+
return _responsive(theme.sanity.media, props.$align, textAlign => {
|
|
245
|
+
return {
|
|
246
|
+
textAlign
|
|
247
|
+
};
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Get responsive CSS for the `text` font style.
|
|
253
|
+
* @internal
|
|
254
|
+
*/
|
|
255
|
+
|
|
256
|
+
function responsiveTextFont(props) {
|
|
257
|
+
return responsiveFont('text', props);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* This API might change. DO NOT USE IN PRODUCTION.
|
|
262
|
+
* @beta
|
|
263
|
+
*/
|
|
264
|
+
|
|
265
|
+
function useArrayProp(val, defaultVal) {
|
|
266
|
+
const __perf_hash__ = JSON.stringify(val != null ? val : defaultVal);
|
|
267
|
+
|
|
268
|
+
return useMemo(() => _getArrayProp(val, defaultVal), // Improve performance: Keep object identify for a given hash of the value
|
|
269
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
270
|
+
[__perf_hash__]);
|
|
271
|
+
}
|
|
49
272
|
|
|
50
273
|
function _getElements(element, elementsArg) {
|
|
51
274
|
const ret = [element];
|
|
@@ -128,21 +351,107 @@ function useClickOutside(listener, elementsArg = EMPTY_ARRAY, boundaryElement) {
|
|
|
128
351
|
}
|
|
129
352
|
|
|
130
353
|
/**
|
|
131
|
-
*
|
|
354
|
+
* @internal
|
|
355
|
+
*/
|
|
356
|
+
|
|
357
|
+
const _ResizeObserver = typeof window !== 'undefined' && window.ResizeObserver ? window.ResizeObserver : ResizeObserver;
|
|
358
|
+
|
|
359
|
+
// NOTE: this should NOT have size effects
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* @internal
|
|
363
|
+
*/
|
|
364
|
+
|
|
365
|
+
const _elementSizeObserver = _createElementSizeObserver();
|
|
366
|
+
|
|
367
|
+
function _createElementRectValueListener() {
|
|
368
|
+
return {
|
|
369
|
+
subscribe(element, subscriber) {
|
|
370
|
+
const resizeObserver = new _ResizeObserver(([entry]) => {
|
|
371
|
+
subscriber({
|
|
372
|
+
_contentRect: entry.contentRect,
|
|
373
|
+
border: {
|
|
374
|
+
width: entry.borderBoxSize[0].inlineSize,
|
|
375
|
+
height: entry.borderBoxSize[0].blockSize
|
|
376
|
+
},
|
|
377
|
+
content: {
|
|
378
|
+
width: entry.contentRect.width,
|
|
379
|
+
height: entry.contentRect.height
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
});
|
|
383
|
+
resizeObserver.observe(element);
|
|
384
|
+
return () => {
|
|
385
|
+
resizeObserver.unobserve(element);
|
|
386
|
+
resizeObserver.disconnect();
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
function _createElementSizeObserver() {
|
|
394
|
+
const disposeCache = new WeakMap();
|
|
395
|
+
const subscribersCache = new WeakMap();
|
|
396
|
+
return {
|
|
397
|
+
subscribe(element, subscriber) {
|
|
398
|
+
const subscribers = subscribersCache.get(element) || [];
|
|
399
|
+
let dispose = disposeCache.get(element);
|
|
400
|
+
|
|
401
|
+
if (!subscribersCache.has(element)) {
|
|
402
|
+
subscribersCache.set(element, subscribers);
|
|
403
|
+
|
|
404
|
+
const listener = _createElementRectValueListener(); // listen
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
dispose = listener.subscribe(element, elementRect => {
|
|
408
|
+
for (const sub of subscribers) {
|
|
409
|
+
sub(elementRect);
|
|
410
|
+
}
|
|
411
|
+
});
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
subscribers.push(subscriber);
|
|
415
|
+
return () => {
|
|
416
|
+
// dispose
|
|
417
|
+
const idx = subscribers.indexOf(subscriber);
|
|
418
|
+
|
|
419
|
+
if (idx > -1) {
|
|
420
|
+
subscribers.splice(idx, 1);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
if (subscribers.length === 0) {
|
|
424
|
+
// unlisten
|
|
425
|
+
if (dispose) dispose();
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
/**
|
|
434
|
+
* Subscribe to the size of a DOM element.
|
|
132
435
|
* @beta
|
|
133
436
|
*/
|
|
134
437
|
|
|
135
|
-
function
|
|
136
|
-
const [
|
|
438
|
+
function useElementSize(element) {
|
|
439
|
+
const [size, setSize] = useState(null);
|
|
137
440
|
useEffect(() => {
|
|
138
441
|
if (!element) return undefined;
|
|
139
|
-
|
|
140
|
-
setRect(entries[0].contentRect);
|
|
141
|
-
});
|
|
142
|
-
ro.observe(element);
|
|
143
|
-
return () => ro.disconnect();
|
|
442
|
+
return _elementSizeObserver.subscribe(element, setSize);
|
|
144
443
|
}, [element]);
|
|
145
|
-
return
|
|
444
|
+
return size;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Subscribe to the rect of a DOM element.
|
|
449
|
+
* @deprecated Use `useElementSize` instead
|
|
450
|
+
*/
|
|
451
|
+
|
|
452
|
+
function useElementRect(element) {
|
|
453
|
+
const elementSize = useElementSize(element);
|
|
454
|
+
return (elementSize == null ? void 0 : elementSize._contentRect) || null;
|
|
146
455
|
}
|
|
147
456
|
|
|
148
457
|
/**
|
|
@@ -2233,8 +2542,7 @@ const color = createColorTheme({
|
|
|
2233
2542
|
|
|
2234
2543
|
const fonts = {
|
|
2235
2544
|
code: {
|
|
2236
|
-
family: '
|
|
2237
|
-
horizontalOffset: 0.075,
|
|
2545
|
+
family: 'ui-monospace, SFMono-Regular, SF Mono, Menlo, Consolas, Liberation Mono, monospace',
|
|
2238
2546
|
weights: {
|
|
2239
2547
|
regular: 400,
|
|
2240
2548
|
medium: 500,
|
|
@@ -2280,7 +2588,6 @@ const fonts = {
|
|
|
2280
2588
|
},
|
|
2281
2589
|
heading: {
|
|
2282
2590
|
family: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',
|
|
2283
|
-
horizontalOffset: 0.075,
|
|
2284
2591
|
weights: {
|
|
2285
2592
|
regular: 700,
|
|
2286
2593
|
medium: 800,
|
|
@@ -2316,15 +2623,15 @@ const fonts = {
|
|
|
2316
2623
|
lineHeight: 33,
|
|
2317
2624
|
letterSpacing: 0
|
|
2318
2625
|
}, {
|
|
2319
|
-
ascenderHeight:
|
|
2320
|
-
descenderHeight:
|
|
2626
|
+
ascenderHeight: 8,
|
|
2627
|
+
descenderHeight: 8,
|
|
2321
2628
|
fontSize: 33,
|
|
2322
2629
|
iconSize: 49,
|
|
2323
2630
|
lineHeight: 39,
|
|
2324
2631
|
letterSpacing: 0
|
|
2325
2632
|
}, {
|
|
2326
|
-
ascenderHeight:
|
|
2327
|
-
descenderHeight:
|
|
2633
|
+
ascenderHeight: 9,
|
|
2634
|
+
descenderHeight: 9,
|
|
2328
2635
|
fontSize: 38,
|
|
2329
2636
|
iconSize: 53,
|
|
2330
2637
|
lineHeight: 45,
|
|
@@ -2333,7 +2640,6 @@ const fonts = {
|
|
|
2333
2640
|
},
|
|
2334
2641
|
label: {
|
|
2335
2642
|
family: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", system-ui, sans-serif',
|
|
2336
|
-
horizontalOffset: 0.075,
|
|
2337
2643
|
weights: {
|
|
2338
2644
|
regular: 600,
|
|
2339
2645
|
medium: 700,
|
|
@@ -2379,7 +2685,6 @@ const fonts = {
|
|
|
2379
2685
|
},
|
|
2380
2686
|
text: {
|
|
2381
2687
|
family: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Liberation Sans", Helvetica, Arial, system-ui, sans-serif',
|
|
2382
|
-
horizontalOffset: 0.075,
|
|
2383
2688
|
weights: {
|
|
2384
2689
|
regular: 400,
|
|
2385
2690
|
medium: 500,
|
|
@@ -2548,7 +2853,7 @@ globalScope[key$7] = globalScope[key$7] || /*#__PURE__*/createContext(null);
|
|
|
2548
2853
|
|
|
2549
2854
|
const ThemeContext = globalScope[key$7];
|
|
2550
2855
|
|
|
2551
|
-
const _excluded$
|
|
2856
|
+
const _excluded$I = ["color", "layer"];
|
|
2552
2857
|
/**
|
|
2553
2858
|
* @public
|
|
2554
2859
|
*/
|
|
@@ -2568,7 +2873,7 @@ function ThemeProvider(props) {
|
|
|
2568
2873
|
color: rootColor,
|
|
2569
2874
|
layer: rootLayer
|
|
2570
2875
|
} = themeProp,
|
|
2571
|
-
restTheme = _objectWithoutPropertiesLoose(themeProp, _excluded$
|
|
2876
|
+
restTheme = _objectWithoutPropertiesLoose(themeProp, _excluded$I);
|
|
2572
2877
|
|
|
2573
2878
|
const colorScheme = rootColor[scheme] || rootColor.light;
|
|
2574
2879
|
const color = colorScheme[tone] || colorScheme.default;
|
|
@@ -2785,245 +3090,36 @@ function usePrefersDark() {
|
|
|
2785
3090
|
* @beta
|
|
2786
3091
|
*/
|
|
2787
3092
|
|
|
2788
|
-
const useIsomorphicEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
2789
|
-
|
|
2790
|
-
/**
|
|
2791
|
-
* @beta
|
|
2792
|
-
*/
|
|
2793
|
-
|
|
2794
|
-
function useForwardedRef(ref) {
|
|
2795
|
-
const innerRef = useRef(null);
|
|
2796
|
-
useIsomorphicEffect(() => {
|
|
2797
|
-
if (!ref) return;
|
|
2798
|
-
|
|
2799
|
-
if (typeof ref === 'function') {
|
|
2800
|
-
ref(innerRef.current);
|
|
2801
|
-
} else {
|
|
2802
|
-
ref.current = innerRef.current;
|
|
2803
|
-
}
|
|
2804
|
-
});
|
|
2805
|
-
return innerRef;
|
|
2806
|
-
}
|
|
2807
|
-
|
|
2808
|
-
/**
|
|
2809
|
-
* @beta
|
|
2810
|
-
*/
|
|
2811
|
-
|
|
2812
|
-
function useCustomValidity(ref, customValidity) {
|
|
2813
|
-
useEffect(() => {
|
|
2814
|
-
if (ref.current) {
|
|
2815
|
-
ref.current.setCustomValidity(customValidity || '');
|
|
2816
|
-
}
|
|
2817
|
-
}, [customValidity, ref]);
|
|
2818
|
-
}
|
|
2819
|
-
|
|
2820
|
-
/**
|
|
2821
|
-
* @internal
|
|
2822
|
-
*/
|
|
2823
|
-
|
|
2824
|
-
function fillCSSObject(propKeys, value) {
|
|
2825
|
-
return propKeys.reduce((obj, propKey) => {
|
|
2826
|
-
obj[propKey] = value;
|
|
2827
|
-
return obj;
|
|
2828
|
-
}, {});
|
|
2829
|
-
}
|
|
2830
|
-
/**
|
|
2831
|
-
* @public
|
|
2832
|
-
*/
|
|
2833
|
-
|
|
2834
|
-
function rem(pixelValue) {
|
|
2835
|
-
if (pixelValue === 0) return 0;
|
|
2836
|
-
return `${pixelValue / 16}rem`;
|
|
2837
|
-
}
|
|
2838
|
-
/**
|
|
2839
|
-
* @internal
|
|
2840
|
-
*/
|
|
2841
|
-
|
|
2842
|
-
function responsive(media, values, callback) {
|
|
2843
|
-
const statements = values.map(callback);
|
|
2844
|
-
return statements.map((statement, mediaIndex) => {
|
|
2845
|
-
if (mediaIndex === 0) return statement;
|
|
2846
|
-
return {
|
|
2847
|
-
[`@media screen and (min-width: ${media[mediaIndex - 1]}px)`]: statement
|
|
2848
|
-
};
|
|
2849
|
-
});
|
|
2850
|
-
}
|
|
2851
|
-
/**
|
|
2852
|
-
* @internal
|
|
2853
|
-
*/
|
|
2854
|
-
|
|
2855
|
-
function getResponsiveProp(val, defaultVal) {
|
|
2856
|
-
if (val === undefined) return defaultVal || EMPTY_ARRAY;
|
|
2857
|
-
return Array.isArray(val) ? val : [val];
|
|
2858
|
-
}
|
|
2859
|
-
/**
|
|
2860
|
-
* @internal
|
|
2861
|
-
*/
|
|
2862
|
-
|
|
2863
|
-
function getResponsiveSpace(theme, props, spaceIndexes = EMPTY_ARRAY) {
|
|
2864
|
-
if (!Array.isArray(spaceIndexes)) {
|
|
2865
|
-
throw new Error('the property must be array of numbers');
|
|
2866
|
-
}
|
|
2867
|
-
|
|
2868
|
-
if (spaceIndexes.length === 0) {
|
|
2869
|
-
return null;
|
|
2870
|
-
}
|
|
2871
|
-
|
|
2872
|
-
return responsive(theme.sanity.media, spaceIndexes, spaceIndex => fillCSSObject(props, rem(theme.sanity.space[spaceIndex])));
|
|
2873
|
-
}
|
|
2874
|
-
|
|
2875
|
-
/**
|
|
2876
|
-
* A utility function getting responsive font styles.
|
|
2877
|
-
* @internal
|
|
2878
|
-
*/
|
|
2879
|
-
|
|
2880
|
-
function responsiveFont(fontKey, props) {
|
|
2881
|
-
const {
|
|
2882
|
-
$size,
|
|
2883
|
-
$weight,
|
|
2884
|
-
theme
|
|
2885
|
-
} = props;
|
|
2886
|
-
const {
|
|
2887
|
-
fonts,
|
|
2888
|
-
media
|
|
2889
|
-
} = theme.sanity;
|
|
2890
|
-
const {
|
|
2891
|
-
family,
|
|
2892
|
-
sizes,
|
|
2893
|
-
weights,
|
|
2894
|
-
horizontalOffset
|
|
2895
|
-
} = fonts[fontKey];
|
|
2896
|
-
const fontWeight = $weight && weights[$weight] || weights.regular; // @todo: make this configurable
|
|
2897
|
-
|
|
2898
|
-
const defaultSize = sizes[2];
|
|
2899
|
-
const base = {
|
|
2900
|
-
position: 'relative',
|
|
2901
|
-
fontFamily: family,
|
|
2902
|
-
fontWeight,
|
|
2903
|
-
padding: '1px',
|
|
2904
|
-
margin: 0,
|
|
2905
|
-
'&:before': {
|
|
2906
|
-
content: '""',
|
|
2907
|
-
display: 'block',
|
|
2908
|
-
height: 0
|
|
2909
|
-
},
|
|
2910
|
-
'&:after': {
|
|
2911
|
-
content: '""',
|
|
2912
|
-
display: 'block',
|
|
2913
|
-
height: 0
|
|
2914
|
-
},
|
|
2915
|
-
'& > code, & > span': {
|
|
2916
|
-
display: 'block'
|
|
2917
|
-
},
|
|
2918
|
-
'&:not([hidden])': {
|
|
2919
|
-
display: 'block'
|
|
2920
|
-
}
|
|
2921
|
-
};
|
|
2922
|
-
const resp = responsive(media, getResponsiveProp($size), sizeIndex => fontSize(sizes[sizeIndex] || defaultSize, horizontalOffset));
|
|
2923
|
-
return [base, ...resp];
|
|
2924
|
-
}
|
|
2925
|
-
function fontSize(size, horizontalOffset) {
|
|
2926
|
-
const {
|
|
2927
|
-
ascenderHeight,
|
|
2928
|
-
descenderHeight,
|
|
2929
|
-
fontSize,
|
|
2930
|
-
iconSize,
|
|
2931
|
-
letterSpacing,
|
|
2932
|
-
lineHeight
|
|
2933
|
-
} = size;
|
|
2934
|
-
const negHeight = ascenderHeight + descenderHeight;
|
|
2935
|
-
const capHeight = lineHeight - negHeight;
|
|
2936
|
-
const iconOffset = (capHeight - iconSize) / 2;
|
|
2937
|
-
const customIconSize = Math.floor(fontSize * 1.125 / 2) * 2 + 1;
|
|
2938
|
-
const customIconOffset = (capHeight - customIconSize) / 2;
|
|
2939
|
-
return {
|
|
2940
|
-
fontSize: rem(fontSize),
|
|
2941
|
-
lineHeight: `calc(${lineHeight} / ${fontSize})`,
|
|
2942
|
-
letterSpacing: rem(letterSpacing),
|
|
2943
|
-
transform: `translateY(${rem(descenderHeight)})`,
|
|
2944
|
-
'&:before': {
|
|
2945
|
-
marginTop: `calc(${rem(0 - negHeight)} - 1px)`
|
|
2946
|
-
},
|
|
2947
|
-
'&:after': {
|
|
2948
|
-
marginBottom: '-1px'
|
|
2949
|
-
},
|
|
2950
|
-
'& > code, & > span': {
|
|
2951
|
-
margin: horizontalOffset ? `0 calc(${rem(0 - horizontalOffset * fontSize)} - 1px)` : '0 -1px'
|
|
2952
|
-
},
|
|
2953
|
-
'& svg:not([data-sanity-icon])': {
|
|
2954
|
-
fontSize: `calc(${customIconSize} / 16 * 1rem)`,
|
|
2955
|
-
margin: [// top & bottom
|
|
2956
|
-
rem(customIconOffset), // left & right
|
|
2957
|
-
horizontalOffset ? `calc(${rem(customIconOffset)} + ${rem(horizontalOffset * fontSize)})` : rem(customIconOffset)].join(' ')
|
|
2958
|
-
},
|
|
2959
|
-
'& [data-sanity-icon]': {
|
|
2960
|
-
fontSize: `calc(${iconSize} / 16 * 1rem)`,
|
|
2961
|
-
margin: [// top & bottom
|
|
2962
|
-
rem(iconOffset), // left & right
|
|
2963
|
-
horizontalOffset ? `calc(${rem(iconOffset)} + ${rem(horizontalOffset * fontSize)})` : rem(iconOffset)].join(' ')
|
|
2964
|
-
}
|
|
2965
|
-
};
|
|
2966
|
-
}
|
|
2967
|
-
|
|
2968
|
-
/**
|
|
2969
|
-
* Get responsive CSS for the `code` font style.
|
|
2970
|
-
* @internal
|
|
2971
|
-
*/
|
|
2972
|
-
|
|
2973
|
-
function responsiveCodeFontStyle(props) {
|
|
2974
|
-
return responsiveFont('code', props);
|
|
2975
|
-
}
|
|
2976
|
-
|
|
2977
|
-
/**
|
|
2978
|
-
* Get responsive CSS for the `heading` font style.
|
|
2979
|
-
* @internal
|
|
2980
|
-
*/
|
|
2981
|
-
|
|
2982
|
-
function responsiveHeadingFont(props) {
|
|
2983
|
-
return responsiveFont('heading', props);
|
|
2984
|
-
}
|
|
2985
|
-
|
|
2986
|
-
/**
|
|
2987
|
-
* Get responsive CSS for the `label` font style.
|
|
2988
|
-
* @internal
|
|
2989
|
-
*/
|
|
2990
|
-
|
|
2991
|
-
function responsiveLabelFont(props) {
|
|
2992
|
-
return responsiveFont('label', props);
|
|
2993
|
-
}
|
|
2994
|
-
|
|
2995
|
-
/**
|
|
2996
|
-
* Get responsive text align styles.
|
|
2997
|
-
* @internal
|
|
2998
|
-
*/
|
|
2999
|
-
|
|
3000
|
-
function responsiveTextAlignStyle(props) {
|
|
3001
|
-
const {
|
|
3002
|
-
theme
|
|
3003
|
-
} = props;
|
|
3004
|
-
return responsive(theme.sanity.media, getResponsiveProp(props.$align), textAlign => {
|
|
3005
|
-
return {
|
|
3006
|
-
textAlign
|
|
3007
|
-
};
|
|
3008
|
-
});
|
|
3009
|
-
}
|
|
3010
|
-
|
|
3093
|
+
const useIsomorphicEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
3094
|
+
|
|
3011
3095
|
/**
|
|
3012
|
-
*
|
|
3013
|
-
* @internal
|
|
3096
|
+
* @beta
|
|
3014
3097
|
*/
|
|
3015
3098
|
|
|
3016
|
-
function
|
|
3017
|
-
|
|
3099
|
+
function useForwardedRef(ref) {
|
|
3100
|
+
const innerRef = useRef(null);
|
|
3101
|
+
useIsomorphicEffect(() => {
|
|
3102
|
+
if (!ref) return;
|
|
3103
|
+
|
|
3104
|
+
if (typeof ref === 'function') {
|
|
3105
|
+
ref(innerRef.current);
|
|
3106
|
+
} else {
|
|
3107
|
+
ref.current = innerRef.current;
|
|
3108
|
+
}
|
|
3109
|
+
});
|
|
3110
|
+
return innerRef;
|
|
3018
3111
|
}
|
|
3019
3112
|
|
|
3020
3113
|
/**
|
|
3021
|
-
* This API might change. DO NOT USE IN PRODUCTION.
|
|
3022
3114
|
* @beta
|
|
3023
3115
|
*/
|
|
3024
3116
|
|
|
3025
|
-
function
|
|
3026
|
-
|
|
3117
|
+
function useCustomValidity(ref, customValidity) {
|
|
3118
|
+
useEffect(() => {
|
|
3119
|
+
if (ref.current) {
|
|
3120
|
+
ref.current.setCustomValidity(customValidity || '');
|
|
3121
|
+
}
|
|
3122
|
+
}, [customValidity, ref]);
|
|
3027
3123
|
}
|
|
3028
3124
|
|
|
3029
3125
|
const BORDER_VALUE = '1px solid var(--card-border-color)';
|
|
@@ -3038,7 +3134,7 @@ function border(props) {
|
|
|
3038
3134
|
const {
|
|
3039
3135
|
media
|
|
3040
3136
|
} = theme.sanity;
|
|
3041
|
-
return
|
|
3137
|
+
return _responsive(media, props.$border, value => value ? {
|
|
3042
3138
|
'&&': {
|
|
3043
3139
|
border: BORDER_VALUE
|
|
3044
3140
|
}
|
|
@@ -3056,7 +3152,7 @@ function borderTop(props) {
|
|
|
3056
3152
|
const {
|
|
3057
3153
|
media
|
|
3058
3154
|
} = theme.sanity;
|
|
3059
|
-
return
|
|
3155
|
+
return _responsive(media, props.$borderTop, value => value ? {
|
|
3060
3156
|
'&&': {
|
|
3061
3157
|
borderTop: BORDER_VALUE
|
|
3062
3158
|
}
|
|
@@ -3074,7 +3170,7 @@ function borderRight(props) {
|
|
|
3074
3170
|
const {
|
|
3075
3171
|
media
|
|
3076
3172
|
} = theme.sanity;
|
|
3077
|
-
return
|
|
3173
|
+
return _responsive(media, props.$borderRight, value => value ? {
|
|
3078
3174
|
'&&': {
|
|
3079
3175
|
borderRight: BORDER_VALUE
|
|
3080
3176
|
}
|
|
@@ -3092,7 +3188,7 @@ function borderBottom(props) {
|
|
|
3092
3188
|
const {
|
|
3093
3189
|
media
|
|
3094
3190
|
} = theme.sanity;
|
|
3095
|
-
return
|
|
3191
|
+
return _responsive(media, props.$borderBottom, value => value ? {
|
|
3096
3192
|
'&&': {
|
|
3097
3193
|
borderBottom: BORDER_VALUE
|
|
3098
3194
|
}
|
|
@@ -3110,7 +3206,7 @@ function borderLeft(props) {
|
|
|
3110
3206
|
const {
|
|
3111
3207
|
media
|
|
3112
3208
|
} = theme.sanity;
|
|
3113
|
-
return
|
|
3209
|
+
return _responsive(media, props.$borderLeft, value => value ? {
|
|
3114
3210
|
'&&': {
|
|
3115
3211
|
borderLeft: BORDER_VALUE
|
|
3116
3212
|
}
|
|
@@ -3148,7 +3244,7 @@ function responsiveBoxDisplayStyle(props) {
|
|
|
3148
3244
|
const {
|
|
3149
3245
|
media
|
|
3150
3246
|
} = theme.sanity;
|
|
3151
|
-
return
|
|
3247
|
+
return _responsive(media, props.$display, display => ({
|
|
3152
3248
|
'&:not([hidden])': {
|
|
3153
3249
|
display
|
|
3154
3250
|
}
|
|
@@ -3162,7 +3258,7 @@ function responsiveBoxSizingStyle(props) {
|
|
|
3162
3258
|
const {
|
|
3163
3259
|
media
|
|
3164
3260
|
} = theme.sanity;
|
|
3165
|
-
return
|
|
3261
|
+
return _responsive(media, props.$sizing, sizing => ({
|
|
3166
3262
|
boxSizing: BOX_SIZING[sizing]
|
|
3167
3263
|
}));
|
|
3168
3264
|
}
|
|
@@ -3174,7 +3270,7 @@ function responsiveBoxHeightStyle(props) {
|
|
|
3174
3270
|
const {
|
|
3175
3271
|
media
|
|
3176
3272
|
} = theme.sanity;
|
|
3177
|
-
return
|
|
3273
|
+
return _responsive(media, props.$height, height => ({
|
|
3178
3274
|
height: BOX_HEIGHT[height]
|
|
3179
3275
|
}));
|
|
3180
3276
|
}
|
|
@@ -3186,7 +3282,7 @@ function responsiveBoxOverflowStyle(props) {
|
|
|
3186
3282
|
const {
|
|
3187
3283
|
media
|
|
3188
3284
|
} = theme.sanity;
|
|
3189
|
-
return
|
|
3285
|
+
return _responsive(media, props.$overflow, overflow => ({
|
|
3190
3286
|
overflow
|
|
3191
3287
|
}));
|
|
3192
3288
|
}
|
|
@@ -3206,7 +3302,7 @@ function responsiveFlexAlignStyle(props) {
|
|
|
3206
3302
|
const {
|
|
3207
3303
|
media
|
|
3208
3304
|
} = theme.sanity;
|
|
3209
|
-
return
|
|
3305
|
+
return _responsive(media, props.$align, align => {
|
|
3210
3306
|
return {
|
|
3211
3307
|
alignItems: align
|
|
3212
3308
|
};
|
|
@@ -3221,7 +3317,7 @@ function responsiveFlexGapStyle(props) {
|
|
|
3221
3317
|
media,
|
|
3222
3318
|
space
|
|
3223
3319
|
} = theme.sanity;
|
|
3224
|
-
return
|
|
3320
|
+
return _responsive(media, props.$gap, gap => ({
|
|
3225
3321
|
gap: gap ? rem(space[gap]) : undefined
|
|
3226
3322
|
}));
|
|
3227
3323
|
}
|
|
@@ -3233,7 +3329,7 @@ function responsiveFlexWrapStyle(props) {
|
|
|
3233
3329
|
const {
|
|
3234
3330
|
media
|
|
3235
3331
|
} = theme.sanity;
|
|
3236
|
-
return
|
|
3332
|
+
return _responsive(media, props.$wrap, wrap => {
|
|
3237
3333
|
return {
|
|
3238
3334
|
flexWrap: wrap
|
|
3239
3335
|
};
|
|
@@ -3246,7 +3342,7 @@ function responsiveFlexJustifyStyle(props) {
|
|
|
3246
3342
|
const {
|
|
3247
3343
|
media
|
|
3248
3344
|
} = theme.sanity;
|
|
3249
|
-
return
|
|
3345
|
+
return _responsive(media, props.$justify, justify => {
|
|
3250
3346
|
return {
|
|
3251
3347
|
justifyContent: justify
|
|
3252
3348
|
};
|
|
@@ -3259,7 +3355,7 @@ function responsiveFlexDirectionStyle(props) {
|
|
|
3259
3355
|
const {
|
|
3260
3356
|
media
|
|
3261
3357
|
} = theme.sanity;
|
|
3262
|
-
return
|
|
3358
|
+
return _responsive(media, props.$direction, direction => {
|
|
3263
3359
|
return {
|
|
3264
3360
|
flexDirection: direction
|
|
3265
3361
|
};
|
|
@@ -3280,11 +3376,10 @@ function responsiveFlexItemStyle(props) {
|
|
|
3280
3376
|
const {
|
|
3281
3377
|
media
|
|
3282
3378
|
} = theme.sanity;
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
});
|
|
3379
|
+
if (!props.$flex) return EMPTY_ARRAY;
|
|
3380
|
+
return _responsive(media, props.$flex, flex => ({
|
|
3381
|
+
flex
|
|
3382
|
+
}));
|
|
3288
3383
|
}
|
|
3289
3384
|
|
|
3290
3385
|
function focusRingBorderStyle(border) {
|
|
@@ -3333,7 +3428,7 @@ function responsiveGridAutoFlowStyle(props) {
|
|
|
3333
3428
|
const {
|
|
3334
3429
|
media
|
|
3335
3430
|
} = theme.sanity;
|
|
3336
|
-
return
|
|
3431
|
+
return _responsive(media, props.$autoFlow, autoFlow => ({
|
|
3337
3432
|
gridAutoFlow: autoFlow
|
|
3338
3433
|
}));
|
|
3339
3434
|
}
|
|
@@ -3345,7 +3440,7 @@ function responsiveGridAutoRowsStyle(props) {
|
|
|
3345
3440
|
const {
|
|
3346
3441
|
media
|
|
3347
3442
|
} = theme.sanity;
|
|
3348
|
-
return
|
|
3443
|
+
return _responsive(media, props.$autoRows, autoRows => ({
|
|
3349
3444
|
gridAutoRows: autoRows && GRID_AUTO_ROWS[autoRows]
|
|
3350
3445
|
}));
|
|
3351
3446
|
}
|
|
@@ -3357,7 +3452,7 @@ function responsiveGridAutoColsStyle(props) {
|
|
|
3357
3452
|
const {
|
|
3358
3453
|
media
|
|
3359
3454
|
} = theme.sanity;
|
|
3360
|
-
return
|
|
3455
|
+
return _responsive(media, props.$autoCols, autoCols => ({
|
|
3361
3456
|
gridAutoColumns: autoCols && GRID_AUTO_COLUMS[autoCols]
|
|
3362
3457
|
}));
|
|
3363
3458
|
}
|
|
@@ -3369,7 +3464,7 @@ function responsiveGridColumnsStyle(props) {
|
|
|
3369
3464
|
const {
|
|
3370
3465
|
media
|
|
3371
3466
|
} = theme.sanity;
|
|
3372
|
-
return
|
|
3467
|
+
return _responsive(media, props.$columns, columns => ({
|
|
3373
3468
|
gridTemplateColumns: columns && `repeat(${columns},minmax(0,1fr));`
|
|
3374
3469
|
}));
|
|
3375
3470
|
}
|
|
@@ -3381,7 +3476,7 @@ function responsiveGridRowsStyle(props) {
|
|
|
3381
3476
|
const {
|
|
3382
3477
|
media
|
|
3383
3478
|
} = theme.sanity;
|
|
3384
|
-
return
|
|
3479
|
+
return _responsive(media, props.$rows, rows => ({
|
|
3385
3480
|
gridTemplateRows: rows && `repeat(${rows},minmax(0,1fr));`
|
|
3386
3481
|
}));
|
|
3387
3482
|
}
|
|
@@ -3394,7 +3489,7 @@ function responsiveGridGapStyle(props) {
|
|
|
3394
3489
|
media,
|
|
3395
3490
|
space
|
|
3396
3491
|
} = theme.sanity;
|
|
3397
|
-
return
|
|
3492
|
+
return _responsive(media, props.$gap, gap => ({
|
|
3398
3493
|
gridGap: gap ? rem(space[gap]) : undefined
|
|
3399
3494
|
}));
|
|
3400
3495
|
}
|
|
@@ -3407,7 +3502,7 @@ function responsiveGridGapXStyle(props) {
|
|
|
3407
3502
|
media,
|
|
3408
3503
|
space
|
|
3409
3504
|
} = theme.sanity;
|
|
3410
|
-
return
|
|
3505
|
+
return _responsive(media, props.$gapX, gapX => ({
|
|
3411
3506
|
columnGap: gapX ? rem(space[gapX]) : undefined
|
|
3412
3507
|
}));
|
|
3413
3508
|
}
|
|
@@ -3420,7 +3515,7 @@ function responsiveGridGapYStyle(props) {
|
|
|
3420
3515
|
media,
|
|
3421
3516
|
space
|
|
3422
3517
|
} = theme.sanity;
|
|
3423
|
-
return
|
|
3518
|
+
return _responsive(media, props.$gapY, gapY => ({
|
|
3424
3519
|
rowGap: gapY ? rem(space[gapY]) : undefined
|
|
3425
3520
|
}));
|
|
3426
3521
|
}
|
|
@@ -3444,7 +3539,7 @@ function responsiveGridItemRowStyle(props) {
|
|
|
3444
3539
|
const {
|
|
3445
3540
|
media
|
|
3446
3541
|
} = theme.sanity;
|
|
3447
|
-
return
|
|
3542
|
+
return _responsive(media, props.$row, row => {
|
|
3448
3543
|
if (typeof row === 'number') {
|
|
3449
3544
|
return {
|
|
3450
3545
|
gridRow: `span ${row} / span ${row}`
|
|
@@ -3464,7 +3559,7 @@ function responsiveGridItemRowStartStyle(props) {
|
|
|
3464
3559
|
const {
|
|
3465
3560
|
media
|
|
3466
3561
|
} = theme.sanity;
|
|
3467
|
-
return
|
|
3562
|
+
return _responsive(media, props.$rowStart, rowStart => ({
|
|
3468
3563
|
gridRowStart: rowStart
|
|
3469
3564
|
}));
|
|
3470
3565
|
}
|
|
@@ -3476,7 +3571,7 @@ function responsiveGridItemRowEndStyle(props) {
|
|
|
3476
3571
|
const {
|
|
3477
3572
|
media
|
|
3478
3573
|
} = theme.sanity;
|
|
3479
|
-
return
|
|
3574
|
+
return _responsive(media, props.$rowEnd, rowEnd => ({
|
|
3480
3575
|
gridRowEnd: rowEnd
|
|
3481
3576
|
}));
|
|
3482
3577
|
}
|
|
@@ -3488,7 +3583,7 @@ function responsiveGridItemColumnStyle(props) {
|
|
|
3488
3583
|
const {
|
|
3489
3584
|
media
|
|
3490
3585
|
} = theme.sanity;
|
|
3491
|
-
return
|
|
3586
|
+
return _responsive(media, props.$column, column => {
|
|
3492
3587
|
if (typeof column === 'number') {
|
|
3493
3588
|
return {
|
|
3494
3589
|
gridColumn: `span ${column} / span ${column}`
|
|
@@ -3508,7 +3603,7 @@ function responsiveGridItemColumnStartStyle(props) {
|
|
|
3508
3603
|
const {
|
|
3509
3604
|
media
|
|
3510
3605
|
} = theme.sanity;
|
|
3511
|
-
return
|
|
3606
|
+
return _responsive(media, props.$columnStart, columnStart => ({
|
|
3512
3607
|
gridColumnStart: columnStart
|
|
3513
3608
|
}));
|
|
3514
3609
|
}
|
|
@@ -3520,15 +3615,18 @@ function responsiveGridItemColumnEndStyle(props) {
|
|
|
3520
3615
|
const {
|
|
3521
3616
|
media
|
|
3522
3617
|
} = theme.sanity;
|
|
3523
|
-
return
|
|
3618
|
+
return _responsive(media, props.$columnEnd, columnEnd => ({
|
|
3524
3619
|
gridColumnEnd: columnEnd
|
|
3525
3620
|
}));
|
|
3526
3621
|
}
|
|
3527
3622
|
|
|
3528
3623
|
function responsiveInputPaddingStyle(props) {
|
|
3529
3624
|
const {
|
|
3625
|
+
$fontSize,
|
|
3530
3626
|
$iconLeft,
|
|
3531
3627
|
$iconRight,
|
|
3628
|
+
$padding,
|
|
3629
|
+
$space,
|
|
3532
3630
|
theme
|
|
3533
3631
|
} = props;
|
|
3534
3632
|
const {
|
|
@@ -3536,29 +3634,26 @@ function responsiveInputPaddingStyle(props) {
|
|
|
3536
3634
|
media,
|
|
3537
3635
|
space: spaceScale
|
|
3538
3636
|
} = theme.sanity;
|
|
3539
|
-
const
|
|
3540
|
-
const space = getResponsiveProp(props.$space, [0]);
|
|
3541
|
-
const size = getResponsiveProp(props.$fontSize, [0]);
|
|
3542
|
-
const len = Math.max(padding.length, space.length, size.length);
|
|
3637
|
+
const len = Math.max($padding.length, $space.length, $fontSize.length);
|
|
3543
3638
|
const _padding = [];
|
|
3544
3639
|
const _space = [];
|
|
3545
|
-
const
|
|
3640
|
+
const _fontSize = [];
|
|
3546
3641
|
|
|
3547
3642
|
for (let i = 0; i < len; i += 1) {
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
|
|
3643
|
+
_fontSize[i] = $fontSize[i] === undefined ? _fontSize[i - 1] : $fontSize[i];
|
|
3644
|
+
_padding[i] = $padding[i] === undefined ? _padding[i - 1] : $padding[i];
|
|
3645
|
+
_space[i] = $space[i] === undefined ? _space[i - 1] : $space[i];
|
|
3551
3646
|
}
|
|
3552
3647
|
|
|
3553
|
-
return
|
|
3554
|
-
const
|
|
3555
|
-
const emSize =
|
|
3648
|
+
return _responsive(media, _padding, (_, i) => {
|
|
3649
|
+
const size = fonts.text.sizes[_fontSize[i]] || fonts.text.sizes[2];
|
|
3650
|
+
const emSize = size.lineHeight - size.ascenderHeight - size.descenderHeight;
|
|
3556
3651
|
const p = spaceScale[_padding[i]];
|
|
3557
3652
|
const s = spaceScale[_space[i]];
|
|
3558
3653
|
const styles = {
|
|
3559
|
-
paddingTop: rem(p -
|
|
3654
|
+
paddingTop: rem(p - size.ascenderHeight),
|
|
3560
3655
|
paddingRight: rem(p),
|
|
3561
|
-
paddingBottom: rem(p -
|
|
3656
|
+
paddingBottom: rem(p - size.descenderHeight),
|
|
3562
3657
|
paddingLeft: rem(p)
|
|
3563
3658
|
};
|
|
3564
3659
|
if ($iconRight) styles.paddingRight = rem(p + emSize + s);
|
|
@@ -3572,11 +3667,11 @@ function responsiveInputPaddingIconRightStyle(props) {
|
|
|
3572
3667
|
}));
|
|
3573
3668
|
}
|
|
3574
3669
|
|
|
3575
|
-
let _$
|
|
3576
|
-
_t$
|
|
3577
|
-
_t2$
|
|
3578
|
-
_t3$
|
|
3579
|
-
const ROOT_STYLE = css(_t$
|
|
3670
|
+
let _$C = t => t,
|
|
3671
|
+
_t$C,
|
|
3672
|
+
_t2$m,
|
|
3673
|
+
_t3$d;
|
|
3674
|
+
const ROOT_STYLE = css(_t$C || (_t$C = _$C`
|
|
3580
3675
|
&:not([hidden]) {
|
|
3581
3676
|
display: flex;
|
|
3582
3677
|
}
|
|
@@ -3589,14 +3684,12 @@ function textInputRootStyle() {
|
|
|
3589
3684
|
function textInputBaseStyle(props) {
|
|
3590
3685
|
const {
|
|
3591
3686
|
theme,
|
|
3687
|
+
$tone,
|
|
3592
3688
|
$weight
|
|
3593
3689
|
} = props;
|
|
3594
3690
|
const font = theme.sanity.fonts.text;
|
|
3595
3691
|
const color = theme.sanity.color.input;
|
|
3596
|
-
return css(_t2$
|
|
3597
|
-
--input-fg-color: ${0};
|
|
3598
|
-
--input-placeholder-color: ${0};
|
|
3599
|
-
|
|
3692
|
+
return css(_t2$m || (_t2$m = _$C`
|
|
3600
3693
|
appearance: none;
|
|
3601
3694
|
background: none;
|
|
3602
3695
|
border: 0;
|
|
@@ -3610,7 +3703,6 @@ function textInputBaseStyle(props) {
|
|
|
3610
3703
|
position: relative;
|
|
3611
3704
|
z-index: 1;
|
|
3612
3705
|
display: block;
|
|
3613
|
-
color: var(--input-fg-color);
|
|
3614
3706
|
|
|
3615
3707
|
/* NOTE: This is a hack to disable Chrome’s autofill styles */
|
|
3616
3708
|
&:-webkit-autofill,
|
|
@@ -3622,39 +3714,46 @@ function textInputBaseStyle(props) {
|
|
|
3622
3714
|
transition-delay: 86400s /* 24h */;
|
|
3623
3715
|
}
|
|
3624
3716
|
|
|
3625
|
-
&::placeholder {
|
|
3626
|
-
color: var(--input-placeholder-color);
|
|
3627
|
-
}
|
|
3628
|
-
|
|
3629
3717
|
/* &:is(textarea) */
|
|
3630
3718
|
&[data-as='textarea'] {
|
|
3631
3719
|
resize: none;
|
|
3632
3720
|
}
|
|
3633
3721
|
|
|
3634
|
-
|
|
3635
|
-
&:not(:invalid):not(:disabled):not(:read-only) {
|
|
3636
|
-
--input-fg-color: ${0};
|
|
3637
|
-
--input-placeholder-color: ${0};
|
|
3638
|
-
}
|
|
3722
|
+
color: var(--input-fg-color);
|
|
3639
3723
|
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
--input-fg-color: ${0};
|
|
3643
|
-
--input-placeholder-color: ${0};
|
|
3724
|
+
&::placeholder {
|
|
3725
|
+
color: var(--input-placeholder-color);
|
|
3644
3726
|
}
|
|
3645
3727
|
|
|
3646
|
-
|
|
3647
|
-
&:invalid {
|
|
3728
|
+
&[data-tone='${0}'] {
|
|
3648
3729
|
--input-fg-color: ${0};
|
|
3649
3730
|
--input-placeholder-color: ${0};
|
|
3650
|
-
}
|
|
3651
3731
|
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3732
|
+
/* enabled */
|
|
3733
|
+
&:not(:invalid):not(:disabled):not(:read-only) {
|
|
3734
|
+
--input-fg-color: ${0};
|
|
3735
|
+
--input-placeholder-color: ${0};
|
|
3736
|
+
}
|
|
3737
|
+
|
|
3738
|
+
/* disabled */
|
|
3739
|
+
&:not(:invalid):disabled {
|
|
3740
|
+
--input-fg-color: ${0};
|
|
3741
|
+
--input-placeholder-color: ${0};
|
|
3742
|
+
}
|
|
3743
|
+
|
|
3744
|
+
/* invalid */
|
|
3745
|
+
&:invalid {
|
|
3746
|
+
--input-fg-color: ${0};
|
|
3747
|
+
--input-placeholder-color: ${0};
|
|
3748
|
+
}
|
|
3749
|
+
|
|
3750
|
+
/* readOnly */
|
|
3751
|
+
&:read-only {
|
|
3752
|
+
--input-fg-color: ${0};
|
|
3753
|
+
--input-placeholder-color: ${0};
|
|
3754
|
+
}
|
|
3656
3755
|
}
|
|
3657
|
-
`),
|
|
3756
|
+
`), font.family, $weight && font.weights[$weight] || font.weights.regular, $tone, color.default.enabled.fg, color.default.enabled.placeholder, color.default.enabled.fg, color.default.enabled.placeholder, color.default.disabled.fg, color.default.disabled.placeholder, color.invalid.enabled.fg, color.invalid.enabled.placeholder, color.default.readOnly.fg, color.default.readOnly.placeholder);
|
|
3658
3757
|
}
|
|
3659
3758
|
function textInputFontSizeStyle(props) {
|
|
3660
3759
|
const {
|
|
@@ -3664,7 +3763,7 @@ function textInputFontSizeStyle(props) {
|
|
|
3664
3763
|
fonts,
|
|
3665
3764
|
media
|
|
3666
3765
|
} = theme.sanity;
|
|
3667
|
-
return
|
|
3766
|
+
return _responsive(media, props.$fontSize, sizeIndex => {
|
|
3668
3767
|
const size = fonts.text.sizes[sizeIndex] || fonts.text.sizes[2];
|
|
3669
3768
|
return {
|
|
3670
3769
|
fontSize: rem(size.fontSize),
|
|
@@ -3677,6 +3776,7 @@ function textInputRepresentationStyle(props) {
|
|
|
3677
3776
|
$border,
|
|
3678
3777
|
$hasPrefix,
|
|
3679
3778
|
$hasSuffix,
|
|
3779
|
+
$tone,
|
|
3680
3780
|
theme
|
|
3681
3781
|
} = props;
|
|
3682
3782
|
const {
|
|
@@ -3684,9 +3784,7 @@ function textInputRepresentationStyle(props) {
|
|
|
3684
3784
|
input
|
|
3685
3785
|
} = theme.sanity;
|
|
3686
3786
|
const color = theme.sanity.color.input;
|
|
3687
|
-
return css(_t3$
|
|
3688
|
-
--card-bg-color: ${0};
|
|
3689
|
-
--card-fg-color: ${0};
|
|
3787
|
+
return css(_t3$d || (_t3$d = _$C`
|
|
3690
3788
|
--input-box-shadow: none;
|
|
3691
3789
|
|
|
3692
3790
|
position: absolute;
|
|
@@ -3697,6 +3795,7 @@ function textInputRepresentationStyle(props) {
|
|
|
3697
3795
|
display: block;
|
|
3698
3796
|
pointer-events: none;
|
|
3699
3797
|
z-index: 0;
|
|
3798
|
+
|
|
3700
3799
|
background-color: var(--card-bg-color);
|
|
3701
3800
|
box-shadow: var(--input-box-shadow);
|
|
3702
3801
|
|
|
@@ -3705,48 +3804,53 @@ function textInputRepresentationStyle(props) {
|
|
|
3705
3804
|
border-top-right-radius: ${0};
|
|
3706
3805
|
border-bottom-right-radius: ${0};
|
|
3707
3806
|
|
|
3708
|
-
|
|
3709
|
-
*:not(:disabled) + && {
|
|
3710
|
-
--input-box-shadow: ${0};
|
|
3711
|
-
}
|
|
3712
|
-
|
|
3713
|
-
/* invalid */
|
|
3714
|
-
*:not(:disabled):invalid + && {
|
|
3807
|
+
&[data-tone='${0}'] {
|
|
3715
3808
|
--card-bg-color: ${0};
|
|
3716
3809
|
--card-fg-color: ${0};
|
|
3717
|
-
--input-box-shadow: ${0};
|
|
3718
|
-
}
|
|
3719
|
-
|
|
3720
|
-
/* focused */
|
|
3721
|
-
*:not(:disabled):focus + && {
|
|
3722
|
-
--input-box-shadow: ${0};
|
|
3723
|
-
}
|
|
3724
3810
|
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
--input-box-shadow: ${0};
|
|
3730
|
-
}
|
|
3811
|
+
/* enabled */
|
|
3812
|
+
*:not(:disabled) + & {
|
|
3813
|
+
--input-box-shadow: ${0};
|
|
3814
|
+
}
|
|
3731
3815
|
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
*:not(:disabled):not(:read-only):not(:invalid):hover + && {
|
|
3816
|
+
/* invalid */
|
|
3817
|
+
*:not(:disabled):invalid + & {
|
|
3735
3818
|
--card-bg-color: ${0};
|
|
3736
3819
|
--card-fg-color: ${0};
|
|
3820
|
+
--input-box-shadow: ${0};
|
|
3737
3821
|
}
|
|
3738
3822
|
|
|
3739
|
-
|
|
3823
|
+
/* focused */
|
|
3824
|
+
*:not(:disabled):focus + & {
|
|
3740
3825
|
--input-box-shadow: ${0};
|
|
3741
3826
|
}
|
|
3742
|
-
}
|
|
3743
3827
|
|
|
3744
|
-
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3828
|
+
/* disabled */
|
|
3829
|
+
*:disabled + & {
|
|
3830
|
+
--card-bg-color: ${0} !important;
|
|
3831
|
+
--card-fg-color: ${0} !important;
|
|
3832
|
+
--input-box-shadow: ${0};
|
|
3833
|
+
}
|
|
3834
|
+
|
|
3835
|
+
/* readOnly */
|
|
3836
|
+
*:read-only + & {
|
|
3837
|
+
--card-bg-color: ${0} !important;
|
|
3838
|
+
--card-fg-color: ${0} !important;
|
|
3839
|
+
}
|
|
3840
|
+
|
|
3841
|
+
/* hovered */
|
|
3842
|
+
@media (hover: hover) {
|
|
3843
|
+
*:not(:disabled):not(:read-only):not(:invalid):hover + & {
|
|
3844
|
+
--card-bg-color: ${0};
|
|
3845
|
+
--card-fg-color: ${0};
|
|
3846
|
+
}
|
|
3847
|
+
|
|
3848
|
+
*:not(:disabled):not(:read-only):not(:invalid):not(:focus):hover + & {
|
|
3849
|
+
--input-box-shadow: ${0};
|
|
3850
|
+
}
|
|
3851
|
+
}
|
|
3748
3852
|
}
|
|
3749
|
-
`),
|
|
3853
|
+
`), $hasPrefix ? 0 : undefined, $hasPrefix ? 0 : undefined, $hasSuffix ? 0 : undefined, $hasSuffix ? 0 : undefined, $tone, color.default.enabled.bg, color.default.enabled.fg, $border ? focusRingBorderStyle({
|
|
3750
3854
|
color: color.default.enabled.border,
|
|
3751
3855
|
width: input.border.width
|
|
3752
3856
|
}) : undefined, color.invalid.enabled.bg, color.invalid.enabled.fg, $border ? focusRingBorderStyle({
|
|
@@ -3761,24 +3865,24 @@ function textInputRepresentationStyle(props) {
|
|
|
3761
3865
|
}), color.default.disabled.bg, color.default.disabled.fg, $border ? focusRingBorderStyle({
|
|
3762
3866
|
color: color.default.disabled.border,
|
|
3763
3867
|
width: input.border.width
|
|
3764
|
-
}) : 'none', color.default.hovered.bg, color.default.hovered.fg, $border ? focusRingBorderStyle({
|
|
3868
|
+
}) : 'none', color.default.readOnly.bg, color.default.readOnly.fg, color.default.hovered.bg, color.default.hovered.fg, $border ? focusRingBorderStyle({
|
|
3765
3869
|
color: color.default.hovered.border,
|
|
3766
3870
|
width: input.border.width
|
|
3767
|
-
}) : 'none'
|
|
3871
|
+
}) : 'none');
|
|
3768
3872
|
}
|
|
3769
3873
|
|
|
3770
3874
|
function responsiveMarginStyle(props) {
|
|
3771
3875
|
const {
|
|
3772
3876
|
theme
|
|
3773
3877
|
} = props;
|
|
3774
|
-
return [
|
|
3878
|
+
return [_getResponsiveSpace(theme, ['margin'], props.$margin), _getResponsiveSpace(theme, ['marginLeft', 'marginRight'], props.$marginX), _getResponsiveSpace(theme, ['marginTop', 'marginBottom'], props.$marginY), _getResponsiveSpace(theme, ['marginTop'], props.$marginTop), _getResponsiveSpace(theme, ['marginRight'], props.$marginRight), _getResponsiveSpace(theme, ['marginBottom'], props.$marginBottom), _getResponsiveSpace(theme, ['marginLeft'], props.$marginLeft)].filter(Boolean);
|
|
3775
3879
|
}
|
|
3776
3880
|
|
|
3777
3881
|
function responsivePaddingStyle(props) {
|
|
3778
3882
|
const {
|
|
3779
3883
|
theme
|
|
3780
3884
|
} = props;
|
|
3781
|
-
return [
|
|
3885
|
+
return [_getResponsiveSpace(theme, ['padding'], props.$padding), _getResponsiveSpace(theme, ['paddingLeft', 'paddingRight'], props.$paddingX), _getResponsiveSpace(theme, ['paddingTop', 'paddingBottom'], props.$paddingY), _getResponsiveSpace(theme, ['paddingTop'], props.$paddingTop), _getResponsiveSpace(theme, ['paddingRight'], props.$paddingRight), _getResponsiveSpace(theme, ['paddingBottom'], props.$paddingBottom), _getResponsiveSpace(theme, ['paddingLeft'], props.$paddingLeft)].filter(Boolean);
|
|
3782
3886
|
}
|
|
3783
3887
|
|
|
3784
3888
|
function responsiveRadiusStyle(props) {
|
|
@@ -3789,7 +3893,7 @@ function responsiveRadiusStyle(props) {
|
|
|
3789
3893
|
media,
|
|
3790
3894
|
radius
|
|
3791
3895
|
} = theme.sanity;
|
|
3792
|
-
return
|
|
3896
|
+
return _responsive(media, props.$radius, radiusIndex => ({
|
|
3793
3897
|
borderRadius: rem(radius[radiusIndex])
|
|
3794
3898
|
}));
|
|
3795
3899
|
}
|
|
@@ -3799,7 +3903,7 @@ function toBoxShadow(shadow, color) {
|
|
|
3799
3903
|
}
|
|
3800
3904
|
|
|
3801
3905
|
function shadowStyle(shadow) {
|
|
3802
|
-
if (!shadow) return EMPTY_RECORD
|
|
3906
|
+
if (!shadow) return EMPTY_RECORD;
|
|
3803
3907
|
const outline = `0 0 0 ${rem(1)} var(--card-shadow-outline-color)`;
|
|
3804
3908
|
const umbra = toBoxShadow(shadow.umbra, 'var(--card-shadow-umbra-color)');
|
|
3805
3909
|
const penumbra = toBoxShadow(shadow.penumbra, 'var(--card-shadow-penumbra-color)');
|
|
@@ -3817,13 +3921,13 @@ function responsiveShadowStyle(props) {
|
|
|
3817
3921
|
media,
|
|
3818
3922
|
shadows
|
|
3819
3923
|
} = theme.sanity;
|
|
3820
|
-
return
|
|
3924
|
+
return _responsive(media, props.$shadow, shadow => shadowStyle(shadows[shadow]));
|
|
3821
3925
|
}
|
|
3822
3926
|
|
|
3823
|
-
let _$
|
|
3824
|
-
_t$
|
|
3825
|
-
_t2$
|
|
3826
|
-
_t3$
|
|
3927
|
+
let _$B = t => t,
|
|
3928
|
+
_t$B,
|
|
3929
|
+
_t2$l,
|
|
3930
|
+
_t3$c;
|
|
3827
3931
|
function textBaseStyle(props) {
|
|
3828
3932
|
const {
|
|
3829
3933
|
$accent,
|
|
@@ -3833,7 +3937,7 @@ function textBaseStyle(props) {
|
|
|
3833
3937
|
const {
|
|
3834
3938
|
weights
|
|
3835
3939
|
} = theme.sanity.fonts.text;
|
|
3836
|
-
return css(_t$
|
|
3940
|
+
return css(_t$B || (_t$B = _$B`
|
|
3837
3941
|
color: var(--card-fg-color);
|
|
3838
3942
|
|
|
3839
3943
|
${0}
|
|
@@ -3875,19 +3979,19 @@ function textBaseStyle(props) {
|
|
|
3875
3979
|
& [data-sanity-icon] {
|
|
3876
3980
|
vertical-align: baseline;
|
|
3877
3981
|
}
|
|
3878
|
-
`), $accent && css(_t2$
|
|
3982
|
+
`), $accent && css(_t2$l || (_t2$l = _$B`
|
|
3879
3983
|
color: var(--card-accent-fg-color);
|
|
3880
|
-
`)), $muted && css(_t3$
|
|
3984
|
+
`)), $muted && css(_t3$c || (_t3$c = _$B`
|
|
3881
3985
|
color: var(--card-muted-fg-color);
|
|
3882
3986
|
`)), theme.sanity.fonts.code.family, weights.bold);
|
|
3883
3987
|
}
|
|
3884
3988
|
|
|
3885
|
-
const _excluded$
|
|
3989
|
+
const _excluded$H = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
|
|
3886
3990
|
|
|
3887
|
-
let _$
|
|
3888
|
-
_t$
|
|
3991
|
+
let _$A = t => t,
|
|
3992
|
+
_t$A;
|
|
3889
3993
|
const Root$E = styled.div(responsiveTextFont, responsiveTextAlignStyle, textBaseStyle);
|
|
3890
|
-
const SpanWithTextOverflow$2 = styled.span(_t$
|
|
3994
|
+
const SpanWithTextOverflow$2 = styled.span(_t$A || (_t$A = _$A`
|
|
3891
3995
|
display: block;
|
|
3892
3996
|
white-space: nowrap;
|
|
3893
3997
|
text-overflow: ellipsis;
|
|
@@ -3907,7 +4011,7 @@ const Text = /*#__PURE__*/forwardRef(function Text(props, ref) {
|
|
|
3907
4011
|
textOverflow,
|
|
3908
4012
|
weight
|
|
3909
4013
|
} = props,
|
|
3910
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
4014
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$H);
|
|
3911
4015
|
|
|
3912
4016
|
let children = childrenProp;
|
|
3913
4017
|
|
|
@@ -3919,10 +4023,10 @@ const Text = /*#__PURE__*/forwardRef(function Text(props, ref) {
|
|
|
3919
4023
|
"data-ui": "Text"
|
|
3920
4024
|
}, restProps, {
|
|
3921
4025
|
"$accent": accent,
|
|
3922
|
-
"$align": align,
|
|
4026
|
+
"$align": useArrayProp(align),
|
|
3923
4027
|
"$muted": muted,
|
|
3924
4028
|
ref: ref,
|
|
3925
|
-
"$size": size,
|
|
4029
|
+
"$size": useArrayProp(size),
|
|
3926
4030
|
"$weight": weight
|
|
3927
4031
|
}), /*#__PURE__*/React.createElement("span", null, children));
|
|
3928
4032
|
});
|
|
@@ -4025,7 +4129,7 @@ function responsiveAvatarSizeStyle(props) {
|
|
|
4025
4129
|
avatar,
|
|
4026
4130
|
media
|
|
4027
4131
|
} = theme.sanity;
|
|
4028
|
-
return
|
|
4132
|
+
return _responsive(media, props.$size, size => {
|
|
4029
4133
|
const avatarSize = avatar.sizes[size] || avatar.sizes[0];
|
|
4030
4134
|
return {
|
|
4031
4135
|
width: rem(avatarSize.size),
|
|
@@ -4078,7 +4182,7 @@ function avatarStrokeStyle() {
|
|
|
4078
4182
|
};
|
|
4079
4183
|
}
|
|
4080
4184
|
|
|
4081
|
-
const _excluded$
|
|
4185
|
+
const _excluded$G = ["as", "color", "src", "title", "initials", "onImageLoadError", "arrowPosition", "animateArrowFrom", "status", "size"];
|
|
4082
4186
|
const Root$D = styled.div(responsiveAvatarSizeStyle, avatarStyle.root);
|
|
4083
4187
|
const Arrow = styled.div(avatarStyle.arrow);
|
|
4084
4188
|
const BgStroke = styled.ellipse(avatarStyle.bgStroke);
|
|
@@ -4099,12 +4203,12 @@ const Avatar = /*#__PURE__*/forwardRef(function Avatar(props, ref) {
|
|
|
4099
4203
|
arrowPosition: arrowPositionProp,
|
|
4100
4204
|
animateArrowFrom,
|
|
4101
4205
|
status = 'online',
|
|
4102
|
-
size: sizeProp
|
|
4206
|
+
size: sizeProp = 0
|
|
4103
4207
|
} = props,
|
|
4104
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
4208
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$G);
|
|
4105
4209
|
|
|
4106
4210
|
const as = ReactIs.isValidElementType(asProp) ? asProp : 'div';
|
|
4107
|
-
const size =
|
|
4211
|
+
const size = useArrayProp(sizeProp);
|
|
4108
4212
|
const theme = useTheme();
|
|
4109
4213
|
const color = theme.sanity.color.spot[colorKey] || theme.sanity.color.spot.gray; // @todo: remove this
|
|
4110
4214
|
|
|
@@ -4133,6 +4237,7 @@ const Avatar = /*#__PURE__*/forwardRef(function Avatar(props, ref) {
|
|
|
4133
4237
|
onImageLoadError(new Error('Avatar: the image failed to load'));
|
|
4134
4238
|
}
|
|
4135
4239
|
}, [onImageLoadError]);
|
|
4240
|
+
const initialsSize = useMemo(() => size.map(s => s === 0 ? 0 : s + 1), [size]);
|
|
4136
4241
|
return /*#__PURE__*/React.createElement(Root$D, _extends({
|
|
4137
4242
|
as: as,
|
|
4138
4243
|
"data-as": typeof as === 'string' ? as : undefined,
|
|
@@ -4186,14 +4291,14 @@ const Avatar = /*#__PURE__*/forwardRef(function Avatar(props, ref) {
|
|
|
4186
4291
|
vectorEffect: "non-scaling-stroke"
|
|
4187
4292
|
})), (imageFailed || !src) && initials && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Initials, null, /*#__PURE__*/React.createElement(Text, {
|
|
4188
4293
|
as: "span",
|
|
4189
|
-
size:
|
|
4294
|
+
size: initialsSize
|
|
4190
4295
|
}, /*#__PURE__*/React.createElement("strong", null, initials)))));
|
|
4191
4296
|
});
|
|
4192
4297
|
|
|
4193
|
-
let _$
|
|
4194
|
-
_t$
|
|
4298
|
+
let _$z = t => t,
|
|
4299
|
+
_t$z;
|
|
4195
4300
|
|
|
4196
|
-
function
|
|
4301
|
+
function _responsiveAvatarCounterSizeStyle(props) {
|
|
4197
4302
|
const {
|
|
4198
4303
|
theme
|
|
4199
4304
|
} = props;
|
|
@@ -4201,9 +4306,9 @@ function responsiveAvatarCounterSizeStyle(props) {
|
|
|
4201
4306
|
avatar,
|
|
4202
4307
|
media
|
|
4203
4308
|
} = theme.sanity;
|
|
4204
|
-
return
|
|
4309
|
+
return _responsive(media, props.$size, size => {
|
|
4205
4310
|
const avatarSize = avatar.sizes[size];
|
|
4206
|
-
if (!avatarSize) return EMPTY_RECORD
|
|
4311
|
+
if (!avatarSize) return EMPTY_RECORD;
|
|
4207
4312
|
return {
|
|
4208
4313
|
borderRadius: rem(avatarSize.size / 2),
|
|
4209
4314
|
minWidth: rem(avatarSize.size),
|
|
@@ -4212,11 +4317,11 @@ function responsiveAvatarCounterSizeStyle(props) {
|
|
|
4212
4317
|
});
|
|
4213
4318
|
}
|
|
4214
4319
|
|
|
4215
|
-
function
|
|
4320
|
+
function _avatarCounterBaseStyle(props) {
|
|
4216
4321
|
const {
|
|
4217
4322
|
theme
|
|
4218
4323
|
} = props;
|
|
4219
|
-
return css(_t$
|
|
4324
|
+
return css(_t$z || (_t$z = _$z`
|
|
4220
4325
|
align-items: center;
|
|
4221
4326
|
justify-content: center;
|
|
4222
4327
|
box-sizing: border-box;
|
|
@@ -4233,7 +4338,7 @@ function avatarCounterBaseStyle(props) {
|
|
|
4233
4338
|
`), rem(theme.sanity.space[2]));
|
|
4234
4339
|
}
|
|
4235
4340
|
|
|
4236
|
-
const Root$C = styled.div(
|
|
4341
|
+
const Root$C = styled.div(_responsiveAvatarCounterSizeStyle, _avatarCounterBaseStyle);
|
|
4237
4342
|
/**
|
|
4238
4343
|
* @public
|
|
4239
4344
|
*/
|
|
@@ -4241,17 +4346,17 @@ const Root$C = styled.div(responsiveAvatarCounterSizeStyle, avatarCounterBaseSty
|
|
|
4241
4346
|
const AvatarCounter = /*#__PURE__*/forwardRef(function AvatarCounter(props, ref) {
|
|
4242
4347
|
const {
|
|
4243
4348
|
count,
|
|
4244
|
-
size: sizeProp = 0
|
|
4245
|
-
tone
|
|
4349
|
+
size: sizeProp = 0
|
|
4246
4350
|
} = props;
|
|
4247
|
-
const size =
|
|
4351
|
+
const size = useArrayProp(sizeProp);
|
|
4352
|
+
const counterSize = useMemo(() => size.map(s => s === 0 ? 0 : s + 1), [size]);
|
|
4248
4353
|
return /*#__PURE__*/React.createElement(Root$C, {
|
|
4249
4354
|
"$size": size,
|
|
4250
|
-
"data-
|
|
4355
|
+
"data-ui": "AvatarCounter",
|
|
4251
4356
|
ref: ref
|
|
4252
4357
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
4253
4358
|
as: "span",
|
|
4254
|
-
size:
|
|
4359
|
+
size: counterSize
|
|
4255
4360
|
}, /*#__PURE__*/React.createElement("strong", null, count)));
|
|
4256
4361
|
});
|
|
4257
4362
|
|
|
@@ -4260,11 +4365,11 @@ function childrenToElementArray(children) {
|
|
|
4260
4365
|
return childrenArray.filter(node => isElement(node) || isFragment(node) || typeof node === 'string');
|
|
4261
4366
|
}
|
|
4262
4367
|
|
|
4263
|
-
const _excluded$
|
|
4368
|
+
const _excluded$F = ["children", "maxLength", "size"];
|
|
4264
4369
|
|
|
4265
|
-
let _$
|
|
4266
|
-
_t$
|
|
4267
|
-
const BASE_STYLES = css(_t$
|
|
4370
|
+
let _$y = t => t,
|
|
4371
|
+
_t$y;
|
|
4372
|
+
const BASE_STYLES = css(_t$y || (_t$y = _$y`
|
|
4268
4373
|
white-space: nowrap;
|
|
4269
4374
|
|
|
4270
4375
|
& > div {
|
|
@@ -4288,9 +4393,9 @@ function responsiveAvatarStackSizeStyle(props) {
|
|
|
4288
4393
|
avatar,
|
|
4289
4394
|
media
|
|
4290
4395
|
} = theme.sanity;
|
|
4291
|
-
return
|
|
4396
|
+
return _responsive(media, props.$size, size => {
|
|
4292
4397
|
const avatarSize = avatar.sizes[size];
|
|
4293
|
-
if (!avatarSize) return EMPTY_RECORD
|
|
4398
|
+
if (!avatarSize) return EMPTY_RECORD;
|
|
4294
4399
|
return {
|
|
4295
4400
|
'& > div + div': {
|
|
4296
4401
|
marginLeft: rem(avatarSize.distance)
|
|
@@ -4308,13 +4413,13 @@ const AvatarStack = /*#__PURE__*/forwardRef(function AvatarStack(props, ref) {
|
|
|
4308
4413
|
const {
|
|
4309
4414
|
children: childrenProp,
|
|
4310
4415
|
maxLength: maxLengthProp = 4,
|
|
4311
|
-
size = 0
|
|
4312
|
-
tone
|
|
4416
|
+
size: sizeProp = 0
|
|
4313
4417
|
} = props,
|
|
4314
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
4418
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$F);
|
|
4315
4419
|
|
|
4316
|
-
const maxLength = Math.max(maxLengthProp, 0);
|
|
4317
4420
|
const children = childrenToElementArray(childrenProp).filter(child => typeof child !== 'string');
|
|
4421
|
+
const maxLength = Math.max(maxLengthProp, 0);
|
|
4422
|
+
const size = useArrayProp(sizeProp);
|
|
4318
4423
|
const len = children.length;
|
|
4319
4424
|
const visibleCount = maxLength - 1;
|
|
4320
4425
|
const extraCount = len - visibleCount;
|
|
@@ -4323,23 +4428,20 @@ const AvatarStack = /*#__PURE__*/forwardRef(function AvatarStack(props, ref) {
|
|
|
4323
4428
|
"data-ui": "AvatarStack"
|
|
4324
4429
|
}, restProps, {
|
|
4325
4430
|
ref: ref,
|
|
4326
|
-
size: size
|
|
4431
|
+
"$size": size
|
|
4327
4432
|
}), len === 0 && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(AvatarCounter, {
|
|
4328
|
-
count: len
|
|
4329
|
-
tone: tone
|
|
4433
|
+
count: len
|
|
4330
4434
|
})), len !== 0 && extraCount > 1 && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(AvatarCounter, {
|
|
4331
4435
|
count: extraCount,
|
|
4332
|
-
size: size
|
|
4333
|
-
tone: tone
|
|
4436
|
+
size: size
|
|
4334
4437
|
})), visibleChildren.map((child, childIndex) => /*#__PURE__*/React.createElement("div", {
|
|
4335
4438
|
key: String(childIndex)
|
|
4336
4439
|
}, /*#__PURE__*/cloneElement(child, {
|
|
4337
|
-
size
|
|
4338
|
-
tone
|
|
4440
|
+
size
|
|
4339
4441
|
}))));
|
|
4340
4442
|
});
|
|
4341
4443
|
|
|
4342
|
-
const _excluded$
|
|
4444
|
+
const _excluded$E = ["as", "column", "columnStart", "columnEnd", "display", "flex", "height", "margin", "marginX", "marginY", "marginTop", "marginRight", "marginBottom", "marginLeft", "overflow", "padding", "paddingX", "paddingY", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "row", "rowStart", "rowEnd", "sizing"];
|
|
4343
4445
|
const Root$A = styled.div(boxStyle, flexItemStyle, responsiveBoxStyle, responsiveGridItemStyle, responsiveMarginStyle, responsivePaddingStyle);
|
|
4344
4446
|
/**
|
|
4345
4447
|
* @public
|
|
@@ -4374,46 +4476,46 @@ const Box = /*#__PURE__*/forwardRef(function Box(props, ref) {
|
|
|
4374
4476
|
rowEnd,
|
|
4375
4477
|
sizing
|
|
4376
4478
|
} = props,
|
|
4377
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
4479
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$E);
|
|
4378
4480
|
|
|
4379
4481
|
return /*#__PURE__*/React.createElement(Root$A, _extends({
|
|
4380
|
-
"data-as": asProp,
|
|
4482
|
+
"data-as": typeof asProp === 'string' ? asProp : undefined,
|
|
4381
4483
|
"data-ui": "Box"
|
|
4382
4484
|
}, restProps, {
|
|
4383
|
-
"$column": column,
|
|
4384
|
-
"$columnStart": columnStart,
|
|
4385
|
-
"$columnEnd": columnEnd,
|
|
4386
|
-
"$display": display,
|
|
4387
|
-
"$flex": flex,
|
|
4388
|
-
"$height": height,
|
|
4389
|
-
"$margin": margin,
|
|
4390
|
-
"$marginX": marginX,
|
|
4391
|
-
"$marginY": marginY,
|
|
4392
|
-
"$marginTop": marginTop,
|
|
4393
|
-
"$marginRight": marginRight,
|
|
4394
|
-
"$marginBottom": marginBottom,
|
|
4395
|
-
"$marginLeft": marginLeft,
|
|
4396
|
-
"$overflow": overflow,
|
|
4397
|
-
"$padding": padding,
|
|
4398
|
-
"$paddingX": paddingX,
|
|
4399
|
-
"$paddingY": paddingY,
|
|
4400
|
-
"$paddingTop": paddingTop,
|
|
4401
|
-
"$paddingRight": paddingRight,
|
|
4402
|
-
"$paddingBottom": paddingBottom,
|
|
4403
|
-
"$paddingLeft": paddingLeft,
|
|
4404
|
-
"$row": row,
|
|
4405
|
-
"$rowStart": rowStart,
|
|
4406
|
-
"$rowEnd": rowEnd,
|
|
4407
|
-
"$sizing": sizing,
|
|
4485
|
+
"$column": useArrayProp(column),
|
|
4486
|
+
"$columnStart": useArrayProp(columnStart),
|
|
4487
|
+
"$columnEnd": useArrayProp(columnEnd),
|
|
4488
|
+
"$display": useArrayProp(display),
|
|
4489
|
+
"$flex": useArrayProp(flex),
|
|
4490
|
+
"$height": useArrayProp(height),
|
|
4491
|
+
"$margin": useArrayProp(margin),
|
|
4492
|
+
"$marginX": useArrayProp(marginX),
|
|
4493
|
+
"$marginY": useArrayProp(marginY),
|
|
4494
|
+
"$marginTop": useArrayProp(marginTop),
|
|
4495
|
+
"$marginRight": useArrayProp(marginRight),
|
|
4496
|
+
"$marginBottom": useArrayProp(marginBottom),
|
|
4497
|
+
"$marginLeft": useArrayProp(marginLeft),
|
|
4498
|
+
"$overflow": useArrayProp(overflow),
|
|
4499
|
+
"$padding": useArrayProp(padding),
|
|
4500
|
+
"$paddingX": useArrayProp(paddingX),
|
|
4501
|
+
"$paddingY": useArrayProp(paddingY),
|
|
4502
|
+
"$paddingTop": useArrayProp(paddingTop),
|
|
4503
|
+
"$paddingRight": useArrayProp(paddingRight),
|
|
4504
|
+
"$paddingBottom": useArrayProp(paddingBottom),
|
|
4505
|
+
"$paddingLeft": useArrayProp(paddingLeft),
|
|
4506
|
+
"$row": useArrayProp(row),
|
|
4507
|
+
"$rowStart": useArrayProp(rowStart),
|
|
4508
|
+
"$rowEnd": useArrayProp(rowEnd),
|
|
4509
|
+
"$sizing": useArrayProp(sizing),
|
|
4408
4510
|
as: asProp,
|
|
4409
4511
|
ref: ref
|
|
4410
4512
|
}), props.children);
|
|
4411
4513
|
});
|
|
4412
4514
|
|
|
4413
|
-
let _$
|
|
4414
|
-
_t$
|
|
4415
|
-
_t2$
|
|
4416
|
-
_t3$
|
|
4515
|
+
let _$x = t => t,
|
|
4516
|
+
_t$x,
|
|
4517
|
+
_t2$k,
|
|
4518
|
+
_t3$b;
|
|
4417
4519
|
function labelBaseStyle(props) {
|
|
4418
4520
|
const {
|
|
4419
4521
|
$accent,
|
|
@@ -4423,7 +4525,7 @@ function labelBaseStyle(props) {
|
|
|
4423
4525
|
const {
|
|
4424
4526
|
fonts
|
|
4425
4527
|
} = theme.sanity;
|
|
4426
|
-
return css(_t$
|
|
4528
|
+
return css(_t$x || (_t$x = _$x`
|
|
4427
4529
|
text-transform: uppercase;
|
|
4428
4530
|
|
|
4429
4531
|
${0}
|
|
@@ -4443,19 +4545,19 @@ function labelBaseStyle(props) {
|
|
|
4443
4545
|
& [data-sanity-icon] {
|
|
4444
4546
|
vertical-align: baseline;
|
|
4445
4547
|
}
|
|
4446
|
-
`), $accent && css(_t2$
|
|
4548
|
+
`), $accent && css(_t2$k || (_t2$k = _$x`
|
|
4447
4549
|
color: var(--card-accent-fg-color);
|
|
4448
|
-
`)), $muted && css(_t3$
|
|
4550
|
+
`)), $muted && css(_t3$b || (_t3$b = _$x`
|
|
4449
4551
|
color: var(--card-muted-fg-color);
|
|
4450
4552
|
`)), fonts.code.family);
|
|
4451
4553
|
}
|
|
4452
4554
|
|
|
4453
|
-
const _excluded$
|
|
4555
|
+
const _excluded$D = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
|
|
4454
4556
|
|
|
4455
|
-
let _$
|
|
4456
|
-
_t$
|
|
4557
|
+
let _$w = t => t,
|
|
4558
|
+
_t$w;
|
|
4457
4559
|
const Root$z = styled.div(responsiveLabelFont, responsiveTextAlignStyle, labelBaseStyle);
|
|
4458
|
-
const SpanWithTextOverflow$1 = styled.span(_t$
|
|
4560
|
+
const SpanWithTextOverflow$1 = styled.span(_t$w || (_t$w = _$w`
|
|
4459
4561
|
display: block;
|
|
4460
4562
|
white-space: nowrap;
|
|
4461
4563
|
text-overflow: ellipsis;
|
|
@@ -4475,7 +4577,7 @@ const Label = /*#__PURE__*/forwardRef(function Label(props, ref) {
|
|
|
4475
4577
|
textOverflow,
|
|
4476
4578
|
weight
|
|
4477
4579
|
} = props,
|
|
4478
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
4580
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$D);
|
|
4479
4581
|
|
|
4480
4582
|
let children = childrenProp;
|
|
4481
4583
|
|
|
@@ -4489,9 +4591,9 @@ const Label = /*#__PURE__*/forwardRef(function Label(props, ref) {
|
|
|
4489
4591
|
"data-ui": "Label"
|
|
4490
4592
|
}, restProps, {
|
|
4491
4593
|
"$accent": accent,
|
|
4492
|
-
"$align": align,
|
|
4594
|
+
"$align": useArrayProp(align),
|
|
4493
4595
|
"$muted": muted,
|
|
4494
|
-
"$size": size,
|
|
4596
|
+
"$size": useArrayProp(size),
|
|
4495
4597
|
"$weight": weight,
|
|
4496
4598
|
ref: ref
|
|
4497
4599
|
}), children);
|
|
@@ -4516,7 +4618,7 @@ function badgeStyle(props) {
|
|
|
4516
4618
|
};
|
|
4517
4619
|
}
|
|
4518
4620
|
|
|
4519
|
-
const _excluded$
|
|
4621
|
+
const _excluded$C = ["children", "fontSize", "mode", "padding", "radius", "tone"];
|
|
4520
4622
|
const Root$y = styled(Box)(responsiveRadiusStyle, badgeStyle);
|
|
4521
4623
|
/**
|
|
4522
4624
|
* @public
|
|
@@ -4531,22 +4633,22 @@ const Badge = /*#__PURE__*/forwardRef(function Badge(props, ref) {
|
|
|
4531
4633
|
radius = 2,
|
|
4532
4634
|
tone = 'default'
|
|
4533
4635
|
} = props,
|
|
4534
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
4636
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$C);
|
|
4535
4637
|
|
|
4536
4638
|
return /*#__PURE__*/React.createElement(Root$y, _extends({
|
|
4537
4639
|
"data-ui": "Badge"
|
|
4538
4640
|
}, restProps, {
|
|
4539
4641
|
"$mode": mode,
|
|
4540
4642
|
"$tone": tone,
|
|
4541
|
-
"$radius": radius,
|
|
4542
|
-
padding: padding,
|
|
4643
|
+
"$radius": useArrayProp(radius),
|
|
4644
|
+
padding: useArrayProp(padding),
|
|
4543
4645
|
ref: ref
|
|
4544
4646
|
}), /*#__PURE__*/React.createElement(Label, {
|
|
4545
4647
|
size: fontSize
|
|
4546
4648
|
}, children));
|
|
4547
4649
|
});
|
|
4548
4650
|
|
|
4549
|
-
const _excluded$
|
|
4651
|
+
const _excluded$B = ["align", "as", "direction", "gap", "justify", "wrap"];
|
|
4550
4652
|
const Root$x = styled(Box)(flexItemStyle, responsiveFlexStyle);
|
|
4551
4653
|
/**
|
|
4552
4654
|
* @public
|
|
@@ -4561,25 +4663,25 @@ const Flex = /*#__PURE__*/forwardRef(function Flex(props, ref) {
|
|
|
4561
4663
|
justify,
|
|
4562
4664
|
wrap
|
|
4563
4665
|
} = props,
|
|
4564
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
4666
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$B);
|
|
4565
4667
|
|
|
4566
4668
|
return /*#__PURE__*/React.createElement(Root$x, _extends({
|
|
4567
4669
|
"data-ui": "Flex"
|
|
4568
4670
|
}, restProps, {
|
|
4569
|
-
"$align": align,
|
|
4570
|
-
"$direction": direction,
|
|
4571
|
-
"$gap": gap,
|
|
4572
|
-
"$justify": justify,
|
|
4573
|
-
"$wrap": wrap,
|
|
4671
|
+
"$align": useArrayProp(align),
|
|
4672
|
+
"$direction": useArrayProp(direction),
|
|
4673
|
+
"$gap": useArrayProp(gap),
|
|
4674
|
+
"$justify": useArrayProp(justify),
|
|
4675
|
+
"$wrap": useArrayProp(wrap),
|
|
4574
4676
|
forwardedAs: as,
|
|
4575
4677
|
ref: ref
|
|
4576
4678
|
}));
|
|
4577
4679
|
});
|
|
4578
4680
|
|
|
4579
|
-
let _$
|
|
4580
|
-
_t$
|
|
4581
|
-
_t2$
|
|
4582
|
-
const rotate$1 = keyframes(_t$
|
|
4681
|
+
let _$v = t => t,
|
|
4682
|
+
_t$v,
|
|
4683
|
+
_t2$j;
|
|
4684
|
+
const rotate$1 = keyframes(_t$v || (_t$v = _$v`
|
|
4583
4685
|
from {
|
|
4584
4686
|
transform: rotate(0deg);
|
|
4585
4687
|
}
|
|
@@ -4588,7 +4690,7 @@ const rotate$1 = keyframes(_t$w || (_t$w = _$u`
|
|
|
4588
4690
|
transform: rotate(360deg);
|
|
4589
4691
|
}
|
|
4590
4692
|
`));
|
|
4591
|
-
const Root$w = styled(Text)(_t2$
|
|
4693
|
+
const Root$w = styled(Text)(_t2$j || (_t2$j = _$v`
|
|
4592
4694
|
& > span > svg {
|
|
4593
4695
|
animation: ${0} 500ms linear infinite;
|
|
4594
4696
|
}
|
|
@@ -4638,14 +4740,14 @@ function _colorVarsStyle(base, color, checkered = false) {
|
|
|
4638
4740
|
};
|
|
4639
4741
|
}
|
|
4640
4742
|
|
|
4641
|
-
let _$
|
|
4642
|
-
_t$
|
|
4743
|
+
let _$u = t => t,
|
|
4744
|
+
_t$u;
|
|
4643
4745
|
/**
|
|
4644
4746
|
* @internal
|
|
4645
4747
|
*/
|
|
4646
4748
|
|
|
4647
4749
|
function buttonBaseStyles() {
|
|
4648
|
-
return css(_t$
|
|
4750
|
+
return css(_t$u || (_t$u = _$u`
|
|
4649
4751
|
-webkit-font-smoothing: inherit;
|
|
4650
4752
|
appearance: none;
|
|
4651
4753
|
display: inline-flex;
|
|
@@ -4727,12 +4829,12 @@ function buttonColorStyles(props) {
|
|
|
4727
4829
|
}, (_theme$sanity$styles = theme.sanity.styles) == null ? void 0 : (_theme$sanity$styles$ = _theme$sanity$styles.button) == null ? void 0 : _theme$sanity$styles$.root].filter(Boolean);
|
|
4728
4830
|
}
|
|
4729
4831
|
|
|
4730
|
-
const _excluded$
|
|
4832
|
+
const _excluded$A = ["children", "disabled", "fontSize", "icon", "iconRight", "justify", "loading", "mode", "padding", "paddingX", "paddingY", "paddingTop", "paddingBottom", "paddingLeft", "paddingRight", "radius", "selected", "space", "text", "textAlign", "tone", "type"];
|
|
4731
4833
|
|
|
4732
|
-
let _$
|
|
4733
|
-
_t$
|
|
4834
|
+
let _$t = t => t,
|
|
4835
|
+
_t$t;
|
|
4734
4836
|
const Root$v = styled.button(responsiveRadiusStyle, buttonBaseStyles, buttonColorStyles);
|
|
4735
|
-
const LoadingBox = styled.div(_t$
|
|
4837
|
+
const LoadingBox = styled.div(_t$t || (_t$t = _$t`
|
|
4736
4838
|
position: absolute;
|
|
4737
4839
|
top: 0;
|
|
4738
4840
|
left: 0;
|
|
@@ -4757,26 +4859,36 @@ const Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
|
|
|
4757
4859
|
fontSize,
|
|
4758
4860
|
icon,
|
|
4759
4861
|
iconRight,
|
|
4760
|
-
justify = 'center',
|
|
4862
|
+
justify: justifyProp = 'center',
|
|
4761
4863
|
loading,
|
|
4762
4864
|
mode = 'default',
|
|
4763
|
-
padding = 3,
|
|
4764
|
-
paddingX,
|
|
4765
|
-
paddingY,
|
|
4766
|
-
paddingTop,
|
|
4767
|
-
paddingBottom,
|
|
4768
|
-
paddingLeft,
|
|
4769
|
-
paddingRight,
|
|
4770
|
-
radius = 2,
|
|
4865
|
+
padding: paddingProp = 3,
|
|
4866
|
+
paddingX: paddingXProp,
|
|
4867
|
+
paddingY: paddingYProp,
|
|
4868
|
+
paddingTop: paddingTopProp,
|
|
4869
|
+
paddingBottom: paddingBottomProp,
|
|
4870
|
+
paddingLeft: paddingLeftProp,
|
|
4871
|
+
paddingRight: paddingRightProp,
|
|
4872
|
+
radius: radiusProp = 2,
|
|
4771
4873
|
selected,
|
|
4772
|
-
space = 3,
|
|
4874
|
+
space: spaceProp = 3,
|
|
4773
4875
|
text,
|
|
4774
4876
|
textAlign,
|
|
4775
4877
|
tone = 'default',
|
|
4776
4878
|
type = 'button'
|
|
4777
4879
|
} = props,
|
|
4778
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
4880
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$A);
|
|
4779
4881
|
|
|
4882
|
+
const justify = useArrayProp(justifyProp);
|
|
4883
|
+
const padding = useArrayProp(paddingProp);
|
|
4884
|
+
const paddingX = useArrayProp(paddingXProp);
|
|
4885
|
+
const paddingY = useArrayProp(paddingYProp);
|
|
4886
|
+
const paddingTop = useArrayProp(paddingTopProp);
|
|
4887
|
+
const paddingBottom = useArrayProp(paddingBottomProp);
|
|
4888
|
+
const paddingLeft = useArrayProp(paddingLeftProp);
|
|
4889
|
+
const paddingRight = useArrayProp(paddingRightProp);
|
|
4890
|
+
const radius = useArrayProp(radiusProp);
|
|
4891
|
+
const space = useArrayProp(spaceProp);
|
|
4780
4892
|
const theme = useTheme();
|
|
4781
4893
|
const boxProps = useMemo(() => ({
|
|
4782
4894
|
// flex: 1,
|
|
@@ -4822,10 +4934,10 @@ const Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
|
|
|
4822
4934
|
}, boxProps), children));
|
|
4823
4935
|
});
|
|
4824
4936
|
|
|
4825
|
-
let _$
|
|
4826
|
-
_t$
|
|
4827
|
-
_t2$
|
|
4828
|
-
_t3$
|
|
4937
|
+
let _$s = t => t,
|
|
4938
|
+
_t$s,
|
|
4939
|
+
_t2$i,
|
|
4940
|
+
_t3$a;
|
|
4829
4941
|
function cardStyle(props) {
|
|
4830
4942
|
return [cardBaseStyle(props), cardColorStyle(props)];
|
|
4831
4943
|
}
|
|
@@ -4835,7 +4947,7 @@ function cardBaseStyle(props) {
|
|
|
4835
4947
|
theme
|
|
4836
4948
|
} = props;
|
|
4837
4949
|
const space = theme.sanity.space;
|
|
4838
|
-
return css(_t$
|
|
4950
|
+
return css(_t$s || (_t$s = _$s`
|
|
4839
4951
|
${0}
|
|
4840
4952
|
|
|
4841
4953
|
&[data-as='button'] {
|
|
@@ -4858,7 +4970,7 @@ function cardBaseStyle(props) {
|
|
|
4858
4970
|
&[data-as='pre'] {
|
|
4859
4971
|
font: inherit;
|
|
4860
4972
|
}
|
|
4861
|
-
`), $checkered && css(_t2$
|
|
4973
|
+
`), $checkered && css(_t2$i || (_t2$i = _$s`
|
|
4862
4974
|
background-size: ${0}px ${0}px;
|
|
4863
4975
|
background-position: 50% 50%;
|
|
4864
4976
|
background-image: var(--card-bg-image);
|
|
@@ -4883,7 +4995,7 @@ function cardColorStyle(props) {
|
|
|
4883
4995
|
width: 0,
|
|
4884
4996
|
color: 'var(--card-border-color)'
|
|
4885
4997
|
};
|
|
4886
|
-
return css(_t3$
|
|
4998
|
+
return css(_t3$a || (_t3$a = _$s`
|
|
4887
4999
|
${0}
|
|
4888
5000
|
|
|
4889
5001
|
background-color: var(--card-bg-color);
|
|
@@ -4983,7 +5095,7 @@ function cardColorStyle(props) {
|
|
|
4983
5095
|
}) : undefined, $focusRing ? focusRingBorderStyle(border) : undefined, (_theme$sanity$styles = theme.sanity.styles) == null ? void 0 : (_theme$sanity$styles$ = _theme$sanity$styles.card) == null ? void 0 : _theme$sanity$styles$.root);
|
|
4984
5096
|
}
|
|
4985
5097
|
|
|
4986
|
-
const _excluded$
|
|
5098
|
+
const _excluded$z = ["__unstable_checkered", "__unstable_focusRing", "as", "border", "borderTop", "borderRight", "borderBottom", "borderLeft", "pressed", "radius", "scheme", "selected", "shadow", "tone"];
|
|
4987
5099
|
const Root$u = styled(Box)(responsiveBorderStyle, responsiveRadiusStyle, responsiveShadowStyle, cardStyle);
|
|
4988
5100
|
/**
|
|
4989
5101
|
* @public
|
|
@@ -4991,7 +5103,6 @@ const Root$u = styled(Box)(responsiveBorderStyle, responsiveRadiusStyle, respons
|
|
|
4991
5103
|
|
|
4992
5104
|
const Card = /*#__PURE__*/forwardRef(function Card(props, ref) {
|
|
4993
5105
|
const {
|
|
4994
|
-
pressed = false,
|
|
4995
5106
|
__unstable_checkered: checkered = false,
|
|
4996
5107
|
__unstable_focusRing: focusRing = false,
|
|
4997
5108
|
as: asProp,
|
|
@@ -5000,13 +5111,14 @@ const Card = /*#__PURE__*/forwardRef(function Card(props, ref) {
|
|
|
5000
5111
|
borderRight,
|
|
5001
5112
|
borderBottom,
|
|
5002
5113
|
borderLeft,
|
|
5114
|
+
pressed,
|
|
5003
5115
|
radius = 0,
|
|
5004
5116
|
scheme,
|
|
5005
5117
|
selected,
|
|
5006
5118
|
shadow,
|
|
5007
5119
|
tone: toneProp = 'default'
|
|
5008
5120
|
} = props,
|
|
5009
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
5121
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$z);
|
|
5010
5122
|
|
|
5011
5123
|
const as = isValidElementType(asProp) ? asProp : 'div';
|
|
5012
5124
|
const rootTheme = useRootTheme();
|
|
@@ -5016,34 +5128,34 @@ const Card = /*#__PURE__*/forwardRef(function Card(props, ref) {
|
|
|
5016
5128
|
tone: tone
|
|
5017
5129
|
}, /*#__PURE__*/React.createElement(Root$u, _extends({
|
|
5018
5130
|
"data-as": typeof as === 'string' ? as : undefined,
|
|
5019
|
-
"data-checkered": checkered ? '' : undefined,
|
|
5020
|
-
"data-pressed": pressed ? '' : undefined,
|
|
5021
5131
|
"data-scheme": rootTheme.scheme,
|
|
5022
|
-
"data-selected": selected ? '' : undefined,
|
|
5023
5132
|
"data-ui": "Card",
|
|
5024
5133
|
"data-tone": tone
|
|
5025
5134
|
}, restProps, {
|
|
5026
|
-
"$border": border,
|
|
5027
|
-
"$borderTop": borderTop,
|
|
5028
|
-
"$borderRight": borderRight,
|
|
5029
|
-
"$borderBottom": borderBottom,
|
|
5030
|
-
"$borderLeft": borderLeft,
|
|
5135
|
+
"$border": useArrayProp(border),
|
|
5136
|
+
"$borderTop": useArrayProp(borderTop),
|
|
5137
|
+
"$borderRight": useArrayProp(borderRight),
|
|
5138
|
+
"$borderBottom": useArrayProp(borderBottom),
|
|
5139
|
+
"$borderLeft": useArrayProp(borderLeft),
|
|
5031
5140
|
"$checkered": checkered,
|
|
5032
5141
|
"$focusRing": focusRing,
|
|
5033
|
-
"$radius": radius,
|
|
5034
|
-
"$shadow": shadow,
|
|
5142
|
+
"$radius": useArrayProp(radius),
|
|
5143
|
+
"$shadow": useArrayProp(shadow),
|
|
5035
5144
|
"$tone": tone,
|
|
5145
|
+
"data-checkered": checkered ? '' : undefined,
|
|
5146
|
+
"data-pressed": pressed ? '' : undefined,
|
|
5147
|
+
"data-selected": selected ? '' : undefined,
|
|
5036
5148
|
forwardedAs: as,
|
|
5037
5149
|
ref: ref,
|
|
5038
5150
|
selected: selected
|
|
5039
5151
|
})));
|
|
5040
5152
|
});
|
|
5041
5153
|
|
|
5042
|
-
let _$
|
|
5043
|
-
_t$
|
|
5044
|
-
_t2$
|
|
5154
|
+
let _$r = t => t,
|
|
5155
|
+
_t$r,
|
|
5156
|
+
_t2$h;
|
|
5045
5157
|
function checkboxBaseStyles() {
|
|
5046
|
-
return css(_t$
|
|
5158
|
+
return css(_t$r || (_t$r = _$r`
|
|
5047
5159
|
position: relative;
|
|
5048
5160
|
display: inline-block;
|
|
5049
5161
|
`));
|
|
@@ -5058,7 +5170,7 @@ function inputElementStyles(props) {
|
|
|
5058
5170
|
input,
|
|
5059
5171
|
radius
|
|
5060
5172
|
} = theme.sanity;
|
|
5061
|
-
return css(_t2$
|
|
5173
|
+
return css(_t2$h || (_t2$h = _$r`
|
|
5062
5174
|
position: absolute;
|
|
5063
5175
|
top: 0;
|
|
5064
5176
|
left: 0;
|
|
@@ -5143,7 +5255,7 @@ function inputElementStyles(props) {
|
|
|
5143
5255
|
}), color.default.disabled.fg);
|
|
5144
5256
|
}
|
|
5145
5257
|
|
|
5146
|
-
const _excluded$
|
|
5258
|
+
const _excluded$y = ["checked", "className", "disabled", "indeterminate", "customValidity", "readOnly", "style"];
|
|
5147
5259
|
const Root$t = styled.div(checkboxBaseStyles);
|
|
5148
5260
|
const Input$5 = styled.input(inputElementStyles);
|
|
5149
5261
|
/**
|
|
@@ -5160,7 +5272,7 @@ const Checkbox = /*#__PURE__*/forwardRef(function Checkbox(props, forwardedRef)
|
|
|
5160
5272
|
readOnly,
|
|
5161
5273
|
style
|
|
5162
5274
|
} = props,
|
|
5163
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
5275
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$y);
|
|
5164
5276
|
|
|
5165
5277
|
const ref = useForwardedRef(forwardedRef);
|
|
5166
5278
|
useCustomValidity(ref, customValidity);
|
|
@@ -5185,8 +5297,8 @@ const Checkbox = /*#__PURE__*/forwardRef(function Checkbox(props, forwardedRef)
|
|
|
5185
5297
|
})), /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement(CheckmarkIcon, null), /*#__PURE__*/React.createElement(RemoveIcon, null)));
|
|
5186
5298
|
});
|
|
5187
5299
|
|
|
5188
|
-
let _$
|
|
5189
|
-
_t$
|
|
5300
|
+
let _$q = t => t,
|
|
5301
|
+
_t$q;
|
|
5190
5302
|
|
|
5191
5303
|
function codeSyntaxHighlightingStyle({
|
|
5192
5304
|
theme
|
|
@@ -5305,7 +5417,7 @@ function codeSyntaxHighlightingStyle({
|
|
|
5305
5417
|
}
|
|
5306
5418
|
|
|
5307
5419
|
function codeBaseStyle() {
|
|
5308
|
-
return css(_t$
|
|
5420
|
+
return css(_t$q || (_t$q = _$q`
|
|
5309
5421
|
color: var(--card-code-fg-color);
|
|
5310
5422
|
|
|
5311
5423
|
& code {
|
|
@@ -5328,7 +5440,7 @@ function codeBaseStyle() {
|
|
|
5328
5440
|
`), codeSyntaxHighlightingStyle);
|
|
5329
5441
|
}
|
|
5330
5442
|
|
|
5331
|
-
const _excluded$
|
|
5443
|
+
const _excluded$x = ["children", "language", "size", "weight"];
|
|
5332
5444
|
const Root$s = styled.pre(codeBaseStyle, responsiveCodeFontStyle);
|
|
5333
5445
|
/**
|
|
5334
5446
|
* @public
|
|
@@ -5341,14 +5453,14 @@ const Code = /*#__PURE__*/forwardRef(function Code(props, ref) {
|
|
|
5341
5453
|
size = 2,
|
|
5342
5454
|
weight
|
|
5343
5455
|
} = props,
|
|
5344
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
5456
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$x);
|
|
5345
5457
|
|
|
5346
5458
|
const language = typeof languageProp === 'string' ? languageProp : undefined;
|
|
5347
5459
|
const registered = language ? Refractor.hasLanguage(language) : false;
|
|
5348
5460
|
return /*#__PURE__*/React.createElement(Root$s, _extends({
|
|
5349
5461
|
"data-ui": "Code"
|
|
5350
5462
|
}, restProps, {
|
|
5351
|
-
"$size": size,
|
|
5463
|
+
"$size": useArrayProp(size),
|
|
5352
5464
|
"$weight": weight,
|
|
5353
5465
|
ref: ref
|
|
5354
5466
|
}), !(language && registered) && /*#__PURE__*/React.createElement("code", null, children), language && registered && /*#__PURE__*/React.createElement(Refractor, {
|
|
@@ -5373,12 +5485,12 @@ function responsiveContainerWidthStyle(props) {
|
|
|
5373
5485
|
container,
|
|
5374
5486
|
media
|
|
5375
5487
|
} = theme.sanity;
|
|
5376
|
-
return
|
|
5488
|
+
return _responsive(media, props.$width, val => ({
|
|
5377
5489
|
maxWidth: val === 'auto' ? 'none' : rem(container[val])
|
|
5378
5490
|
}));
|
|
5379
5491
|
}
|
|
5380
5492
|
|
|
5381
|
-
const _excluded$
|
|
5493
|
+
const _excluded$w = ["as", "width"];
|
|
5382
5494
|
const Root$r = styled(Box)(containerBaseStyle, responsiveContainerWidthStyle);
|
|
5383
5495
|
/**
|
|
5384
5496
|
* @public
|
|
@@ -5389,18 +5501,18 @@ const Container = /*#__PURE__*/forwardRef(function Container(props, ref) {
|
|
|
5389
5501
|
as,
|
|
5390
5502
|
width = 2
|
|
5391
5503
|
} = props,
|
|
5392
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
5504
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$w);
|
|
5393
5505
|
|
|
5394
5506
|
return /*#__PURE__*/React.createElement(Root$r, _extends({
|
|
5395
5507
|
"data-ui": "Container"
|
|
5396
5508
|
}, restProps, {
|
|
5397
|
-
"$width": width,
|
|
5509
|
+
"$width": useArrayProp(width),
|
|
5398
5510
|
forwardedAs: as,
|
|
5399
5511
|
ref: ref
|
|
5400
5512
|
}));
|
|
5401
5513
|
});
|
|
5402
5514
|
|
|
5403
|
-
const _excluded$
|
|
5515
|
+
const _excluded$v = ["as", "autoRows", "autoCols", "autoFlow", "columns", "gap", "gapX", "gapY", "rows", "children"];
|
|
5404
5516
|
const Root$q = styled(Box)(responsiveGridStyle);
|
|
5405
5517
|
/**
|
|
5406
5518
|
* @public
|
|
@@ -5419,36 +5531,36 @@ const Grid = /*#__PURE__*/forwardRef(function Grid(props, ref) {
|
|
|
5419
5531
|
rows,
|
|
5420
5532
|
children
|
|
5421
5533
|
} = props,
|
|
5422
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
5534
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$v);
|
|
5423
5535
|
|
|
5424
5536
|
return /*#__PURE__*/React.createElement(Root$q, _extends({
|
|
5425
5537
|
"data-as": typeof as === 'string' ? as : undefined,
|
|
5426
5538
|
"data-ui": "Grid"
|
|
5427
5539
|
}, restProps, {
|
|
5428
|
-
"$autoRows": autoRows,
|
|
5429
|
-
"$autoCols": autoCols,
|
|
5430
|
-
"$autoFlow": autoFlow,
|
|
5431
|
-
"$columns": columns,
|
|
5432
|
-
"$gap": gap,
|
|
5433
|
-
"$gapX": gapX,
|
|
5434
|
-
"$gapY": gapY,
|
|
5435
|
-
"$rows": rows,
|
|
5540
|
+
"$autoRows": useArrayProp(autoRows),
|
|
5541
|
+
"$autoCols": useArrayProp(autoCols),
|
|
5542
|
+
"$autoFlow": useArrayProp(autoFlow),
|
|
5543
|
+
"$columns": useArrayProp(columns),
|
|
5544
|
+
"$gap": useArrayProp(gap),
|
|
5545
|
+
"$gapX": useArrayProp(gapX),
|
|
5546
|
+
"$gapY": useArrayProp(gapY),
|
|
5547
|
+
"$rows": useArrayProp(rows),
|
|
5436
5548
|
forwardedAs: as,
|
|
5437
5549
|
ref: ref
|
|
5438
5550
|
}), children);
|
|
5439
5551
|
});
|
|
5440
5552
|
|
|
5441
|
-
let _$
|
|
5442
|
-
_t$
|
|
5443
|
-
_t2$
|
|
5444
|
-
_t3$
|
|
5553
|
+
let _$p = t => t,
|
|
5554
|
+
_t$p,
|
|
5555
|
+
_t2$g,
|
|
5556
|
+
_t3$9;
|
|
5445
5557
|
function headingBaseStyle(props) {
|
|
5446
5558
|
const {
|
|
5447
5559
|
$accent,
|
|
5448
5560
|
$muted,
|
|
5449
5561
|
theme
|
|
5450
5562
|
} = props;
|
|
5451
|
-
return css(_t$
|
|
5563
|
+
return css(_t$p || (_t$p = _$p`
|
|
5452
5564
|
${0}
|
|
5453
5565
|
|
|
5454
5566
|
${0}
|
|
@@ -5482,19 +5594,19 @@ function headingBaseStyle(props) {
|
|
|
5482
5594
|
& [data-sanity-icon] {
|
|
5483
5595
|
vertical-align: baseline;
|
|
5484
5596
|
}
|
|
5485
|
-
`), $accent && css(_t2$
|
|
5597
|
+
`), $accent && css(_t2$g || (_t2$g = _$p`
|
|
5486
5598
|
color: var(--card-accent-fg-color);
|
|
5487
|
-
`)), $muted && css(_t3$
|
|
5599
|
+
`)), $muted && css(_t3$9 || (_t3$9 = _$p`
|
|
5488
5600
|
color: var(--card-muted-fg-color);
|
|
5489
5601
|
`)), theme.sanity.fonts.code.family);
|
|
5490
5602
|
}
|
|
5491
5603
|
|
|
5492
|
-
const _excluded$
|
|
5604
|
+
const _excluded$u = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
|
|
5493
5605
|
|
|
5494
|
-
let _$
|
|
5495
|
-
_t$
|
|
5606
|
+
let _$o = t => t,
|
|
5607
|
+
_t$o;
|
|
5496
5608
|
const Root$p = styled.div(headingBaseStyle, responsiveTextAlignStyle, responsiveHeadingFont);
|
|
5497
|
-
const SpanWithTextOverflow = styled.span(_t$
|
|
5609
|
+
const SpanWithTextOverflow = styled.span(_t$o || (_t$o = _$o`
|
|
5498
5610
|
display: block;
|
|
5499
5611
|
white-space: nowrap;
|
|
5500
5612
|
text-overflow: ellipsis;
|
|
@@ -5514,7 +5626,7 @@ const Heading = /*#__PURE__*/forwardRef(function Heading(props, ref) {
|
|
|
5514
5626
|
textOverflow,
|
|
5515
5627
|
weight
|
|
5516
5628
|
} = props,
|
|
5517
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
5629
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$u);
|
|
5518
5630
|
|
|
5519
5631
|
let children = childrenProp;
|
|
5520
5632
|
|
|
@@ -5526,9 +5638,9 @@ const Heading = /*#__PURE__*/forwardRef(function Heading(props, ref) {
|
|
|
5526
5638
|
"data-ui": "Heading"
|
|
5527
5639
|
}, restProps, {
|
|
5528
5640
|
"$accent": accent,
|
|
5529
|
-
"$align": align,
|
|
5641
|
+
"$align": useArrayProp(align),
|
|
5530
5642
|
"$muted": muted,
|
|
5531
|
-
"$size": size,
|
|
5643
|
+
"$size": useArrayProp(size),
|
|
5532
5644
|
"$weight": weight,
|
|
5533
5645
|
ref: ref
|
|
5534
5646
|
}), /*#__PURE__*/React.createElement("span", null, children));
|
|
@@ -5550,7 +5662,7 @@ function inlineSpaceStyle(props) {
|
|
|
5550
5662
|
const {
|
|
5551
5663
|
theme
|
|
5552
5664
|
} = props;
|
|
5553
|
-
return
|
|
5665
|
+
return _responsive(theme.sanity.media, props.$space, spaceIndex => {
|
|
5554
5666
|
const space = rem(theme.sanity.space[spaceIndex]);
|
|
5555
5667
|
return {
|
|
5556
5668
|
margin: `-${space} 0 0 -${space}`,
|
|
@@ -5561,7 +5673,7 @@ function inlineSpaceStyle(props) {
|
|
|
5561
5673
|
});
|
|
5562
5674
|
}
|
|
5563
5675
|
|
|
5564
|
-
const _excluded$
|
|
5676
|
+
const _excluded$t = ["as", "children", "space"];
|
|
5565
5677
|
const Root$o = styled(Box)(inlineBaseStyle, inlineSpaceStyle);
|
|
5566
5678
|
/**
|
|
5567
5679
|
* @public
|
|
@@ -5573,27 +5685,27 @@ const Inline = /*#__PURE__*/forwardRef(function Inline(props, ref) {
|
|
|
5573
5685
|
children: childrenProp,
|
|
5574
5686
|
space
|
|
5575
5687
|
} = props,
|
|
5576
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
5688
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$t);
|
|
5577
5689
|
|
|
5578
|
-
const children = childrenToElementArray(childrenProp).filter(Boolean)
|
|
5690
|
+
const children = useMemo(() => childrenToElementArray(childrenProp).filter(Boolean).map((child, idx) => /*#__PURE__*/React.createElement("div", {
|
|
5691
|
+
key: idx
|
|
5692
|
+
}, child)), [childrenProp]);
|
|
5579
5693
|
return /*#__PURE__*/React.createElement(Root$o, _extends({
|
|
5580
5694
|
"data-ui": "Inline"
|
|
5581
5695
|
}, restProps, {
|
|
5582
|
-
"$space": space,
|
|
5696
|
+
"$space": useArrayProp(space),
|
|
5583
5697
|
forwardedAs: as,
|
|
5584
5698
|
ref: ref
|
|
5585
|
-
}), children
|
|
5586
|
-
key: idx
|
|
5587
|
-
}, child)));
|
|
5699
|
+
}), children);
|
|
5588
5700
|
});
|
|
5589
5701
|
|
|
5590
|
-
const _excluded$
|
|
5702
|
+
const _excluded$s = ["children", "fontSize", "padding", "radius"];
|
|
5591
5703
|
|
|
5592
|
-
let _$
|
|
5593
|
-
_t$
|
|
5704
|
+
let _$n = t => t,
|
|
5705
|
+
_t$n;
|
|
5594
5706
|
|
|
5595
5707
|
function kbdStyle() {
|
|
5596
|
-
return css(_t$
|
|
5708
|
+
return css(_t$n || (_t$n = _$n`
|
|
5597
5709
|
background: var(--card-bg-color);
|
|
5598
5710
|
font: inherit;
|
|
5599
5711
|
box-shadow: inset 0 0 0 1px var(--card-hairline-hard-color);
|
|
@@ -5616,12 +5728,12 @@ const KBD = /*#__PURE__*/forwardRef(function KBD(props, ref) {
|
|
|
5616
5728
|
padding = 1,
|
|
5617
5729
|
radius = 2
|
|
5618
5730
|
} = props,
|
|
5619
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
5731
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$s);
|
|
5620
5732
|
|
|
5621
5733
|
return /*#__PURE__*/React.createElement(Root$n, _extends({
|
|
5622
5734
|
"data-ui": "KBD"
|
|
5623
5735
|
}, restProps, {
|
|
5624
|
-
"$radius": radius,
|
|
5736
|
+
"$radius": useArrayProp(radius),
|
|
5625
5737
|
ref: ref
|
|
5626
5738
|
}), /*#__PURE__*/React.createElement(Box, {
|
|
5627
5739
|
as: "span",
|
|
@@ -5675,12 +5787,6 @@ function useBoundaryElement() {
|
|
|
5675
5787
|
return value || DEFAULT_VALUE;
|
|
5676
5788
|
}
|
|
5677
5789
|
|
|
5678
|
-
/**
|
|
5679
|
-
* @internal
|
|
5680
|
-
*/
|
|
5681
|
-
|
|
5682
|
-
const RO = typeof window !== 'undefined' && window.ResizeObserver ? window.ResizeObserver : ResizeObserver$1;
|
|
5683
|
-
|
|
5684
5790
|
function findMaxBreakpoints(media, width) {
|
|
5685
5791
|
const ret = [];
|
|
5686
5792
|
|
|
@@ -5708,7 +5814,7 @@ function findMinBreakpoints(media, width) {
|
|
|
5708
5814
|
return ret;
|
|
5709
5815
|
}
|
|
5710
5816
|
|
|
5711
|
-
const _excluded$
|
|
5817
|
+
const _excluded$r = ["children", "media"];
|
|
5712
5818
|
/**
|
|
5713
5819
|
* DO NOT USE IN PRODUCTION.
|
|
5714
5820
|
* @beta
|
|
@@ -5721,22 +5827,16 @@ const ElementQuery = /*#__PURE__*/forwardRef(function ElementQuery(props, ref) {
|
|
|
5721
5827
|
children,
|
|
5722
5828
|
media = theme.sanity.media
|
|
5723
5829
|
} = props,
|
|
5724
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
5830
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$r);
|
|
5725
5831
|
|
|
5726
|
-
const [width, setWidth] = useState(() => window.innerWidth);
|
|
5727
5832
|
const forwardedRef = useForwardedRef(ref);
|
|
5728
5833
|
const [element, setElement] = useState(null);
|
|
5729
|
-
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
const handleResizeEntries = entries => {
|
|
5733
|
-
setWidth(entries[0].contentRect.width);
|
|
5734
|
-
};
|
|
5834
|
+
const elementSize = useElementSize(element);
|
|
5835
|
+
const width = useMemo(() => {
|
|
5836
|
+
var _elementSize$border$w;
|
|
5735
5837
|
|
|
5736
|
-
|
|
5737
|
-
|
|
5738
|
-
return () => ro.disconnect();
|
|
5739
|
-
}, [element]);
|
|
5838
|
+
return (_elementSize$border$w = elementSize == null ? void 0 : elementSize.border.width) != null ? _elementSize$border$w : window.innerWidth;
|
|
5839
|
+
}, [elementSize]);
|
|
5740
5840
|
const max = useMemo(() => findMaxBreakpoints(media, width), [media, width]);
|
|
5741
5841
|
const min = useMemo(() => findMinBreakpoints(media, width), [media, width]);
|
|
5742
5842
|
const setRef = useCallback(el => {
|
|
@@ -5829,7 +5929,7 @@ function LayerProvider(props) {
|
|
|
5829
5929
|
zOffset: zOffsetProp = 0
|
|
5830
5930
|
} = props;
|
|
5831
5931
|
const parent = useContext(LayerContext);
|
|
5832
|
-
const zOffset =
|
|
5932
|
+
const zOffset = useArrayProp(zOffsetProp);
|
|
5833
5933
|
const maxMediaIndex = zOffset.length - 1;
|
|
5834
5934
|
const mediaIndex = Math.min(useMediaIndex(), maxMediaIndex);
|
|
5835
5935
|
const zIndex = parent ? parent.zIndex + zOffset[mediaIndex] : zOffset[mediaIndex];
|
|
@@ -5855,25 +5955,26 @@ function LayerProvider(props) {
|
|
|
5855
5955
|
}, children);
|
|
5856
5956
|
}
|
|
5857
5957
|
|
|
5858
|
-
const _excluded$
|
|
5958
|
+
const _excluded$q = ["children", "style"],
|
|
5859
5959
|
_excluded2$1 = ["children", "zOffset"];
|
|
5860
5960
|
|
|
5861
|
-
let _$
|
|
5862
|
-
_t$
|
|
5863
|
-
const Root$m = styled.div(_t$
|
|
5961
|
+
let _$m = t => t,
|
|
5962
|
+
_t$m;
|
|
5963
|
+
const Root$m = styled.div(_t$m || (_t$m = _$m`
|
|
5864
5964
|
position: relative;
|
|
5865
5965
|
`));
|
|
5866
5966
|
const LayerChildren = /*#__PURE__*/forwardRef(function LayerChildren(props, ref) {
|
|
5867
5967
|
const {
|
|
5868
5968
|
children,
|
|
5869
|
-
style = EMPTY_RECORD
|
|
5969
|
+
style = EMPTY_RECORD
|
|
5870
5970
|
} = props,
|
|
5871
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
5971
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$q);
|
|
5872
5972
|
|
|
5873
5973
|
const {
|
|
5874
5974
|
zIndex
|
|
5875
5975
|
} = useLayer();
|
|
5876
5976
|
return /*#__PURE__*/React.createElement(Root$m, _extends({}, restProps, {
|
|
5977
|
+
"data-ui": "Layer",
|
|
5877
5978
|
ref: ref,
|
|
5878
5979
|
style: _extends({}, style, {
|
|
5879
5980
|
zIndex
|
|
@@ -5969,14 +6070,14 @@ function Portal(props) {
|
|
|
5969
6070
|
function useUnique(value) {
|
|
5970
6071
|
const valueRef = useRef(value);
|
|
5971
6072
|
|
|
5972
|
-
if (!
|
|
6073
|
+
if (!_isEqual(valueRef.current, value)) {
|
|
5973
6074
|
valueRef.current = value;
|
|
5974
6075
|
}
|
|
5975
6076
|
|
|
5976
6077
|
return valueRef.current;
|
|
5977
6078
|
}
|
|
5978
6079
|
|
|
5979
|
-
function
|
|
6080
|
+
function _isEqual(objA, objB) {
|
|
5980
6081
|
if (!objA || !objB) {
|
|
5981
6082
|
return objA === objB;
|
|
5982
6083
|
}
|
|
@@ -6018,9 +6119,9 @@ function PortalProvider(props) {
|
|
|
6018
6119
|
}, children);
|
|
6019
6120
|
}
|
|
6020
6121
|
|
|
6021
|
-
let _$
|
|
6022
|
-
_t$
|
|
6023
|
-
const Root$l = styled.div(_t$
|
|
6122
|
+
let _$l = t => t,
|
|
6123
|
+
_t$l;
|
|
6124
|
+
const Root$l = styled.div(_t$l || (_t$l = _$l`
|
|
6024
6125
|
display: block;
|
|
6025
6126
|
width: 0;
|
|
6026
6127
|
height: 0;
|
|
@@ -6210,15 +6311,15 @@ function _isScrollable(el) {
|
|
|
6210
6311
|
return style.overflowX.includes('auto') || style.overflowX.includes('scroll') || style.overflowY.includes('auto') || style.overflowY.includes('scroll');
|
|
6211
6312
|
}
|
|
6212
6313
|
|
|
6213
|
-
const _excluded$
|
|
6314
|
+
const _excluded$p = ["as", "gap", "getItemKey", "items", "onChange", "renderItem"];
|
|
6214
6315
|
|
|
6215
|
-
let _$
|
|
6216
|
-
_t$
|
|
6217
|
-
_t2$
|
|
6218
|
-
const Root$k = styled.div(_t$
|
|
6316
|
+
let _$k = t => t,
|
|
6317
|
+
_t$k,
|
|
6318
|
+
_t2$f;
|
|
6319
|
+
const Root$k = styled.div(_t$k || (_t$k = _$k`
|
|
6219
6320
|
position: relative;
|
|
6220
6321
|
`));
|
|
6221
|
-
const ItemWrapper = styled.div(_t2$
|
|
6322
|
+
const ItemWrapper = styled.div(_t2$f || (_t2$f = _$k`
|
|
6222
6323
|
position: absolute;
|
|
6223
6324
|
left: 0;
|
|
6224
6325
|
right: 0;
|
|
@@ -6236,7 +6337,7 @@ const VirtualList = /*#__PURE__*/forwardRef(function VirtualList(props, ref) {
|
|
|
6236
6337
|
onChange,
|
|
6237
6338
|
renderItem
|
|
6238
6339
|
} = props,
|
|
6239
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
6340
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$p);
|
|
6240
6341
|
|
|
6241
6342
|
const {
|
|
6242
6343
|
space
|
|
@@ -6273,17 +6374,16 @@ const VirtualList = /*#__PURE__*/forwardRef(function VirtualList(props, ref) {
|
|
|
6273
6374
|
scrollEl.addEventListener('scroll', _handleScroll, {
|
|
6274
6375
|
passive: true
|
|
6275
6376
|
});
|
|
6276
|
-
|
|
6277
|
-
|
|
6377
|
+
|
|
6378
|
+
const disposeElementSizeListener = _elementSizeObserver.subscribe(scrollEl, scrollElementSize => {
|
|
6379
|
+
setScrollHeight(scrollElementSize.content.height);
|
|
6278
6380
|
});
|
|
6279
|
-
ro.observe(scrollEl);
|
|
6280
6381
|
|
|
6281
6382
|
_handleScroll();
|
|
6282
6383
|
|
|
6283
6384
|
return () => {
|
|
6284
6385
|
scrollEl.removeEventListener('scroll', _handleScroll);
|
|
6285
|
-
|
|
6286
|
-
ro.disconnect();
|
|
6386
|
+
disposeElementSizeListener();
|
|
6287
6387
|
};
|
|
6288
6388
|
}
|
|
6289
6389
|
|
|
@@ -6356,11 +6456,11 @@ const VirtualList = /*#__PURE__*/forwardRef(function VirtualList(props, ref) {
|
|
|
6356
6456
|
}, children));
|
|
6357
6457
|
});
|
|
6358
6458
|
|
|
6359
|
-
let _$
|
|
6360
|
-
_t$
|
|
6361
|
-
_t2$
|
|
6362
|
-
_t3$
|
|
6363
|
-
const Root$j = styled.div(_t$
|
|
6459
|
+
let _$j = t => t,
|
|
6460
|
+
_t$j,
|
|
6461
|
+
_t2$e,
|
|
6462
|
+
_t3$8;
|
|
6463
|
+
const Root$j = styled.div(_t$j || (_t$j = _$j`
|
|
6364
6464
|
position: absolute;
|
|
6365
6465
|
pointer-events: none;
|
|
6366
6466
|
width: 27px;
|
|
@@ -6376,11 +6476,11 @@ const Root$j = styled.div(_t$k || (_t$k = _$i`
|
|
|
6376
6476
|
transform-origin: 13.5px 13.5px;
|
|
6377
6477
|
}
|
|
6378
6478
|
|
|
6379
|
-
[data-
|
|
6479
|
+
[data-placement^='top'] > & {
|
|
6380
6480
|
bottom: -27px;
|
|
6381
6481
|
}
|
|
6382
6482
|
|
|
6383
|
-
[data-
|
|
6483
|
+
[data-placement^='right'] > & {
|
|
6384
6484
|
left: -27px;
|
|
6385
6485
|
|
|
6386
6486
|
& > svg {
|
|
@@ -6388,7 +6488,7 @@ const Root$j = styled.div(_t$k || (_t$k = _$i`
|
|
|
6388
6488
|
}
|
|
6389
6489
|
}
|
|
6390
6490
|
|
|
6391
|
-
[data-
|
|
6491
|
+
[data-placement^='left'] > & {
|
|
6392
6492
|
right: -27px;
|
|
6393
6493
|
|
|
6394
6494
|
& > svg {
|
|
@@ -6396,7 +6496,7 @@ const Root$j = styled.div(_t$k || (_t$k = _$i`
|
|
|
6396
6496
|
}
|
|
6397
6497
|
}
|
|
6398
6498
|
|
|
6399
|
-
[data-
|
|
6499
|
+
[data-placement^='bottom'] > & {
|
|
6400
6500
|
top: -27px;
|
|
6401
6501
|
|
|
6402
6502
|
& > svg {
|
|
@@ -6404,15 +6504,15 @@ const Root$j = styled.div(_t$k || (_t$k = _$i`
|
|
|
6404
6504
|
}
|
|
6405
6505
|
}
|
|
6406
6506
|
`));
|
|
6407
|
-
const BorderPath = styled.path(_t2$
|
|
6507
|
+
const BorderPath = styled.path(_t2$e || (_t2$e = _$j`
|
|
6408
6508
|
fill: var(--card-shadow-outline-color);
|
|
6409
6509
|
`));
|
|
6410
|
-
const ShapePath = styled.path(_t3$
|
|
6510
|
+
const ShapePath = styled.path(_t3$8 || (_t3$8 = _$j`
|
|
6411
6511
|
fill: var(--card-bg-color);
|
|
6412
6512
|
`));
|
|
6413
6513
|
const PopoverArrow = /*#__PURE__*/forwardRef(function PopoverArrow(props, ref) {
|
|
6414
6514
|
return /*#__PURE__*/React.createElement(Root$j, _extends({
|
|
6415
|
-
"data-ui": "
|
|
6515
|
+
"data-ui": "Popover__arrow"
|
|
6416
6516
|
}, props, {
|
|
6417
6517
|
ref: ref
|
|
6418
6518
|
}), /*#__PURE__*/React.createElement("svg", {
|
|
@@ -6426,355 +6526,296 @@ const PopoverArrow = /*#__PURE__*/forwardRef(function PopoverArrow(props, ref) {
|
|
|
6426
6526
|
}), /*#__PURE__*/React.createElement(ShapePath, {
|
|
6427
6527
|
d: "M1.18342 0C3.59749 0 5.88246 1.0901 7.40138 2.96642L11.9455 8.57975C12.746 9.56855 14.254 9.56855 15.0545 8.57975L19.5986 2.96641C21.1175 1.0901 23.4025 0 25.8166 0H27H0H1.18342Z"
|
|
6428
6528
|
})));
|
|
6429
|
-
});
|
|
6430
|
-
|
|
6431
|
-
/*
|
|
6432
|
-
|
|
6433
|
-
The order of popper phases:
|
|
6434
|
-
|
|
6435
|
-
- beforeRead
|
|
6436
|
-
- read
|
|
6437
|
-
- afterRead
|
|
6438
|
-
- beforeMain
|
|
6439
|
-
- main
|
|
6440
|
-
- afterMain
|
|
6441
|
-
- beforeWrite
|
|
6442
|
-
- write
|
|
6443
|
-
- afterWrite
|
|
6529
|
+
});
|
|
6444
6530
|
|
|
6445
|
-
|
|
6531
|
+
const _excluded$o = ["__unstable_margins", "arrow", "arrowRef", "arrowX", "arrowY", "availableHeight", "availableWidth", "boundaryWidth", "children", "padding", "placement", "overflow", "radius", "referenceWidth", "scheme", "shadow", "strategy", "tone", "width", "x", "y"];
|
|
6446
6532
|
|
|
6447
|
-
function
|
|
6533
|
+
function popoverCardStyle(props) {
|
|
6448
6534
|
const {
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
|
|
6452
|
-
|
|
6453
|
-
constrainSize,
|
|
6454
|
-
distance,
|
|
6455
|
-
fallbackPlacements,
|
|
6456
|
-
margins,
|
|
6457
|
-
matchReferenceWidth,
|
|
6458
|
-
open,
|
|
6459
|
-
preventOverflow,
|
|
6460
|
-
skidding,
|
|
6461
|
-
tether,
|
|
6462
|
-
tetherOffset
|
|
6463
|
-
} = props; // NOTE: For later viewers:
|
|
6464
|
-
// Prior to adding this change, the popover would get `maxWidth: 0` the 2nd time it
|
|
6465
|
-
// was opened, when used with `constrainSize`. I was looking for a way to "reset"
|
|
6466
|
-
// the size of the popover as measured by Popper.js, and this seems to be a workaround.
|
|
6467
|
-
|
|
6468
|
-
if (!open) {
|
|
6469
|
-
return [];
|
|
6470
|
-
}
|
|
6471
|
-
|
|
6472
|
-
const detectOverflowOptions = {
|
|
6473
|
-
altAxis: !constrainSize,
|
|
6474
|
-
boundary: boundaryElement || undefined,
|
|
6475
|
-
padding: 8,
|
|
6476
|
-
tether,
|
|
6477
|
-
tetherOffset
|
|
6535
|
+
$boundaryWidth
|
|
6536
|
+
} = props;
|
|
6537
|
+
return {
|
|
6538
|
+
maxWidth: $boundaryWidth ? `${$boundaryWidth - 16}px` : 'calc(100% - 16px)'
|
|
6478
6539
|
};
|
|
6479
|
-
return [constrainSize && _extends({}, maxSizeModifier, {
|
|
6480
|
-
options: detectOverflowOptions
|
|
6481
|
-
}), constrainSize && {
|
|
6482
|
-
name: 'applyMaxSize',
|
|
6483
|
-
enabled: true,
|
|
6484
|
-
phase: 'beforeWrite',
|
|
6485
|
-
requires: ['maxSize'],
|
|
6486
|
-
|
|
6487
|
-
fn({
|
|
6488
|
-
state
|
|
6489
|
-
}) {
|
|
6490
|
-
const {
|
|
6491
|
-
width,
|
|
6492
|
-
height
|
|
6493
|
-
} = state.modifiersData.maxSize;
|
|
6494
|
-
state.styles.popper = _extends({}, state.styles.popper, {
|
|
6495
|
-
maxWidth: `${width}px`,
|
|
6496
|
-
maxHeight: `${height}px`
|
|
6497
|
-
});
|
|
6498
|
-
}
|
|
6499
|
-
|
|
6500
|
-
}, arrow && {
|
|
6501
|
-
name: 'arrow',
|
|
6502
|
-
options: {
|
|
6503
|
-
element: arrowElement,
|
|
6504
|
-
padding: 4
|
|
6505
|
-
}
|
|
6506
|
-
}, (constrainSize || preventOverflow) && {
|
|
6507
|
-
name: 'preventOverflow',
|
|
6508
|
-
options: detectOverflowOptions
|
|
6509
|
-
}, {
|
|
6510
|
-
name: 'offset',
|
|
6511
|
-
options: {
|
|
6512
|
-
offset: [skidding, distance]
|
|
6513
|
-
}
|
|
6514
|
-
}, margins && {
|
|
6515
|
-
name: 'margins',
|
|
6516
|
-
enabled: true,
|
|
6517
|
-
phase: 'beforeRead',
|
|
6518
|
-
fn: ({
|
|
6519
|
-
state
|
|
6520
|
-
}) => {
|
|
6521
|
-
const {
|
|
6522
|
-
rects
|
|
6523
|
-
} = state;
|
|
6524
|
-
|
|
6525
|
-
if (rects.reference) {
|
|
6526
|
-
rects.reference.x += margins[3];
|
|
6527
|
-
rects.reference.y += margins[1];
|
|
6528
|
-
rects.reference.width -= margins[1] + margins[3];
|
|
6529
|
-
rects.reference.height -= margins[0] + margins[2];
|
|
6530
|
-
}
|
|
6531
|
-
}
|
|
6532
|
-
}, {
|
|
6533
|
-
name: 'flip',
|
|
6534
|
-
options: {
|
|
6535
|
-
allowedAutoPlacements,
|
|
6536
|
-
boundary: boundaryElement || undefined,
|
|
6537
|
-
fallbackPlacements,
|
|
6538
|
-
padding: 8
|
|
6539
|
-
}
|
|
6540
|
-
}, matchReferenceWidth && {
|
|
6541
|
-
name: 'matchWidth',
|
|
6542
|
-
enabled: true,
|
|
6543
|
-
phase: 'beforeWrite',
|
|
6544
|
-
requires: ['computeStyles'],
|
|
6545
|
-
|
|
6546
|
-
fn({
|
|
6547
|
-
state
|
|
6548
|
-
}) {
|
|
6549
|
-
const {
|
|
6550
|
-
width
|
|
6551
|
-
} = state.rects.reference;
|
|
6552
|
-
state.styles.popper.width = `${width}px`;
|
|
6553
|
-
},
|
|
6554
|
-
|
|
6555
|
-
effect: ({
|
|
6556
|
-
state
|
|
6557
|
-
}) => {
|
|
6558
|
-
const refElement = state.elements.reference;
|
|
6559
|
-
|
|
6560
|
-
if (refElement instanceof HTMLElement) {
|
|
6561
|
-
state.elements.popper.style.width = `${refElement.offsetWidth - (margins ? margins[1] + margins[3] : 0)}px`;
|
|
6562
|
-
}
|
|
6563
|
-
}
|
|
6564
|
-
}].filter(Boolean);
|
|
6565
6540
|
}
|
|
6566
6541
|
|
|
6567
|
-
|
|
6542
|
+
const Root$i = /*#__PURE__*/memo(styled(Card)(popoverCardStyle));
|
|
6543
|
+
/**
|
|
6544
|
+
* @internal
|
|
6545
|
+
*/
|
|
6546
|
+
|
|
6547
|
+
const PopoverCard = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function PopoverCard(props, ref) {
|
|
6568
6548
|
const {
|
|
6569
|
-
|
|
6549
|
+
__unstable_margins: marginsProp,
|
|
6570
6550
|
arrow,
|
|
6571
|
-
|
|
6572
|
-
|
|
6573
|
-
|
|
6574
|
-
|
|
6575
|
-
|
|
6576
|
-
|
|
6577
|
-
|
|
6578
|
-
|
|
6579
|
-
|
|
6580
|
-
|
|
6581
|
-
|
|
6582
|
-
|
|
6583
|
-
|
|
6584
|
-
|
|
6585
|
-
|
|
6586
|
-
|
|
6587
|
-
|
|
6588
|
-
|
|
6589
|
-
|
|
6590
|
-
|
|
6591
|
-
|
|
6592
|
-
fallbackPlacements,
|
|
6593
|
-
margins,
|
|
6594
|
-
matchReferenceWidth,
|
|
6595
|
-
open,
|
|
6596
|
-
preventOverflow,
|
|
6597
|
-
skidding,
|
|
6598
|
-
tether,
|
|
6599
|
-
tetherOffset
|
|
6600
|
-
});
|
|
6601
|
-
}, [allowedAutoPlacements, arrow, arrowElement, boundaryElement, constrainSize, distance, fallbackPlacements, margins, matchReferenceWidth, open, preventOverflow, skidding, tether, tetherOffset]);
|
|
6602
|
-
}
|
|
6603
|
-
|
|
6604
|
-
const _excluded$n = ["__unstable_margins", "allowedAutoPlacements", "arrow", "boundaryElement", "children", "content", "constrainSize", "disabled", "fallbackPlacements", "open", "padding", "placement", "portal", "preventOverflow", "radius", "referenceElement", "matchReferenceWidth", "shadow", "scheme", "style", "tether", "tetherOffset", "tone", "width", "zOffset"];
|
|
6551
|
+
arrowRef,
|
|
6552
|
+
arrowX,
|
|
6553
|
+
arrowY,
|
|
6554
|
+
availableHeight,
|
|
6555
|
+
availableWidth,
|
|
6556
|
+
boundaryWidth,
|
|
6557
|
+
children,
|
|
6558
|
+
padding,
|
|
6559
|
+
placement,
|
|
6560
|
+
overflow,
|
|
6561
|
+
radius,
|
|
6562
|
+
referenceWidth: referenceWidthProp,
|
|
6563
|
+
scheme,
|
|
6564
|
+
shadow,
|
|
6565
|
+
strategy,
|
|
6566
|
+
tone,
|
|
6567
|
+
width,
|
|
6568
|
+
x: xProp,
|
|
6569
|
+
y: yProp
|
|
6570
|
+
} = props,
|
|
6571
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$o);
|
|
6605
6572
|
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
|
|
6609
|
-
|
|
6610
|
-
const
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6573
|
+
const {
|
|
6574
|
+
zIndex
|
|
6575
|
+
} = useLayer(); // top right bottom left
|
|
6576
|
+
|
|
6577
|
+
const margins = useMemo(() => marginsProp || [0, 0, 0, 0], [marginsProp]); // translate according to margins
|
|
6578
|
+
|
|
6579
|
+
const referenceWidth = referenceWidthProp ? referenceWidthProp - margins[1] - margins[3] : undefined;
|
|
6580
|
+
const x = (xProp != null ? xProp : 0) + margins[3];
|
|
6581
|
+
const y = (yProp != null ? yProp : 0) + margins[0];
|
|
6582
|
+
const maxWidth = availableWidth ? Math.min(availableWidth - 8, referenceWidth || Infinity) : undefined;
|
|
6583
|
+
const rootStyle = useMemo(() => ({
|
|
6584
|
+
position: strategy,
|
|
6585
|
+
top: y,
|
|
6586
|
+
left: x,
|
|
6587
|
+
zIndex,
|
|
6588
|
+
width: referenceWidth,
|
|
6589
|
+
maxWidth: referenceWidth ? undefined : maxWidth
|
|
6590
|
+
}), [referenceWidth, maxWidth, strategy, x, y, zIndex]);
|
|
6591
|
+
const wrapperStyle = useMemo(() => ({
|
|
6592
|
+
minHeight: 25,
|
|
6593
|
+
maxHeight: availableHeight ? availableHeight - 8 : undefined
|
|
6594
|
+
}), [availableHeight]);
|
|
6595
|
+
const staticSide = placement && FLOATING_STATIC_SIDES[placement.split('-')[0]];
|
|
6596
|
+
const arrowStyle = useMemo(() => {
|
|
6597
|
+
const style = {
|
|
6598
|
+
left: arrowX !== null ? arrowX : undefined,
|
|
6599
|
+
top: arrowY !== null ? arrowY : undefined,
|
|
6600
|
+
right: undefined,
|
|
6601
|
+
bottom: undefined
|
|
6602
|
+
};
|
|
6603
|
+
if (staticSide) style[staticSide] = -27;
|
|
6604
|
+
return style;
|
|
6605
|
+
}, [arrowX, arrowY, staticSide]);
|
|
6606
|
+
return /*#__PURE__*/React.createElement(Root$i, _extends({}, restProps, {
|
|
6607
|
+
"$boundaryWidth": boundaryWidth,
|
|
6608
|
+
"data-placement": placement,
|
|
6609
|
+
"data-ui": "Popover",
|
|
6610
|
+
radius: radius,
|
|
6611
|
+
ref: ref,
|
|
6612
|
+
scheme: scheme,
|
|
6613
|
+
shadow: shadow,
|
|
6614
|
+
style: rootStyle,
|
|
6615
|
+
tone: tone,
|
|
6616
|
+
"$width": width
|
|
6617
|
+
}), /*#__PURE__*/React.createElement(Box, {
|
|
6618
|
+
"data-ui": "Popover__wrapper",
|
|
6619
|
+
overflow: overflow,
|
|
6620
|
+
padding: padding,
|
|
6621
|
+
sizing: "border",
|
|
6622
|
+
style: wrapperStyle
|
|
6623
|
+
}, children), arrow && /*#__PURE__*/React.createElement(PopoverArrow, {
|
|
6624
|
+
ref: arrowRef,
|
|
6625
|
+
style: arrowStyle
|
|
6626
|
+
}));
|
|
6627
|
+
}));
|
|
6628
|
+
PopoverCard.displayName = 'PopoverCard';
|
|
6617
6629
|
|
|
6618
|
-
|
|
6619
|
-
min-height: 0;
|
|
6620
|
-
}
|
|
6630
|
+
const _excluded$n = ["__unstable_margins", "allowedAutoPlacements", "arrow", "boundaryElement", "children", "constrainSize", "content", "disabled", "fallbackPlacements", "matchReferenceWidth", "open", "overflow", "padding", "placement", "portal", "preventOverflow", "radius", "referenceElement", "scheme", "shadow", "tether", "tetherOffset", "tone", "width", "zOffset"];
|
|
6621
6631
|
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6632
|
+
function size(scope) {
|
|
6633
|
+
return size$1({
|
|
6634
|
+
apply(args) {
|
|
6635
|
+
if (scope.constrainSize) {
|
|
6636
|
+
scope.setAvailableWidth(args.availableWidth);
|
|
6637
|
+
scope.setAvailableHeight(args.availableHeight);
|
|
6627
6638
|
}
|
|
6628
|
-
`))));
|
|
6629
|
-
const PopoverCard = styled(Card)(({
|
|
6630
|
-
$constrainSize
|
|
6631
|
-
}) => css(_t3$8 || (_t3$8 = _2$1`
|
|
6632
|
-
flex: 1;
|
|
6633
|
-
max-height: ${0};
|
|
6634
|
-
pointer-events: all;
|
|
6635
|
-
|
|
6636
|
-
&& {
|
|
6637
|
-
display: flex;
|
|
6638
|
-
}
|
|
6639
|
-
|
|
6640
|
-
flex-direction: column;
|
|
6641
6639
|
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
|
|
6640
|
+
if (scope.matchReferenceWidth) {
|
|
6641
|
+
scope.setReferenceWidth(args.rects.reference.width);
|
|
6642
|
+
}
|
|
6643
|
+
},
|
|
6645
6644
|
|
|
6646
|
-
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
* @public
|
|
6650
|
-
*/
|
|
6645
|
+
boundary: scope.boundaryElement || undefined
|
|
6646
|
+
});
|
|
6647
|
+
}
|
|
6651
6648
|
|
|
6652
|
-
const Popover = /*#__PURE__*/forwardRef(function Popover(props, ref) {
|
|
6653
|
-
var _theme$sanity$layer;
|
|
6649
|
+
const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(function Popover(props, ref) {
|
|
6650
|
+
var _theme$sanity$layer, _useElementSize, _middlewareData$arrow, _middlewareData$arrow2;
|
|
6654
6651
|
|
|
6655
|
-
const boundaryElementContext = useBoundaryElement();
|
|
6656
6652
|
const theme = useTheme();
|
|
6653
|
+
const boundaryElementContext = useBoundaryElement();
|
|
6657
6654
|
|
|
6658
6655
|
const {
|
|
6659
6656
|
__unstable_margins: margins,
|
|
6660
|
-
|
|
6661
|
-
|
|
6662
|
-
|
|
6663
|
-
|
|
6657
|
+
arrow: arrowProp = true,
|
|
6658
|
+
boundaryElement = boundaryElementContext.element,
|
|
6659
|
+
children: childProp,
|
|
6660
|
+
constrainSize = false,
|
|
6664
6661
|
content,
|
|
6665
|
-
constrainSize,
|
|
6666
6662
|
disabled,
|
|
6667
6663
|
fallbackPlacements,
|
|
6668
|
-
|
|
6669
|
-
|
|
6670
|
-
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6664
|
+
matchReferenceWidth: matchReferenceWidthProp,
|
|
6665
|
+
open,
|
|
6666
|
+
overflow = props.constrainSize ? 'auto' : undefined,
|
|
6667
|
+
padding: paddingProp,
|
|
6668
|
+
placement: placementProp = 'bottom',
|
|
6669
|
+
portal,
|
|
6670
|
+
preventOverflow = true,
|
|
6671
|
+
radius: radiusProp = 3,
|
|
6672
|
+
referenceElement,
|
|
6677
6673
|
scheme,
|
|
6678
|
-
|
|
6679
|
-
tether,
|
|
6680
|
-
tetherOffset,
|
|
6674
|
+
shadow: shadowProp = 3,
|
|
6681
6675
|
tone = 'inherit',
|
|
6682
|
-
width =
|
|
6683
|
-
zOffset = (_theme$sanity$layer = theme.sanity.layer) == null ? void 0 : _theme$sanity$layer.popover.zOffset
|
|
6676
|
+
width: widthProp = undefined,
|
|
6677
|
+
zOffset: zOffsetProp = (_theme$sanity$layer = theme.sanity.layer) == null ? void 0 : _theme$sanity$layer.popover.zOffset
|
|
6684
6678
|
} = props,
|
|
6685
6679
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$n);
|
|
6686
6680
|
|
|
6681
|
+
const boundarySize = (_useElementSize = useElementSize(boundaryElement)) == null ? void 0 : _useElementSize.border;
|
|
6682
|
+
const padding = useArrayProp(paddingProp);
|
|
6683
|
+
const radius = useArrayProp(radiusProp);
|
|
6684
|
+
const shadow = useArrayProp(shadowProp);
|
|
6685
|
+
const width = useArrayProp(widthProp);
|
|
6686
|
+
const zOffset = useArrayProp(zOffsetProp);
|
|
6687
|
+
const [availableWidth, setAvailableWidth] = useState(undefined);
|
|
6688
|
+
const [availableHeight, setAvailableHeight] = useState(undefined);
|
|
6689
|
+
const [referenceWidth, setReferenceWidth] = useState(undefined);
|
|
6687
6690
|
const forwardedRef = useForwardedRef(ref);
|
|
6688
|
-
const
|
|
6689
|
-
const
|
|
6690
|
-
const
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
|
|
6691
|
+
const arrowRef = useRef(null);
|
|
6692
|
+
const rootBoundary = 'viewport';
|
|
6693
|
+
const middleware = useMemo(() => {
|
|
6694
|
+
const ret = []; // Flip the floating element when leaving the boundary box
|
|
6695
|
+
|
|
6696
|
+
if (constrainSize || preventOverflow) {
|
|
6697
|
+
ret.push(flip({
|
|
6698
|
+
boundary: boundaryElement || undefined,
|
|
6699
|
+
fallbackPlacements,
|
|
6700
|
+
padding: 8,
|
|
6701
|
+
rootBoundary
|
|
6702
|
+
}));
|
|
6703
|
+
} // Track sizes
|
|
6704
|
+
|
|
6705
|
+
|
|
6706
|
+
ret.push(size({
|
|
6707
|
+
boundaryElement,
|
|
6708
|
+
constrainSize,
|
|
6709
|
+
matchReferenceWidth: matchReferenceWidthProp,
|
|
6710
|
+
setAvailableHeight,
|
|
6711
|
+
setAvailableWidth,
|
|
6712
|
+
setReferenceWidth
|
|
6713
|
+
})); // Define distance between reference and floating element
|
|
6714
|
+
|
|
6715
|
+
ret.push(offset({
|
|
6716
|
+
mainAxis: arrowProp ? 4 : 0
|
|
6717
|
+
})); // Shift the popover so its sits with the boundary eleement
|
|
6718
|
+
|
|
6719
|
+
if (preventOverflow) {
|
|
6720
|
+
ret.push(shift({
|
|
6721
|
+
boundary: boundaryElement || undefined,
|
|
6722
|
+
rootBoundary,
|
|
6723
|
+
padding: 8
|
|
6724
|
+
}));
|
|
6725
|
+
} // Place arrow
|
|
6726
|
+
|
|
6727
|
+
|
|
6728
|
+
if (arrowProp) {
|
|
6729
|
+
ret.push(arrow({
|
|
6730
|
+
element: arrowRef,
|
|
6731
|
+
padding: 4
|
|
6732
|
+
}));
|
|
6733
|
+
}
|
|
6734
|
+
|
|
6735
|
+
return ret;
|
|
6736
|
+
}, [arrowProp, boundaryElement, constrainSize, fallbackPlacements, matchReferenceWidthProp, preventOverflow]);
|
|
6737
|
+
const {
|
|
6738
|
+
x,
|
|
6739
|
+
y,
|
|
6710
6740
|
placement,
|
|
6711
|
-
|
|
6741
|
+
reference,
|
|
6742
|
+
floating,
|
|
6743
|
+
middlewareData,
|
|
6744
|
+
strategy
|
|
6745
|
+
} = useFloating({
|
|
6746
|
+
middleware,
|
|
6747
|
+
placement: placementProp,
|
|
6748
|
+
whileElementsMounted: autoUpdate
|
|
6712
6749
|
});
|
|
6713
|
-
const
|
|
6714
|
-
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
}
|
|
6718
|
-
const
|
|
6719
|
-
|
|
6720
|
-
|
|
6750
|
+
const arrowX = (_middlewareData$arrow = middlewareData.arrow) == null ? void 0 : _middlewareData$arrow.x;
|
|
6751
|
+
const arrowY = (_middlewareData$arrow2 = middlewareData.arrow) == null ? void 0 : _middlewareData$arrow2.y;
|
|
6752
|
+
const setArrow = useCallback(arrowEl => {
|
|
6753
|
+
arrowRef.current = arrowEl;
|
|
6754
|
+
}, []);
|
|
6755
|
+
const setFloating = useCallback(node => {
|
|
6756
|
+
forwardedRef.current = node;
|
|
6757
|
+
floating(node);
|
|
6758
|
+
}, [floating, forwardedRef]);
|
|
6759
|
+
const setReference = useCallback(node => {
|
|
6760
|
+
reference(node);
|
|
6761
|
+
const childRef = childProp == null ? void 0 : childProp.ref;
|
|
6721
6762
|
|
|
6722
6763
|
if (typeof childRef === 'function') {
|
|
6723
|
-
childRef(
|
|
6764
|
+
childRef(node);
|
|
6724
6765
|
} else if (childRef) {
|
|
6725
|
-
childRef.current =
|
|
6766
|
+
childRef.current = node;
|
|
6726
6767
|
}
|
|
6727
|
-
}, [
|
|
6728
|
-
const
|
|
6729
|
-
|
|
6730
|
-
|
|
6731
|
-
|
|
6732
|
-
|
|
6768
|
+
}, [childProp, reference]);
|
|
6769
|
+
const child = useMemo(() => {
|
|
6770
|
+
if (!childProp || referenceElement) return null;
|
|
6771
|
+
return /*#__PURE__*/cloneElement(childProp, {
|
|
6772
|
+
ref: setReference
|
|
6773
|
+
});
|
|
6774
|
+
}, [childProp, referenceElement, setReference]);
|
|
6733
6775
|
useEffect(() => {
|
|
6734
|
-
if (
|
|
6735
|
-
|
|
6736
|
-
forceUpdate();
|
|
6737
|
-
} catch (_) {// ignore caught error
|
|
6738
|
-
}
|
|
6739
|
-
}
|
|
6740
|
-
}, [content, forceUpdate, open, popperReferenceElement]);
|
|
6776
|
+
if (referenceElement) reference(referenceElement);
|
|
6777
|
+
}, [reference, referenceElement]);
|
|
6741
6778
|
|
|
6742
6779
|
if (disabled) {
|
|
6743
|
-
return
|
|
6780
|
+
return childProp || /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
6744
6781
|
}
|
|
6745
6782
|
|
|
6746
|
-
const
|
|
6747
|
-
"data-ui": "Popover"
|
|
6748
|
-
}, restProps, {
|
|
6749
|
-
"$preventOverflow": preventOverflow,
|
|
6750
|
-
ref: setRootRef,
|
|
6751
|
-
style: popoverStyle,
|
|
6783
|
+
const popover = /*#__PURE__*/React.createElement(LayerProvider, {
|
|
6752
6784
|
zOffset: zOffset
|
|
6753
|
-
},
|
|
6754
|
-
|
|
6755
|
-
|
|
6785
|
+
}, /*#__PURE__*/React.createElement(PopoverCard, _extends({}, restProps, {
|
|
6786
|
+
__unstable_margins: margins,
|
|
6787
|
+
arrow: arrowProp,
|
|
6788
|
+
arrowRef: setArrow,
|
|
6789
|
+
arrowX: arrowX,
|
|
6790
|
+
arrowY: arrowY,
|
|
6791
|
+
availableWidth: constrainSize ? availableWidth : undefined,
|
|
6792
|
+
availableHeight: constrainSize ? availableHeight : undefined,
|
|
6793
|
+
boundaryWidth: boundarySize == null ? void 0 : boundarySize.width,
|
|
6794
|
+
overflow: overflow,
|
|
6756
6795
|
padding: padding,
|
|
6796
|
+
placement: placement,
|
|
6757
6797
|
radius: radius,
|
|
6798
|
+
ref: setFloating,
|
|
6799
|
+
referenceWidth: matchReferenceWidthProp ? referenceWidth : undefined,
|
|
6758
6800
|
scheme: scheme,
|
|
6759
6801
|
shadow: shadow,
|
|
6802
|
+
strategy: strategy,
|
|
6760
6803
|
tone: tone,
|
|
6804
|
+
x: x,
|
|
6805
|
+
y: y,
|
|
6761
6806
|
width: width
|
|
6762
|
-
}, arrow && /*#__PURE__*/React.createElement(PopoverArrow, {
|
|
6763
|
-
ref: setArrowElement,
|
|
6764
|
-
style: styles.arrow
|
|
6765
6807
|
}), content));
|
|
6766
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null,
|
|
6767
|
-
|
|
6768
|
-
}) :
|
|
6769
|
-
|
|
6770
|
-
|
|
6771
|
-
});
|
|
6808
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, open && /*#__PURE__*/React.createElement(React.Fragment, null, portal ? /*#__PURE__*/React.createElement(Portal, {
|
|
6809
|
+
__unstable_name: typeof portal === 'string' ? portal : undefined
|
|
6810
|
+
}, popover) : popover), child);
|
|
6811
|
+
}));
|
|
6812
|
+
Popover.displayName = 'Popover';
|
|
6772
6813
|
|
|
6773
|
-
let _$
|
|
6814
|
+
let _$i = t => t,
|
|
6774
6815
|
_t$i,
|
|
6775
6816
|
_t2$d;
|
|
6776
6817
|
function radioBaseStyle() {
|
|
6777
|
-
return css(_t$i || (_t$i = _$
|
|
6818
|
+
return css(_t$i || (_t$i = _$i`
|
|
6778
6819
|
position: relative;
|
|
6779
6820
|
|
|
6780
6821
|
&:not([hidden]) {
|
|
@@ -6796,7 +6837,7 @@ function inputElementStyle(props) {
|
|
|
6796
6837
|
} = theme.sanity;
|
|
6797
6838
|
const color = theme.sanity.color.input;
|
|
6798
6839
|
const dist = (input.radio.size - input.radio.markSize) / 2;
|
|
6799
|
-
return css(_t2$d || (_t2$d = _$
|
|
6840
|
+
return css(_t2$d || (_t2$d = _$i`
|
|
6800
6841
|
appearance: none;
|
|
6801
6842
|
position: absolute;
|
|
6802
6843
|
top: 0;
|
|
@@ -6914,14 +6955,14 @@ const Radio = /*#__PURE__*/forwardRef(function Radio(props, forwardedRef) {
|
|
|
6914
6955
|
})), /*#__PURE__*/React.createElement("span", null));
|
|
6915
6956
|
});
|
|
6916
6957
|
|
|
6917
|
-
let _$
|
|
6958
|
+
let _$h = t => t,
|
|
6918
6959
|
_t$h,
|
|
6919
6960
|
_t2$c,
|
|
6920
6961
|
_t3$7,
|
|
6921
6962
|
_t4$5;
|
|
6922
6963
|
|
|
6923
6964
|
function rootStyle() {
|
|
6924
|
-
return css(_t$h || (_t$h = _$
|
|
6965
|
+
return css(_t$h || (_t$h = _$h`
|
|
6925
6966
|
position: relative;
|
|
6926
6967
|
width: stretch;
|
|
6927
6968
|
|
|
@@ -6936,7 +6977,7 @@ function inputBaseStyle(props) {
|
|
|
6936
6977
|
theme
|
|
6937
6978
|
} = props;
|
|
6938
6979
|
const font = theme.sanity.fonts.text;
|
|
6939
|
-
return css(_t2$c || (_t2$c = _$
|
|
6980
|
+
return css(_t2$c || (_t2$c = _$h`
|
|
6940
6981
|
-webkit-font-smoothing: antialiased;
|
|
6941
6982
|
appearance: none;
|
|
6942
6983
|
border: 0;
|
|
@@ -6961,7 +7002,7 @@ function inputColorStyle(props) {
|
|
|
6961
7002
|
input
|
|
6962
7003
|
} = theme.sanity;
|
|
6963
7004
|
const color = theme.sanity.color.input;
|
|
6964
|
-
return css(_t3$7 || (_t3$7 = _$
|
|
7005
|
+
return css(_t3$7 || (_t3$7 = _$h`
|
|
6965
7006
|
/* enabled */
|
|
6966
7007
|
background-color: ${0};
|
|
6967
7008
|
color: ${0};
|
|
@@ -7030,7 +7071,7 @@ function inputTextSizeStyle(props) {
|
|
|
7030
7071
|
const {
|
|
7031
7072
|
sizes
|
|
7032
7073
|
} = theme.sanity.fonts.text;
|
|
7033
|
-
return
|
|
7074
|
+
return _responsive(theme.sanity.media, $fontSize, sizeIndex => textSize(sizes[sizeIndex] || sizes[2]));
|
|
7034
7075
|
}
|
|
7035
7076
|
|
|
7036
7077
|
function inputStyle() {
|
|
@@ -7042,7 +7083,7 @@ function iconBoxStyle(props) {
|
|
|
7042
7083
|
theme
|
|
7043
7084
|
} = props;
|
|
7044
7085
|
const color = theme.sanity.color.input;
|
|
7045
|
-
return css(_t4$5 || (_t4$5 = _$
|
|
7086
|
+
return css(_t4$5 || (_t4$5 = _$h`
|
|
7046
7087
|
pointer-events: none;
|
|
7047
7088
|
position: absolute;
|
|
7048
7089
|
top: 0;
|
|
@@ -7105,10 +7146,10 @@ const Select = /*#__PURE__*/forwardRef(function Select(props, forwardedRef) {
|
|
|
7105
7146
|
"data-read-only": !disabled && readOnly ? '' : undefined,
|
|
7106
7147
|
"data-ui": "Select"
|
|
7107
7148
|
}, restProps, {
|
|
7108
|
-
"$fontSize": fontSize,
|
|
7109
|
-
"$padding": padding,
|
|
7110
|
-
"$radius": radius,
|
|
7111
|
-
"$space": space,
|
|
7149
|
+
"$fontSize": useArrayProp(fontSize),
|
|
7150
|
+
"$padding": useArrayProp(padding),
|
|
7151
|
+
"$radius": useArrayProp(radius),
|
|
7152
|
+
"$space": useArrayProp(space),
|
|
7112
7153
|
disabled: disabled || readOnly,
|
|
7113
7154
|
ref: ref
|
|
7114
7155
|
}), children), /*#__PURE__*/React.createElement(IconBox, {
|
|
@@ -7139,7 +7180,7 @@ function responsiveStackSpaceStyle(props) {
|
|
|
7139
7180
|
media,
|
|
7140
7181
|
space
|
|
7141
7182
|
} = theme.sanity;
|
|
7142
|
-
return
|
|
7183
|
+
return _responsive(media, props.$space, spaceIndex => ({
|
|
7143
7184
|
gridGap: rem(space[spaceIndex])
|
|
7144
7185
|
}));
|
|
7145
7186
|
}
|
|
@@ -7161,24 +7202,24 @@ const Stack = /*#__PURE__*/forwardRef(function Stack(props, ref) {
|
|
|
7161
7202
|
"data-as": typeof as === 'string' ? as : undefined,
|
|
7162
7203
|
"data-ui": "Stack"
|
|
7163
7204
|
}, restProps, {
|
|
7164
|
-
"$space": space,
|
|
7205
|
+
"$space": useArrayProp(space),
|
|
7165
7206
|
forwardedAs: as,
|
|
7166
7207
|
ref: ref
|
|
7167
7208
|
}));
|
|
7168
7209
|
});
|
|
7169
7210
|
|
|
7170
|
-
let _$
|
|
7211
|
+
let _$g = t => t,
|
|
7171
7212
|
_t$g,
|
|
7172
7213
|
_t2$b,
|
|
7173
7214
|
_t3$6,
|
|
7174
7215
|
_t4$4,
|
|
7175
7216
|
_t5$3,
|
|
7176
|
-
_t6$
|
|
7217
|
+
_t6$2,
|
|
7177
7218
|
_t7;
|
|
7178
7219
|
/* Root */
|
|
7179
7220
|
|
|
7180
7221
|
function switchBaseStyles() {
|
|
7181
|
-
return css(_t$g || (_t$g = _$
|
|
7222
|
+
return css(_t$g || (_t$g = _$g`
|
|
7182
7223
|
position: relative;
|
|
7183
7224
|
&:not([hidden]) {
|
|
7184
7225
|
display: inline-block;
|
|
@@ -7189,7 +7230,7 @@ function switchBaseStyles() {
|
|
|
7189
7230
|
|
|
7190
7231
|
function switchInputStyles() {
|
|
7191
7232
|
// Visually hide the input element while keeping it interactive
|
|
7192
|
-
return css(_t2$b || (_t2$b = _$
|
|
7233
|
+
return css(_t2$b || (_t2$b = _$g`
|
|
7193
7234
|
position: absolute;
|
|
7194
7235
|
top: 0;
|
|
7195
7236
|
right: 0;
|
|
@@ -7217,7 +7258,7 @@ function switchRepresentationStyles(props) {
|
|
|
7217
7258
|
input
|
|
7218
7259
|
} = theme.sanity;
|
|
7219
7260
|
const color = theme.sanity.color.button.default;
|
|
7220
|
-
return css(_t3$6 || (_t3$6 = _$
|
|
7261
|
+
return css(_t3$6 || (_t3$6 = _$g`
|
|
7221
7262
|
--switch-bg-color: ${0};
|
|
7222
7263
|
--switch-fg-color: ${0};
|
|
7223
7264
|
--switch-box-shadow: none;
|
|
@@ -7289,7 +7330,7 @@ function switchTrackStyles(props) {
|
|
|
7289
7330
|
const {
|
|
7290
7331
|
input
|
|
7291
7332
|
} = theme.sanity;
|
|
7292
|
-
return css(_t4$4 || (_t4$4 = _$
|
|
7333
|
+
return css(_t4$4 || (_t4$4 = _$g`
|
|
7293
7334
|
&:not([hidden]) {
|
|
7294
7335
|
display: block;
|
|
7295
7336
|
}
|
|
@@ -7319,7 +7360,7 @@ function switchThumbStyles(props) {
|
|
|
7319
7360
|
const checkedOffset = trackWidth - trackPadding * 2 - size;
|
|
7320
7361
|
const indeterminateOffset = trackWidth / 2 - size / 2 - trackPadding;
|
|
7321
7362
|
const checked = $indeterminate !== true && props.$checked === true;
|
|
7322
|
-
return css(_t5$3 || (_t5$3 = _$
|
|
7363
|
+
return css(_t5$3 || (_t5$3 = _$g`
|
|
7323
7364
|
&:not([hidden]) {
|
|
7324
7365
|
display: block;
|
|
7325
7366
|
}
|
|
@@ -7338,9 +7379,9 @@ function switchThumbStyles(props) {
|
|
|
7338
7379
|
${0}
|
|
7339
7380
|
|
|
7340
7381
|
${0}
|
|
7341
|
-
`), rem(trackPadding), rem(trackPadding), rem(size), rem(size), rem(size / 2), input.switch.transitionDurationMs, input.switch.transitionTimingFunction, checked && css(_t6$
|
|
7382
|
+
`), rem(trackPadding), rem(trackPadding), rem(size), rem(size), rem(size / 2), input.switch.transitionDurationMs, input.switch.transitionTimingFunction, checked && css(_t6$2 || (_t6$2 = _$g`
|
|
7342
7383
|
transform: translate3d(${0}px, 0, 0);
|
|
7343
|
-
`), checkedOffset), $indeterminate && css(_t7 || (_t7 = _$
|
|
7384
|
+
`), checkedOffset), $indeterminate && css(_t7 || (_t7 = _$g`
|
|
7344
7385
|
transform: translate3d(${0}px, 0, 0);
|
|
7345
7386
|
`), indeterminateOffset));
|
|
7346
7387
|
}
|
|
@@ -7393,12 +7434,12 @@ const Switch = /*#__PURE__*/forwardRef(function Switch(props, forwardedRef) {
|
|
|
7393
7434
|
})));
|
|
7394
7435
|
});
|
|
7395
7436
|
|
|
7396
|
-
const _excluded$i = ["border", "customValidity", "disabled", "fontSize", "padding", "radius"];
|
|
7437
|
+
const _excluded$i = ["border", "customValidity", "disabled", "fontSize", "padding", "radius", "weight"];
|
|
7397
7438
|
|
|
7398
|
-
let _$
|
|
7439
|
+
let _$f = t => t,
|
|
7399
7440
|
_t$f;
|
|
7400
7441
|
const Root$d = styled.span(textInputRootStyle);
|
|
7401
|
-
const InputRoot$1 = styled.span(_t$f || (_t$f = _$
|
|
7442
|
+
const InputRoot$1 = styled.span(_t$f || (_t$f = _$f`
|
|
7402
7443
|
flex: 1;
|
|
7403
7444
|
min-width: 0;
|
|
7404
7445
|
display: block;
|
|
@@ -7417,40 +7458,51 @@ const TextArea = /*#__PURE__*/forwardRef(function TextArea(props, forwardedRef)
|
|
|
7417
7458
|
disabled = false,
|
|
7418
7459
|
fontSize = 2,
|
|
7419
7460
|
padding = 3,
|
|
7420
|
-
radius = 1
|
|
7461
|
+
radius = 1,
|
|
7462
|
+
weight
|
|
7421
7463
|
} = props,
|
|
7422
7464
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$i);
|
|
7423
7465
|
|
|
7424
7466
|
const ref = useForwardedRef(forwardedRef);
|
|
7467
|
+
const rootTheme = useRootTheme();
|
|
7425
7468
|
useCustomValidity(ref, customValidity);
|
|
7426
7469
|
return /*#__PURE__*/React.createElement(Root$d, {
|
|
7427
7470
|
"data-ui": "TextArea"
|
|
7428
7471
|
}, /*#__PURE__*/React.createElement(InputRoot$1, null, /*#__PURE__*/React.createElement(Input$1, _extends({
|
|
7429
|
-
"data-as": "textarea"
|
|
7472
|
+
"data-as": "textarea",
|
|
7473
|
+
"data-tone": rootTheme.tone
|
|
7430
7474
|
}, restProps, {
|
|
7431
|
-
"$fontSize": fontSize,
|
|
7432
|
-
"$padding": padding,
|
|
7475
|
+
"$fontSize": useArrayProp(fontSize),
|
|
7476
|
+
"$padding": useArrayProp(padding),
|
|
7477
|
+
"$space": useArrayProp(0),
|
|
7478
|
+
"$tone": rootTheme.tone,
|
|
7479
|
+
"$weight": weight,
|
|
7433
7480
|
disabled: disabled,
|
|
7434
7481
|
ref: ref
|
|
7435
7482
|
})), /*#__PURE__*/React.createElement(Presentation$1, {
|
|
7436
7483
|
"$border": border,
|
|
7437
|
-
"$radius": radius
|
|
7484
|
+
"$radius": useArrayProp(radius),
|
|
7485
|
+
"$tone": rootTheme.tone,
|
|
7486
|
+
"data-tone": rootTheme.tone
|
|
7438
7487
|
})));
|
|
7439
7488
|
});
|
|
7440
7489
|
|
|
7441
|
-
const _excluded$h = ["border", "clearButton", "disabled", "fontSize", "icon", "iconRight", "onClear", "padding", "prefix", "radius", "readOnly", "space", "suffix", "customValidity", "type"];
|
|
7490
|
+
const _excluded$h = ["border", "clearButton", "disabled", "fontSize", "icon", "iconRight", "onClear", "padding", "prefix", "radius", "readOnly", "space", "suffix", "customValidity", "type", "weight"];
|
|
7442
7491
|
|
|
7443
|
-
let _$
|
|
7492
|
+
let _$e = t => t,
|
|
7444
7493
|
_t$e,
|
|
7445
7494
|
_t2$a,
|
|
7446
7495
|
_t3$5,
|
|
7447
7496
|
_t4$3,
|
|
7448
|
-
_t5$2
|
|
7497
|
+
_t5$2,
|
|
7498
|
+
_t6$1;
|
|
7449
7499
|
const CLEAR_BUTTON_BOX_STYLE = {
|
|
7450
7500
|
zIndex: 2
|
|
7451
7501
|
};
|
|
7452
|
-
const Root$c = styled.
|
|
7453
|
-
|
|
7502
|
+
const Root$c = styled(Card).attrs({
|
|
7503
|
+
forwardedAs: 'span'
|
|
7504
|
+
})(textInputRootStyle);
|
|
7505
|
+
const InputRoot = styled.span(_t$e || (_t$e = _$e`
|
|
7454
7506
|
flex: 1;
|
|
7455
7507
|
min-width: 0;
|
|
7456
7508
|
display: block;
|
|
@@ -7458,7 +7510,7 @@ const InputRoot = styled.span(_t$e || (_t$e = _$d`
|
|
|
7458
7510
|
`));
|
|
7459
7511
|
const Prefix = styled(Card).attrs({
|
|
7460
7512
|
forwardedAs: 'span'
|
|
7461
|
-
})(_t2$a || (_t2$a = _$
|
|
7513
|
+
})(_t2$a || (_t2$a = _$e`
|
|
7462
7514
|
border-top-right-radius: 0;
|
|
7463
7515
|
border-bottom-right-radius: 0;
|
|
7464
7516
|
|
|
@@ -7469,7 +7521,7 @@ const Prefix = styled(Card).attrs({
|
|
|
7469
7521
|
`));
|
|
7470
7522
|
const Suffix = styled(Card).attrs({
|
|
7471
7523
|
forwardedAs: 'span'
|
|
7472
|
-
})(_t3$5 || (_t3$5 = _$
|
|
7524
|
+
})(_t3$5 || (_t3$5 = _$e`
|
|
7473
7525
|
border-top-left-radius: 0;
|
|
7474
7526
|
border-bottom-left-radius: 0;
|
|
7475
7527
|
|
|
@@ -7480,12 +7532,17 @@ const Suffix = styled(Card).attrs({
|
|
|
7480
7532
|
`));
|
|
7481
7533
|
const Input = styled.input(responsiveInputPaddingStyle, textInputBaseStyle, textInputFontSizeStyle);
|
|
7482
7534
|
const Presentation = styled.span(responsiveRadiusStyle, textInputRepresentationStyle);
|
|
7483
|
-
const LeftBox = styled(Box)(_t4$3 || (_t4$3 = _$
|
|
7535
|
+
const LeftBox = styled(Box)(_t4$3 || (_t4$3 = _$e`
|
|
7484
7536
|
position: absolute;
|
|
7485
7537
|
top: 0;
|
|
7486
7538
|
left: 0;
|
|
7487
7539
|
`));
|
|
7488
|
-
const
|
|
7540
|
+
const RightBox = styled(Box)(_t5$2 || (_t5$2 = _$e`
|
|
7541
|
+
position: absolute;
|
|
7542
|
+
top: 0;
|
|
7543
|
+
right: 0;
|
|
7544
|
+
`));
|
|
7545
|
+
const RightCard = styled(Card)(_t6$1 || (_t6$1 = _$e`
|
|
7489
7546
|
background-color: transparent;
|
|
7490
7547
|
position: absolute;
|
|
7491
7548
|
top: 0;
|
|
@@ -7500,7 +7557,7 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
|
|
|
7500
7557
|
border = true,
|
|
7501
7558
|
clearButton,
|
|
7502
7559
|
disabled = false,
|
|
7503
|
-
fontSize = 2,
|
|
7560
|
+
fontSize: fontSizeProp = 2,
|
|
7504
7561
|
icon,
|
|
7505
7562
|
iconRight,
|
|
7506
7563
|
onClear,
|
|
@@ -7508,16 +7565,20 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
|
|
|
7508
7565
|
prefix,
|
|
7509
7566
|
radius: radiusProp = 1,
|
|
7510
7567
|
readOnly,
|
|
7511
|
-
space = 3,
|
|
7568
|
+
space: spaceProp = 3,
|
|
7512
7569
|
suffix,
|
|
7513
7570
|
customValidity,
|
|
7514
|
-
type = 'text'
|
|
7571
|
+
type = 'text',
|
|
7572
|
+
weight
|
|
7515
7573
|
} = props,
|
|
7516
7574
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$h);
|
|
7517
7575
|
|
|
7518
7576
|
const ref = useForwardedRef(forwardedRef);
|
|
7519
|
-
const
|
|
7520
|
-
const
|
|
7577
|
+
const rootTheme = useRootTheme();
|
|
7578
|
+
const fontSize = useArrayProp(fontSizeProp);
|
|
7579
|
+
const padding = useArrayProp(paddingProp);
|
|
7580
|
+
const radius = useArrayProp(radiusProp);
|
|
7581
|
+
const space = useArrayProp(spaceProp); // Transient properties
|
|
7521
7582
|
|
|
7522
7583
|
const $hasClearButton = Boolean(clearButton);
|
|
7523
7584
|
const $hasIcon = Boolean(icon);
|
|
@@ -7553,16 +7614,18 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
|
|
|
7553
7614
|
"$border": border,
|
|
7554
7615
|
"$hasPrefix": $hasPrefix,
|
|
7555
7616
|
"$hasSuffix": $hasSuffix,
|
|
7556
|
-
"$radius": radius
|
|
7617
|
+
"$radius": radius,
|
|
7618
|
+
"$tone": rootTheme.tone,
|
|
7619
|
+
"data-tone": rootTheme.tone
|
|
7557
7620
|
}, icon && /*#__PURE__*/React.createElement(LeftBox, {
|
|
7558
7621
|
padding: padding
|
|
7559
7622
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
7560
7623
|
size: fontSize
|
|
7561
|
-
}, /*#__PURE__*/isValidElement(icon) && icon, isValidElementType(icon) && /*#__PURE__*/createElement(icon))), !$hasClearButton && iconRight && /*#__PURE__*/React.createElement(
|
|
7624
|
+
}, /*#__PURE__*/isValidElement(icon) && icon, isValidElementType(icon) && /*#__PURE__*/createElement(icon))), !$hasClearButton && iconRight && /*#__PURE__*/React.createElement(RightBox, {
|
|
7562
7625
|
padding: padding
|
|
7563
7626
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
7564
7627
|
size: fontSize
|
|
7565
|
-
}, /*#__PURE__*/isValidElement(iconRight) && iconRight, isValidElementType(iconRight) && /*#__PURE__*/createElement(iconRight)))), [border, fontSize, icon, iconRight, padding, radius, $hasClearButton, $hasPrefix, $hasSuffix]); // Render clear button (memoized)
|
|
7628
|
+
}, /*#__PURE__*/isValidElement(iconRight) && iconRight, isValidElementType(iconRight) && /*#__PURE__*/createElement(iconRight)))), [border, fontSize, icon, iconRight, padding, radius, rootTheme.tone, $hasClearButton, $hasPrefix, $hasSuffix]); // Render clear button (memoized)
|
|
7566
7629
|
|
|
7567
7630
|
const clearButtonBoxPadding = useMemo(() => padding.map(v => {
|
|
7568
7631
|
if (v === 0) return 0;
|
|
@@ -7576,7 +7639,7 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
|
|
|
7576
7639
|
if (v === 2) return 1;
|
|
7577
7640
|
return v - 1;
|
|
7578
7641
|
}), [padding]);
|
|
7579
|
-
const clearButtonProps = useMemo(() => typeof clearButton === 'object' ? clearButton : EMPTY_RECORD
|
|
7642
|
+
const clearButtonProps = useMemo(() => typeof clearButton === 'object' ? clearButton : EMPTY_RECORD, [clearButton]);
|
|
7580
7643
|
const clearButtonNode = useMemo(() => !disabled && !readOnly && clearButton && /*#__PURE__*/React.createElement(RightCard, {
|
|
7581
7644
|
forwardedAs: "span",
|
|
7582
7645
|
padding: clearButtonBoxPadding,
|
|
@@ -7603,15 +7666,19 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
|
|
|
7603
7666
|
tone: "inherit"
|
|
7604
7667
|
}, /*#__PURE__*/React.createElement("span", null, suffix)), [radius, suffix]);
|
|
7605
7668
|
return /*#__PURE__*/React.createElement(Root$c, {
|
|
7606
|
-
"data-ui": "TextInput"
|
|
7669
|
+
"data-ui": "TextInput",
|
|
7670
|
+
tone: rootTheme.tone
|
|
7607
7671
|
}, prefixNode, /*#__PURE__*/React.createElement(InputRoot, null, /*#__PURE__*/React.createElement(Input, _extends({
|
|
7608
|
-
"data-as": "input"
|
|
7672
|
+
"data-as": "input",
|
|
7673
|
+
"data-tone": rootTheme.tone
|
|
7609
7674
|
}, restProps, {
|
|
7675
|
+
"$fontSize": fontSize,
|
|
7610
7676
|
"$iconLeft": $hasIcon,
|
|
7611
7677
|
"$iconRight": $hasIconRight || $hasClearButton,
|
|
7612
7678
|
"$padding": padding,
|
|
7613
7679
|
"$space": space,
|
|
7614
|
-
"$
|
|
7680
|
+
"$tone": rootTheme.tone,
|
|
7681
|
+
"$weight": weight,
|
|
7615
7682
|
disabled: disabled,
|
|
7616
7683
|
readOnly: readOnly,
|
|
7617
7684
|
ref: ref,
|
|
@@ -7619,12 +7686,27 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
|
|
|
7619
7686
|
})), presentationNode, clearButtonNode), suffixNode);
|
|
7620
7687
|
});
|
|
7621
7688
|
|
|
7622
|
-
let _$
|
|
7689
|
+
let _$d = t => t,
|
|
7623
7690
|
_t$d,
|
|
7624
7691
|
_t2$9,
|
|
7625
7692
|
_t3$4;
|
|
7626
|
-
const Root$b = styled.div(_t$d || (_t$d = _$
|
|
7693
|
+
const Root$b = styled.div(_t$d || (_t$d = _$d`
|
|
7627
7694
|
position: absolute;
|
|
7695
|
+
pointer-events: none;
|
|
7696
|
+
width: 15px;
|
|
7697
|
+
height: 15px;
|
|
7698
|
+
fill: none;
|
|
7699
|
+
|
|
7700
|
+
:empty + & {
|
|
7701
|
+
display: none;
|
|
7702
|
+
}
|
|
7703
|
+
|
|
7704
|
+
& > svg {
|
|
7705
|
+
display: block;
|
|
7706
|
+
transform-origin: 7.5px 7.5px;
|
|
7707
|
+
}
|
|
7708
|
+
|
|
7709
|
+
/* position: absolute;
|
|
7628
7710
|
width: 15px;
|
|
7629
7711
|
height: 15px;
|
|
7630
7712
|
fill: none;
|
|
@@ -7638,46 +7720,48 @@ const Root$b = styled.div(_t$d || (_t$d = _$c`
|
|
|
7638
7720
|
display: block;
|
|
7639
7721
|
}
|
|
7640
7722
|
transform-origin: 7.5px 7.5px;
|
|
7641
|
-
}
|
|
7723
|
+
} */
|
|
7642
7724
|
|
|
7643
|
-
[data-
|
|
7644
|
-
bottom: -
|
|
7725
|
+
[data-placement^='top'] > & {
|
|
7726
|
+
bottom: -27px;
|
|
7645
7727
|
}
|
|
7646
7728
|
|
|
7647
|
-
[data-
|
|
7648
|
-
left: -
|
|
7729
|
+
[data-placement^='right'] > & {
|
|
7730
|
+
left: -27px;
|
|
7649
7731
|
|
|
7650
7732
|
& > svg {
|
|
7651
7733
|
transform: rotate(90deg);
|
|
7652
7734
|
}
|
|
7653
7735
|
}
|
|
7654
7736
|
|
|
7655
|
-
[data-
|
|
7656
|
-
right: -
|
|
7737
|
+
[data-placement^='left'] > & {
|
|
7738
|
+
right: -27px;
|
|
7657
7739
|
|
|
7658
7740
|
& > svg {
|
|
7659
7741
|
transform: rotate(-90deg);
|
|
7660
7742
|
}
|
|
7661
7743
|
}
|
|
7662
7744
|
|
|
7663
|
-
[data-
|
|
7664
|
-
top: -
|
|
7745
|
+
[data-placement^='bottom'] > & {
|
|
7746
|
+
top: -27px;
|
|
7665
7747
|
|
|
7666
7748
|
& > svg {
|
|
7667
7749
|
transform: rotate(180deg);
|
|
7668
7750
|
}
|
|
7669
7751
|
}
|
|
7670
7752
|
`));
|
|
7671
|
-
const Border = styled.path(_t2$9 || (_t2$9 = _$
|
|
7753
|
+
const Border = styled.path(_t2$9 || (_t2$9 = _$d`
|
|
7672
7754
|
fill: var(--card-shadow-outline-color);
|
|
7673
7755
|
`));
|
|
7674
|
-
const Shape = styled.path(_t3$4 || (_t3$4 = _$
|
|
7756
|
+
const Shape = styled.path(_t3$4 || (_t3$4 = _$d`
|
|
7675
7757
|
fill: var(--card-bg-color);
|
|
7676
7758
|
`));
|
|
7677
7759
|
const TooltipArrow = /*#__PURE__*/forwardRef(function TooltipArrow(props, ref) {
|
|
7678
7760
|
const restProps = _extends({}, props);
|
|
7679
7761
|
|
|
7680
|
-
return /*#__PURE__*/React.createElement(Root$b, _extends({
|
|
7762
|
+
return /*#__PURE__*/React.createElement(Root$b, _extends({
|
|
7763
|
+
"data-ui": "Tooltip__arrow"
|
|
7764
|
+
}, restProps, {
|
|
7681
7765
|
ref: ref
|
|
7682
7766
|
}), /*#__PURE__*/React.createElement("svg", {
|
|
7683
7767
|
width: "15",
|
|
@@ -7690,11 +7774,11 @@ const TooltipArrow = /*#__PURE__*/forwardRef(function TooltipArrow(props, ref) {
|
|
|
7690
7774
|
})));
|
|
7691
7775
|
});
|
|
7692
7776
|
|
|
7693
|
-
const _excluded$g = ["
|
|
7777
|
+
const _excluded$g = ["boundaryElement", "children", "content", "disabled", "fallbackPlacements", "placement", "portal", "scheme", "shadow", "zOffset"];
|
|
7694
7778
|
|
|
7695
|
-
let
|
|
7779
|
+
let _$c = t => t,
|
|
7696
7780
|
_t$c;
|
|
7697
|
-
const Root$a = styled(Layer)(_t$c || (_t$c =
|
|
7781
|
+
const Root$a = styled(Layer)(_t$c || (_t$c = _$c`
|
|
7698
7782
|
pointer-events: none;
|
|
7699
7783
|
`));
|
|
7700
7784
|
/**
|
|
@@ -7702,60 +7786,88 @@ const Root$a = styled(Layer)(_t$c || (_t$c = _2`
|
|
|
7702
7786
|
*/
|
|
7703
7787
|
|
|
7704
7788
|
const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
|
|
7705
|
-
var _theme$sanity$layer;
|
|
7789
|
+
var _theme$sanity$layer, _middlewareData$arrow, _middlewareData$arrow2;
|
|
7706
7790
|
|
|
7707
7791
|
const boundaryElementContext = useBoundaryElement();
|
|
7708
7792
|
const theme = useTheme();
|
|
7709
7793
|
|
|
7710
7794
|
const {
|
|
7711
|
-
allowedAutoPlacements,
|
|
7712
7795
|
boundaryElement = boundaryElementContext == null ? void 0 : boundaryElementContext.element,
|
|
7713
|
-
children,
|
|
7796
|
+
children: childProp,
|
|
7714
7797
|
content,
|
|
7715
7798
|
disabled,
|
|
7716
|
-
fallbackPlacements,
|
|
7717
|
-
placement = 'bottom',
|
|
7799
|
+
fallbackPlacements: fallbackPlacementsProp,
|
|
7800
|
+
placement: placementProp = 'bottom',
|
|
7718
7801
|
portal,
|
|
7719
7802
|
scheme,
|
|
7803
|
+
shadow = 2,
|
|
7720
7804
|
zOffset = (_theme$sanity$layer = theme.sanity.layer) == null ? void 0 : _theme$sanity$layer.tooltip.zOffset
|
|
7721
7805
|
} = props,
|
|
7722
7806
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$g);
|
|
7723
7807
|
|
|
7808
|
+
const fallbackPlacements = useArrayProp(fallbackPlacementsProp);
|
|
7724
7809
|
const forwardedRef = useForwardedRef(ref);
|
|
7725
7810
|
const [referenceElement, setReferenceElement] = useState(null);
|
|
7726
|
-
const
|
|
7727
|
-
const
|
|
7728
|
-
const
|
|
7811
|
+
const arrowRef = useRef(null);
|
|
7812
|
+
const rootBoundary = 'viewport';
|
|
7813
|
+
const middleware = useMemo(() => {
|
|
7814
|
+
const ret = []; // Flip the floating element when leaving the boundary box
|
|
7815
|
+
|
|
7816
|
+
ret.push(flip({
|
|
7817
|
+
boundary: boundaryElement || undefined,
|
|
7818
|
+
fallbackPlacements,
|
|
7819
|
+
padding: 4,
|
|
7820
|
+
rootBoundary
|
|
7821
|
+
})); // Define distance between reference and floating element
|
|
7822
|
+
|
|
7823
|
+
ret.push(offset({
|
|
7824
|
+
mainAxis: 3
|
|
7825
|
+
})); // Shift the tooltip so its sits with the boundary eleement
|
|
7826
|
+
|
|
7827
|
+
ret.push(shift({
|
|
7828
|
+
boundary: boundaryElement || undefined,
|
|
7829
|
+
rootBoundary,
|
|
7830
|
+
padding: 4
|
|
7831
|
+
})); // Place arrow
|
|
7832
|
+
|
|
7833
|
+
ret.push(arrow({
|
|
7834
|
+
element: arrowRef,
|
|
7835
|
+
padding: 2
|
|
7836
|
+
}));
|
|
7837
|
+
return ret;
|
|
7838
|
+
}, [boundaryElement, fallbackPlacements]);
|
|
7839
|
+
const {
|
|
7840
|
+
x,
|
|
7841
|
+
y,
|
|
7729
7842
|
placement,
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
altAxis: true,
|
|
7740
|
-
boundary: boundaryElement || undefined,
|
|
7741
|
-
padding: 4
|
|
7742
|
-
}
|
|
7743
|
-
}, {
|
|
7744
|
-
name: 'offset',
|
|
7745
|
-
options: {
|
|
7746
|
-
offset: [0, 3]
|
|
7747
|
-
}
|
|
7748
|
-
}, {
|
|
7749
|
-
name: 'flip',
|
|
7750
|
-
options: {
|
|
7751
|
-
allowedAutoPlacements,
|
|
7752
|
-
fallbackPlacements
|
|
7753
|
-
}
|
|
7754
|
-
}]
|
|
7843
|
+
reference,
|
|
7844
|
+
floating,
|
|
7845
|
+
middlewareData,
|
|
7846
|
+
update,
|
|
7847
|
+
strategy
|
|
7848
|
+
} = useFloating({
|
|
7849
|
+
middleware,
|
|
7850
|
+
placement: placementProp,
|
|
7851
|
+
whileElementsMounted: autoUpdate
|
|
7755
7852
|
});
|
|
7756
|
-
const {
|
|
7757
|
-
|
|
7758
|
-
|
|
7853
|
+
const rootStyle = useMemo(() => ({
|
|
7854
|
+
position: strategy,
|
|
7855
|
+
top: y != null ? y : 0,
|
|
7856
|
+
left: x != null ? x : 0
|
|
7857
|
+
}), [strategy, x, y]);
|
|
7858
|
+
const staticSide = placement && FLOATING_STATIC_SIDES[placement.split('-')[0]];
|
|
7859
|
+
const arrowX = (_middlewareData$arrow = middlewareData.arrow) == null ? void 0 : _middlewareData$arrow.x;
|
|
7860
|
+
const arrowY = (_middlewareData$arrow2 = middlewareData.arrow) == null ? void 0 : _middlewareData$arrow2.y;
|
|
7861
|
+
const arrowStyle = useMemo(() => {
|
|
7862
|
+
const style = {
|
|
7863
|
+
left: arrowX !== null ? arrowX : undefined,
|
|
7864
|
+
top: arrowY !== null ? arrowY : undefined,
|
|
7865
|
+
right: undefined,
|
|
7866
|
+
bottom: undefined
|
|
7867
|
+
};
|
|
7868
|
+
if (staticSide) style[staticSide] = -15;
|
|
7869
|
+
return style;
|
|
7870
|
+
}, [arrowX, arrowY, staticSide]);
|
|
7759
7871
|
const [isOpen, setIsOpen] = useState(false);
|
|
7760
7872
|
const handleBlur = useCallback(() => setIsOpen(false), []);
|
|
7761
7873
|
const handleFocus = useCallback(() => setIsOpen(true), []);
|
|
@@ -7781,15 +7893,7 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
|
|
|
7781
7893
|
return () => {
|
|
7782
7894
|
window.removeEventListener('mousemove', handleWindowMouseMove);
|
|
7783
7895
|
};
|
|
7784
|
-
}, [isOpen, referenceElement]);
|
|
7785
|
-
useEffect(() => {
|
|
7786
|
-
if (forceUpdate) {
|
|
7787
|
-
try {
|
|
7788
|
-
forceUpdate();
|
|
7789
|
-
} catch (_) {// ignore caught error
|
|
7790
|
-
}
|
|
7791
|
-
}
|
|
7792
|
-
}, [forceUpdate, content]); // Close when `disabled` changes to `true`
|
|
7896
|
+
}, [isOpen, referenceElement]); // Close when `disabled` changes to `true`
|
|
7793
7897
|
|
|
7794
7898
|
useEffect(() => {
|
|
7795
7899
|
if (disabled) setIsOpen(false);
|
|
@@ -7797,40 +7901,59 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
|
|
|
7797
7901
|
|
|
7798
7902
|
useEffect(() => {
|
|
7799
7903
|
if (!content) setIsOpen(false);
|
|
7800
|
-
}, [content]);
|
|
7801
|
-
|
|
7802
|
-
|
|
7803
|
-
|
|
7804
|
-
|
|
7805
|
-
|
|
7806
|
-
|
|
7807
|
-
|
|
7808
|
-
|
|
7809
|
-
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
|
|
7813
|
-
|
|
7814
|
-
|
|
7815
|
-
|
|
7816
|
-
|
|
7817
|
-
|
|
7904
|
+
}, [content]); // Update reference
|
|
7905
|
+
|
|
7906
|
+
useEffect(() => reference(referenceElement), [reference, referenceElement]);
|
|
7907
|
+
const setArrow = useCallback(arrowEl => {
|
|
7908
|
+
arrowRef.current = arrowEl;
|
|
7909
|
+
update();
|
|
7910
|
+
}, [update]);
|
|
7911
|
+
const setFloating = useCallback(node => {
|
|
7912
|
+
forwardedRef.current = node;
|
|
7913
|
+
floating(node);
|
|
7914
|
+
}, [floating, forwardedRef]);
|
|
7915
|
+
const childRef = childProp == null ? void 0 : childProp.ref;
|
|
7916
|
+
const setReference = useCallback(node => {
|
|
7917
|
+
if (typeof childRef === 'function') {
|
|
7918
|
+
childRef(node);
|
|
7919
|
+
} else if (childRef) {
|
|
7920
|
+
childRef.current = node;
|
|
7921
|
+
} // childRef.current = node
|
|
7922
|
+
|
|
7923
|
+
|
|
7924
|
+
setReferenceElement(node);
|
|
7925
|
+
}, [childRef]);
|
|
7926
|
+
const child = useMemo(() => {
|
|
7927
|
+
if (!childProp) return null;
|
|
7928
|
+
return /*#__PURE__*/cloneElement(childProp, {
|
|
7929
|
+
onBlur: handleBlur,
|
|
7930
|
+
onFocus: handleFocus,
|
|
7931
|
+
onMouseEnter: handleMouseEnter,
|
|
7932
|
+
onMouseLeave: handleMouseLeave,
|
|
7933
|
+
ref: setReference
|
|
7934
|
+
});
|
|
7935
|
+
}, [childProp, handleBlur, handleFocus, handleMouseEnter, handleMouseLeave, setReference]);
|
|
7936
|
+
if (!child) return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
7937
|
+
if (disabled) return child;
|
|
7938
|
+
const root = /*#__PURE__*/React.createElement(Root$a, _extends({
|
|
7818
7939
|
"data-ui": "Tooltip"
|
|
7819
|
-
}, restProps,
|
|
7820
|
-
ref:
|
|
7821
|
-
style:
|
|
7940
|
+
}, restProps, {
|
|
7941
|
+
ref: setFloating,
|
|
7942
|
+
style: rootStyle,
|
|
7822
7943
|
zOffset: zOffset
|
|
7823
7944
|
}), /*#__PURE__*/React.createElement(Card, {
|
|
7945
|
+
"data-ui": "Tooltip__card",
|
|
7946
|
+
"data-placement": placement,
|
|
7824
7947
|
radius: 2,
|
|
7825
7948
|
scheme: scheme,
|
|
7826
|
-
shadow:
|
|
7949
|
+
shadow: shadow
|
|
7827
7950
|
}, content, /*#__PURE__*/React.createElement(TooltipArrow, {
|
|
7828
|
-
ref:
|
|
7829
|
-
style:
|
|
7951
|
+
ref: setArrow,
|
|
7952
|
+
style: arrowStyle
|
|
7830
7953
|
})));
|
|
7831
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null,
|
|
7954
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, child, isOpen && /*#__PURE__*/React.createElement(React.Fragment, null, portal ? /*#__PURE__*/React.createElement(Portal, {
|
|
7832
7955
|
__unstable_name: typeof portal === 'string' ? portal : undefined
|
|
7833
|
-
},
|
|
7956
|
+
}, root) : root));
|
|
7834
7957
|
});
|
|
7835
7958
|
|
|
7836
7959
|
let _$b = t => t,
|
|
@@ -7844,7 +7967,6 @@ let _$b = t => t,
|
|
|
7844
7967
|
*/
|
|
7845
7968
|
|
|
7846
7969
|
const Root$9 = styled.div(_t$b || (_t$b = _$b`
|
|
7847
|
-
/* position: relative; */
|
|
7848
7970
|
line-height: 0;
|
|
7849
7971
|
`));
|
|
7850
7972
|
/**
|
|
@@ -7863,11 +7985,6 @@ const ListBox = styled(Box)(_t2$8 || (_t2$8 = _$b`
|
|
|
7863
7985
|
*/
|
|
7864
7986
|
|
|
7865
7987
|
const ResultsPopover = styled(Popover)(_t3$3 || (_t3$3 = _$b`
|
|
7866
|
-
& > div {
|
|
7867
|
-
overflow: auto;
|
|
7868
|
-
-webkit-overflow-scrolling: touch;
|
|
7869
|
-
}
|
|
7870
|
-
|
|
7871
7988
|
&[data-popper-reference-hidden='true'] {
|
|
7872
7989
|
display: none;
|
|
7873
7990
|
}
|
|
@@ -7994,27 +8111,22 @@ function autocompleteReducer(state, msg) {
|
|
|
7994
8111
|
/**
|
|
7995
8112
|
* @internal
|
|
7996
8113
|
*/
|
|
7997
|
-
const EMPTY_RECORD = {};
|
|
7998
|
-
/**
|
|
7999
|
-
* @internal
|
|
8000
|
-
*/
|
|
8001
|
-
|
|
8002
8114
|
const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ['Control', 'Shift', 'Alt', 'Enter', 'Home', 'End', 'PageUp', 'PageDown', 'Meta', 'Tab', 'CapsLock'];
|
|
8003
8115
|
/**
|
|
8004
8116
|
* @internal
|
|
8005
8117
|
*/
|
|
8006
8118
|
|
|
8007
|
-
const AUTOCOMPLETE_POPOVER_MARGINS = [0, 1,
|
|
8119
|
+
const AUTOCOMPLETE_POPOVER_MARGINS = [0, 1, 0, 0];
|
|
8008
8120
|
/**
|
|
8009
8121
|
* @internal
|
|
8010
8122
|
*/
|
|
8011
8123
|
|
|
8012
|
-
const AUTOCOMPLETE_POPOVER_PLACEMENT = 'bottom
|
|
8124
|
+
const AUTOCOMPLETE_POPOVER_PLACEMENT = 'bottom';
|
|
8013
8125
|
/**
|
|
8014
8126
|
* @internal
|
|
8015
8127
|
*/
|
|
8016
8128
|
|
|
8017
|
-
const AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS = ['top
|
|
8129
|
+
const AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS = ['bottom', 'top'];
|
|
8018
8130
|
|
|
8019
8131
|
const _excluded$f = ["border", "customValidity", "disabled", "filterOption", "fontSize", "icon", "id", "listBox", "loading", "onBlur", "onChange", "onFocus", "onQueryChange", "onSelect", "openButton", "options", "padding", "popover", "prefix", "radius", "readOnly", "relatedElements", "renderOption", "renderPopover", "renderValue", "suffix", "value"];
|
|
8020
8132
|
|
|
@@ -8092,7 +8204,7 @@ const InnerAutocomplete = /*#__PURE__*/forwardRef(function InnerAutocomplete(pro
|
|
|
8092
8204
|
const popoverMouseWithinRef = useRef(false);
|
|
8093
8205
|
const listBoxId = `${id}-listbox`;
|
|
8094
8206
|
const options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY;
|
|
8095
|
-
const padding =
|
|
8207
|
+
const padding = useArrayProp(paddingProp);
|
|
8096
8208
|
const currentOption = useMemo(() => value !== null ? options.find(o => o.value === value) : undefined, [options, value]);
|
|
8097
8209
|
const filteredOptions = useMemo(() => options.filter(option => query ? filterOption(query, option) : true), [filterOption, options, query]);
|
|
8098
8210
|
const filteredOptionsLen = filteredOptions.length;
|
|
@@ -8409,6 +8521,7 @@ const InnerAutocomplete = /*#__PURE__*/forwardRef(function InnerAutocomplete(pro
|
|
|
8409
8521
|
const content = useMemo(() => {
|
|
8410
8522
|
if (filteredOptions.length === 0) return null;
|
|
8411
8523
|
return /*#__PURE__*/React.createElement(ListBox, _extends({
|
|
8524
|
+
"data-ui": "AutoComplete__results",
|
|
8412
8525
|
onKeyDown: handleListBoxKeyDown,
|
|
8413
8526
|
padding: 1
|
|
8414
8527
|
}, listBox, {
|
|
@@ -8416,6 +8529,7 @@ const InnerAutocomplete = /*#__PURE__*/forwardRef(function InnerAutocomplete(pro
|
|
|
8416
8529
|
}), /*#__PURE__*/React.createElement(Stack, {
|
|
8417
8530
|
as: "ul",
|
|
8418
8531
|
"aria-multiselectable": false,
|
|
8532
|
+
"data-ui": "AutoComplete__resultsList",
|
|
8419
8533
|
id: listBoxId,
|
|
8420
8534
|
ref: listBoxElementRef,
|
|
8421
8535
|
role: "listbox",
|
|
@@ -8508,10 +8622,11 @@ const Breadcrumbs = /*#__PURE__*/forwardRef(function Breadcrumbs(props, ref) {
|
|
|
8508
8622
|
children,
|
|
8509
8623
|
maxLength,
|
|
8510
8624
|
separator,
|
|
8511
|
-
space = 2
|
|
8625
|
+
space: spaceRaw = 2
|
|
8512
8626
|
} = props,
|
|
8513
8627
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$e);
|
|
8514
8628
|
|
|
8629
|
+
const space = useArrayProp(spaceRaw);
|
|
8515
8630
|
const [open, setOpen] = useState(false);
|
|
8516
8631
|
const [expandElement, setExpandElement] = useState(null);
|
|
8517
8632
|
const [popoverElement, setPopoverElement] = useState(null);
|
|
@@ -8595,7 +8710,7 @@ function responsiveDialogPositionStyle(props) {
|
|
|
8595
8710
|
const {
|
|
8596
8711
|
media
|
|
8597
8712
|
} = theme.sanity;
|
|
8598
|
-
return
|
|
8713
|
+
return _responsive(media, props.$position, position => ({
|
|
8599
8714
|
'&&': {
|
|
8600
8715
|
position
|
|
8601
8716
|
}
|
|
@@ -8691,11 +8806,14 @@ const DialogCard = /*#__PURE__*/forwardRef(function DialogCard(props, ref) {
|
|
|
8691
8806
|
id,
|
|
8692
8807
|
onClickOutside,
|
|
8693
8808
|
onClose,
|
|
8694
|
-
radius,
|
|
8809
|
+
radius: radiusProp,
|
|
8695
8810
|
scheme,
|
|
8696
|
-
shadow,
|
|
8697
|
-
width
|
|
8811
|
+
shadow: shadowProp,
|
|
8812
|
+
width: widthProp
|
|
8698
8813
|
} = props;
|
|
8814
|
+
const radius = useArrayProp(radiusProp);
|
|
8815
|
+
const shadow = useArrayProp(shadowProp);
|
|
8816
|
+
const width = useArrayProp(widthProp);
|
|
8699
8817
|
const forwardedRef = useForwardedRef(ref);
|
|
8700
8818
|
const [rootElement, setRootElement] = useState(null);
|
|
8701
8819
|
const localContentRef = useRef(null);
|
|
@@ -8778,7 +8896,7 @@ const Dialog = /*#__PURE__*/forwardRef(function Dialog(props, ref) {
|
|
|
8778
8896
|
const {
|
|
8779
8897
|
__unstable_autoFocus: autoFocus = true,
|
|
8780
8898
|
__unstable_hideCloseButton: hideCloseButton = false,
|
|
8781
|
-
cardRadius = 3,
|
|
8899
|
+
cardRadius: cardRadiusProp = 3,
|
|
8782
8900
|
cardShadow = 4,
|
|
8783
8901
|
children,
|
|
8784
8902
|
contentRef,
|
|
@@ -8787,15 +8905,20 @@ const Dialog = /*#__PURE__*/forwardRef(function Dialog(props, ref) {
|
|
|
8787
8905
|
id,
|
|
8788
8906
|
onClickOutside,
|
|
8789
8907
|
onClose,
|
|
8790
|
-
padding = 4,
|
|
8908
|
+
padding: paddingProp = 4,
|
|
8791
8909
|
portal,
|
|
8792
|
-
position = dialog.position || 'fixed',
|
|
8910
|
+
position: positionProp = dialog.position || 'fixed',
|
|
8793
8911
|
scheme,
|
|
8794
|
-
width = 0,
|
|
8795
|
-
zOffset = dialog.zOffset || ((_theme$sanity$layer = theme.sanity.layer) == null ? void 0 : _theme$sanity$layer.dialog.zOffset)
|
|
8912
|
+
width: widthProp = 0,
|
|
8913
|
+
zOffset: zOffsetProp = dialog.zOffset || ((_theme$sanity$layer = theme.sanity.layer) == null ? void 0 : _theme$sanity$layer.dialog.zOffset)
|
|
8796
8914
|
} = props,
|
|
8797
8915
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$d);
|
|
8798
8916
|
|
|
8917
|
+
const cardRadius = useArrayProp(cardRadiusProp);
|
|
8918
|
+
const padding = useArrayProp(paddingProp);
|
|
8919
|
+
const position = useArrayProp(positionProp);
|
|
8920
|
+
const width = useArrayProp(widthProp);
|
|
8921
|
+
const zOffset = useArrayProp(zOffsetProp);
|
|
8799
8922
|
const preDivRef = useRef(null);
|
|
8800
8923
|
const postDivRef = useRef(null);
|
|
8801
8924
|
const cardRef = useRef(null);
|
|
@@ -8901,10 +9024,12 @@ const Hotkeys = /*#__PURE__*/forwardRef(function Hotkeys(props, ref) {
|
|
|
8901
9024
|
keys,
|
|
8902
9025
|
padding,
|
|
8903
9026
|
radius,
|
|
8904
|
-
space = 1
|
|
9027
|
+
space: spaceProp = 1
|
|
8905
9028
|
} = props,
|
|
8906
9029
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$c);
|
|
8907
9030
|
|
|
9031
|
+
const space = useArrayProp(spaceProp);
|
|
9032
|
+
|
|
8908
9033
|
if (!keys || keys.length === 0) {
|
|
8909
9034
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
8910
9035
|
}
|
|
@@ -9292,17 +9417,17 @@ const Menu = /*#__PURE__*/forwardRef(function Menu(props, ref) {
|
|
|
9292
9417
|
const MenuButton = /*#__PURE__*/forwardRef(function MenuButton(props, ref) {
|
|
9293
9418
|
const {
|
|
9294
9419
|
__unstable_disableRestoreFocusOnClose: disableRestoreFocusOnClose = false,
|
|
9295
|
-
boundaryElement,
|
|
9420
|
+
boundaryElement: deprecated_boundaryElement,
|
|
9296
9421
|
button: buttonProp,
|
|
9297
9422
|
id,
|
|
9298
9423
|
menu: menuProp,
|
|
9299
9424
|
onClose,
|
|
9300
|
-
placement,
|
|
9301
|
-
popoverScheme,
|
|
9302
|
-
portal,
|
|
9425
|
+
placement: deprecated_placement,
|
|
9426
|
+
popoverScheme: deprecated_popoverScheme,
|
|
9427
|
+
portal: deprecated_portal = true,
|
|
9303
9428
|
popover,
|
|
9304
|
-
popoverRadius,
|
|
9305
|
-
preventOverflow
|
|
9429
|
+
popoverRadius: deprecated_popoverRadius,
|
|
9430
|
+
preventOverflow: deprecated_preventOverflow
|
|
9306
9431
|
} = props;
|
|
9307
9432
|
const [open, setOpen] = useState(false);
|
|
9308
9433
|
const [shouldFocus, setShouldFocus] = useState(null);
|
|
@@ -9424,14 +9549,14 @@ const MenuButton = /*#__PURE__*/forwardRef(function MenuButton(props, ref) {
|
|
|
9424
9549
|
}) : null, [buttonProp, handleButtonClick, handleButtonKeyDown, id, open, setButtonRef]);
|
|
9425
9550
|
const popoverProps = useMemo(() => {
|
|
9426
9551
|
return _extends({
|
|
9427
|
-
boundaryElement,
|
|
9428
|
-
placement,
|
|
9429
|
-
portal,
|
|
9430
|
-
radius:
|
|
9431
|
-
|
|
9432
|
-
scheme:
|
|
9552
|
+
boundaryElement: deprecated_boundaryElement,
|
|
9553
|
+
placement: deprecated_placement,
|
|
9554
|
+
portal: deprecated_portal,
|
|
9555
|
+
radius: deprecated_popoverRadius,
|
|
9556
|
+
preventOverflow: deprecated_preventOverflow,
|
|
9557
|
+
scheme: deprecated_popoverScheme
|
|
9433
9558
|
}, popover || {});
|
|
9434
|
-
}, [
|
|
9559
|
+
}, [deprecated_boundaryElement, deprecated_preventOverflow, deprecated_placement, popover, deprecated_popoverRadius, deprecated_portal, deprecated_popoverScheme]);
|
|
9435
9560
|
return /*#__PURE__*/React.createElement(Popover, _extends({}, popoverProps, {
|
|
9436
9561
|
content: menu,
|
|
9437
9562
|
"data-ui": "MenuButton__popover",
|
|
@@ -9564,7 +9689,7 @@ function selectableColorStyle(props) {
|
|
|
9564
9689
|
* @internal
|
|
9565
9690
|
*/
|
|
9566
9691
|
|
|
9567
|
-
const Selectable = styled(Box)(
|
|
9692
|
+
const Selectable = styled(Box)(responsiveRadiusStyle, selectableBaseStyle, selectableColorStyle);
|
|
9568
9693
|
|
|
9569
9694
|
function useMenu() {
|
|
9570
9695
|
const value = useContext(MenuContext);
|
|
@@ -9596,7 +9721,7 @@ function MenuGroup(props) {
|
|
|
9596
9721
|
icon,
|
|
9597
9722
|
onClick,
|
|
9598
9723
|
padding = 3,
|
|
9599
|
-
popover
|
|
9724
|
+
popover,
|
|
9600
9725
|
radius = 2,
|
|
9601
9726
|
space = 3,
|
|
9602
9727
|
text,
|
|
@@ -9694,7 +9819,7 @@ function MenuGroup(props) {
|
|
|
9694
9819
|
"aria-pressed": as === 'button' ? withinMenu : undefined,
|
|
9695
9820
|
"data-pressed": as !== 'button' ? withinMenu : undefined,
|
|
9696
9821
|
"data-selected": !withinMenu && active ? '' : undefined,
|
|
9697
|
-
"$radius": radius,
|
|
9822
|
+
"$radius": useArrayProp(radius),
|
|
9698
9823
|
"$tone": tone,
|
|
9699
9824
|
onClick: handleClick,
|
|
9700
9825
|
onKeyDown: handleKeyDown,
|
|
@@ -9781,21 +9906,20 @@ const MenuItem = /*#__PURE__*/forwardRef(function MenuItem(props, forwardedRef)
|
|
|
9781
9906
|
setRootElement(el);
|
|
9782
9907
|
}, [ref]);
|
|
9783
9908
|
return /*#__PURE__*/React.createElement(Selectable, _extends({
|
|
9784
|
-
"data-
|
|
9785
|
-
"data-ui": "MenuItem",
|
|
9786
|
-
forwardedAs: as
|
|
9909
|
+
"data-ui": "MenuItem"
|
|
9787
9910
|
}, restProps, {
|
|
9788
9911
|
"aria-pressed": as === 'button' && pressed,
|
|
9789
9912
|
"data-pressed": as !== 'button' && pressed ? '' : undefined,
|
|
9790
9913
|
"data-selected": active ? '' : undefined,
|
|
9791
9914
|
"data-disabled": disabled ? '' : undefined,
|
|
9792
|
-
|
|
9915
|
+
forwardedAs: as,
|
|
9916
|
+
"$radius": useArrayProp(radius),
|
|
9917
|
+
"$padding": useArrayProp(0),
|
|
9793
9918
|
"$tone": tone,
|
|
9794
9919
|
disabled: disabled,
|
|
9795
9920
|
onClick: handleClick,
|
|
9796
9921
|
onMouseEnter: onItemMouseEnter,
|
|
9797
9922
|
onMouseLeave: onItemMouseLeave,
|
|
9798
|
-
padding: 0,
|
|
9799
9923
|
ref: setRef,
|
|
9800
9924
|
role: "menuitem",
|
|
9801
9925
|
tabIndex: -1,
|
|
@@ -9913,7 +10037,7 @@ const Skeleton = /*#__PURE__*/forwardRef(function Skeleton(props, ref) {
|
|
|
9913
10037
|
}, [delay]);
|
|
9914
10038
|
return /*#__PURE__*/React.createElement(Root$4, _extends({}, restProps, {
|
|
9915
10039
|
"$animated": animated,
|
|
9916
|
-
"$radius": radius,
|
|
10040
|
+
"$radius": useArrayProp(radius),
|
|
9917
10041
|
"$visible": visible,
|
|
9918
10042
|
ref: ref
|
|
9919
10043
|
}));
|
|
@@ -9932,13 +10056,15 @@ const Root$3 = styled(Skeleton)(({
|
|
|
9932
10056
|
media
|
|
9933
10057
|
} = theme.sanity;
|
|
9934
10058
|
const font = theme.sanity.fonts[$style];
|
|
9935
|
-
|
|
10059
|
+
|
|
10060
|
+
const styles = _responsive(media, $size, sizeIndex => {
|
|
9936
10061
|
const fontSize = font.sizes[sizeIndex];
|
|
9937
10062
|
const capHeight = fontSize.lineHeight - fontSize.ascenderHeight - fontSize.descenderHeight;
|
|
9938
10063
|
return {
|
|
9939
10064
|
height: capHeight
|
|
9940
10065
|
};
|
|
9941
10066
|
});
|
|
10067
|
+
|
|
9942
10068
|
return styles;
|
|
9943
10069
|
});
|
|
9944
10070
|
/**
|
|
@@ -9952,7 +10078,7 @@ const TextSkeleton = /*#__PURE__*/forwardRef(function TextSkeleton(props, ref) {
|
|
|
9952
10078
|
} = props,
|
|
9953
10079
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$7);
|
|
9954
10080
|
|
|
9955
|
-
const $size =
|
|
10081
|
+
const $size = useArrayProp(size);
|
|
9956
10082
|
return /*#__PURE__*/React.createElement(Root$3, _extends({}, restProps, {
|
|
9957
10083
|
"$size": $size,
|
|
9958
10084
|
ref: ref,
|
|
@@ -9970,7 +10096,7 @@ const LabelSkeleton = /*#__PURE__*/forwardRef(function TextSkeleton(props, ref)
|
|
|
9970
10096
|
} = props,
|
|
9971
10097
|
restProps = _objectWithoutPropertiesLoose(props, _excluded2);
|
|
9972
10098
|
|
|
9973
|
-
const $size =
|
|
10099
|
+
const $size = useArrayProp(size);
|
|
9974
10100
|
return /*#__PURE__*/React.createElement(Root$3, _extends({}, restProps, {
|
|
9975
10101
|
"$size": $size,
|
|
9976
10102
|
ref: ref,
|
|
@@ -9988,7 +10114,7 @@ const HeadingSkeleton = /*#__PURE__*/forwardRef(function TextSkeleton(props, ref
|
|
|
9988
10114
|
} = props,
|
|
9989
10115
|
restProps = _objectWithoutPropertiesLoose(props, _excluded3);
|
|
9990
10116
|
|
|
9991
|
-
const $size =
|
|
10117
|
+
const $size = useArrayProp(size);
|
|
9992
10118
|
return /*#__PURE__*/React.createElement(Root$3, _extends({}, restProps, {
|
|
9993
10119
|
"$size": $size,
|
|
9994
10120
|
ref: ref,
|
|
@@ -10006,7 +10132,7 @@ const CodeSkeleton = /*#__PURE__*/forwardRef(function TextSkeleton(props, ref) {
|
|
|
10006
10132
|
} = props,
|
|
10007
10133
|
restProps = _objectWithoutPropertiesLoose(props, _excluded4);
|
|
10008
10134
|
|
|
10009
|
-
const $size =
|
|
10135
|
+
const $size = useArrayProp(size);
|
|
10010
10136
|
return /*#__PURE__*/React.createElement(Root$3, _extends({}, restProps, {
|
|
10011
10137
|
"$size": $size,
|
|
10012
10138
|
ref: ref,
|
|
@@ -10958,5 +11084,5 @@ const TreeItem = /*#__PURE__*/memo(function TreeItem(props) {
|
|
|
10958
11084
|
}, children)));
|
|
10959
11085
|
});
|
|
10960
11086
|
|
|
10961
|
-
export { Autocomplete, Avatar, AvatarCounter, AvatarStack, Badge, BoundaryElementProvider, Box, Breadcrumbs, Button, Card, Checkbox, Code, CodeSkeleton, Container, Dialog, DialogContext, DialogProvider, ElementQuery, ErrorBoundary, Flex, Grid, Heading, HeadingSkeleton, Hotkeys, Inline, KBD, Label, LabelSkeleton, Layer, LayerProvider, Menu, MenuButton, MenuDivider, MenuGroup, MenuItem, Popover, Portal, PortalProvider, Radio,
|
|
10962
|
-
//# sourceMappingURL=sanity-ui.modern.
|
|
11087
|
+
export { Autocomplete, Avatar, AvatarCounter, AvatarStack, Badge, BoundaryElementProvider, Box, Breadcrumbs, Button, Card, Checkbox, Code, CodeSkeleton, Container, Dialog, DialogContext, DialogProvider, ElementQuery, ErrorBoundary, Flex, Grid, Heading, HeadingSkeleton, Hotkeys, Inline, KBD, Label, LabelSkeleton, Layer, LayerProvider, Menu, MenuButton, MenuDivider, MenuGroup, MenuItem, Popover, Portal, PortalProvider, Radio, Select, Skeleton, Spinner, SrOnly, Stack, Switch, Tab, TabList, TabPanel, Text, TextArea, TextInput, TextSkeleton, ThemeColorProvider, ThemeProvider, Toast, ToastProvider, Tooltip, Tree, TreeItem, VirtualList, _ResizeObserver, _elementSizeObserver, _fillCSSObject, _getArrayProp, _getResponsiveSpace, _hasFocus, _isEnterToClickElement, _isScrollable, _raf, _raf2, _responsive, attemptFocus, createColorTheme, focusFirstDescendant, focusLastDescendant, hexToRgb, hslToRgb, isFocusable, isHTMLAnchorElement, isHTMLButtonElement, isHTMLElement, isHTMLInputElement, isHTMLSelectElement, isHTMLTextAreaElement, multiply$1 as multiply, parseColor, rem, responsiveCodeFontStyle, responsiveHeadingFont, responsiveLabelFont, responsiveTextAlignStyle, responsiveTextFont, rgbToHex, rgbToHsl, rgba, screen$1 as screen, studioTheme, useArrayProp, useBoundaryElement, useClickOutside, useCustomValidity, useDialog, useElementRect, useElementSize, useForwardedRef, useGlobalKeyDown, useLayer, useMediaIndex, usePortal, usePrefersDark, useRootTheme, useTheme, useToast, useTree };
|
|
11088
|
+
//# sourceMappingURL=sanity-ui.modern.mjs.map
|