@sanity/ui 0.37.21 → 0.38.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/menuGroup.d.ts.map +1 -1
- package/lib/dts/src/components/skeleton/skeleton.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.map +1 -1
- 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.map +1 -1
- 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.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.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 +7 -2
- 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/studioTheme/color.d.ts.map +1 -1
- 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 +734 -573
- package/lib/sanity-ui.js.map +1 -1
- package/lib/sanity-ui.modern.js +763 -592
- package/lib/sanity-ui.modern.js.map +1 -1
- package/lib/sanity-ui.module.js +728 -569
- package/lib/sanity-ui.module.js.map +1 -1
- package/package.json +11 -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.tsx +2 -2
- package/src/components/breadcrumbs/breadcrumbs.tsx +3 -2
- package/src/components/dialog/dialog.tsx +17 -9
- package/src/components/dialog/styles.ts +4 -4
- 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/menuGroup.tsx +3 -2
- package/src/components/menu/menuItem.tsx +3 -3
- package/src/components/skeleton/skeleton.tsx +10 -1
- package/src/components/skeleton/textSkeleton.tsx +7 -7
- 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 -3
- package/src/primitives/_selectable/selectable.tsx +5 -4
- package/src/primitives/avatar/avatar.tsx +7 -5
- package/src/primitives/avatar/avatarCounter.tsx +12 -11
- package/src/primitives/avatar/avatarStack.tsx +15 -10
- package/src/primitives/avatar/styles.ts +2 -2
- package/src/primitives/badge/badge.tsx +3 -2
- package/src/primitives/box/box.tsx +26 -25
- package/src/primitives/button/button.tsx +22 -10
- package/src/primitives/card/card.tsx +8 -7
- 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} +12 -14
- package/src/primitives/popover/__workshop__/{recursive.tsx → RecursiveStory.tsx} +4 -1
- package/src/primitives/popover/__workshop__/RightAlignedStory.tsx +60 -0
- package/src/primitives/popover/__workshop__/TestStory.tsx +79 -0
- package/src/primitives/popover/__workshop__/index.ts +10 -5
- package/src/primitives/popover/popover.tsx +29 -10
- 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 +21 -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 +234 -95
- package/src/primitives/textInput/__workshop__/typed.tsx +8 -2
- package/src/primitives/textInput/textInput.tsx +47 -12
- package/src/primitives/tooltip/__workshop__/props.tsx +7 -2
- package/src/primitives/tooltip/tooltip.tsx +19 -9
- 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 +2 -4
- 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 +92 -80
- 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/studioTheme/color.ts +15 -14
- package/src/theme/studioTheme/fonts.ts +4 -4
- package/src/utils/elementQuery/elementQuery.tsx +5 -18
- package/src/utils/index.ts +0 -1
- package/src/utils/layer/layerProvider.tsx +2 -2
- package/src/utils/virtualList/virtualList.tsx +3 -1
- 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/utils/resizeObserver.d.ts +0 -6
- package/lib/dts/src/utils/resizeObserver.d.ts.map +0 -1
- package/src/hooks/useResponsiveProp.ts +0 -10
- package/src/primitives/popover/__workshop__/rightAligned.tsx +0 -57
package/lib/sanity-ui.modern.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
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, useReducer, Children, Fragment, memo } 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
9
|
import { usePopper } from 'react-popper';
|
|
9
|
-
import { ResizeObserver as ResizeObserver$1 } from '@juggle/resize-observer';
|
|
10
10
|
import ReactDOM from 'react-dom';
|
|
11
11
|
import maxSizeModifier from 'popper-max-size-modifier';
|
|
12
12
|
import { AnimatePresence, motion } from 'framer-motion';
|
|
@@ -47,6 +47,213 @@ function _objectWithoutPropertiesLoose(source, excluded) {
|
|
|
47
47
|
const EMPTY_ARRAY = [];
|
|
48
48
|
const EMPTY_RECORD = {};
|
|
49
49
|
|
|
50
|
+
/**
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
function _fillCSSObject(keys, value) {
|
|
55
|
+
return keys.reduce((style, key) => {
|
|
56
|
+
style[key] = value;
|
|
57
|
+
return style;
|
|
58
|
+
}, {});
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* @public
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
function rem(pixelValue) {
|
|
65
|
+
if (pixelValue === 0) return 0;
|
|
66
|
+
return `${pixelValue / 16}rem`;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
function _responsive(media, values, callback) {
|
|
73
|
+
const statements = values.map(callback);
|
|
74
|
+
return statements.map((statement, mediaIndex) => {
|
|
75
|
+
if (mediaIndex === 0) return statement;
|
|
76
|
+
return {
|
|
77
|
+
[`@media screen and (min-width: ${media[mediaIndex - 1]}px)`]: statement
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
84
|
+
|
|
85
|
+
function _getArrayProp(val, defaultVal) {
|
|
86
|
+
if (val === undefined) return defaultVal || EMPTY_ARRAY;
|
|
87
|
+
return Array.isArray(val) ? val : [val];
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* @internal
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
function _getResponsiveSpace(theme, props, spaceIndexes = EMPTY_ARRAY) {
|
|
94
|
+
if (!Array.isArray(spaceIndexes)) {
|
|
95
|
+
throw new Error('the property must be array of numbers');
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (spaceIndexes.length === 0) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return _responsive(theme.sanity.media, spaceIndexes, spaceIndex => _fillCSSObject(props, rem(theme.sanity.space[spaceIndex])));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* A utility function getting responsive font styles.
|
|
107
|
+
* @internal
|
|
108
|
+
*/
|
|
109
|
+
|
|
110
|
+
function responsiveFont(fontKey, props) {
|
|
111
|
+
const {
|
|
112
|
+
$size,
|
|
113
|
+
$weight,
|
|
114
|
+
theme
|
|
115
|
+
} = props;
|
|
116
|
+
const {
|
|
117
|
+
fonts,
|
|
118
|
+
media
|
|
119
|
+
} = theme.sanity;
|
|
120
|
+
const {
|
|
121
|
+
family,
|
|
122
|
+
sizes,
|
|
123
|
+
weights
|
|
124
|
+
} = fonts[fontKey];
|
|
125
|
+
const fontWeight = $weight && weights[$weight] || weights.regular; // @todo: make this configurable
|
|
126
|
+
|
|
127
|
+
const defaultSize = sizes[2];
|
|
128
|
+
const base = {
|
|
129
|
+
position: 'relative',
|
|
130
|
+
fontFamily: family,
|
|
131
|
+
fontWeight,
|
|
132
|
+
padding: '1px 0',
|
|
133
|
+
margin: 0,
|
|
134
|
+
'&:before': {
|
|
135
|
+
content: '""',
|
|
136
|
+
display: 'block',
|
|
137
|
+
height: 0
|
|
138
|
+
},
|
|
139
|
+
'&:after': {
|
|
140
|
+
content: '""',
|
|
141
|
+
display: 'block',
|
|
142
|
+
height: 0
|
|
143
|
+
},
|
|
144
|
+
'& > code, & > span': {
|
|
145
|
+
display: 'block'
|
|
146
|
+
},
|
|
147
|
+
'&:not([hidden])': {
|
|
148
|
+
display: 'block'
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
const resp = _responsive(media, $size, sizeIndex => fontSize(sizes[sizeIndex] || defaultSize));
|
|
153
|
+
|
|
154
|
+
return [base, ...resp];
|
|
155
|
+
}
|
|
156
|
+
function fontSize(size) {
|
|
157
|
+
const {
|
|
158
|
+
ascenderHeight,
|
|
159
|
+
descenderHeight,
|
|
160
|
+
fontSize,
|
|
161
|
+
iconSize,
|
|
162
|
+
letterSpacing,
|
|
163
|
+
lineHeight
|
|
164
|
+
} = size;
|
|
165
|
+
const negHeight = ascenderHeight + descenderHeight;
|
|
166
|
+
const capHeight = lineHeight - negHeight;
|
|
167
|
+
const iconOffset = (capHeight - iconSize) / 2;
|
|
168
|
+
const customIconSize = Math.floor(fontSize * 1.125 / 2) * 2 + 1;
|
|
169
|
+
const customIconOffset = (capHeight - customIconSize) / 2;
|
|
170
|
+
return {
|
|
171
|
+
fontSize: rem(fontSize),
|
|
172
|
+
lineHeight: `calc(${lineHeight} / ${fontSize})`,
|
|
173
|
+
letterSpacing: rem(letterSpacing),
|
|
174
|
+
transform: `translateY(${rem(descenderHeight)})`,
|
|
175
|
+
'&:before': {
|
|
176
|
+
marginTop: `calc(${rem(0 - negHeight)} - 1px)`
|
|
177
|
+
},
|
|
178
|
+
'&:after': {
|
|
179
|
+
marginBottom: '-1px'
|
|
180
|
+
},
|
|
181
|
+
'& svg:not([data-sanity-icon])': {
|
|
182
|
+
fontSize: `calc(${customIconSize} / 16 * 1rem)`,
|
|
183
|
+
margin: rem(customIconOffset)
|
|
184
|
+
},
|
|
185
|
+
'& [data-sanity-icon]': {
|
|
186
|
+
fontSize: `calc(${iconSize} / 16 * 1rem)`,
|
|
187
|
+
margin: rem(iconOffset)
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Get responsive CSS for the `code` font style.
|
|
194
|
+
* @internal
|
|
195
|
+
*/
|
|
196
|
+
|
|
197
|
+
function responsiveCodeFontStyle(props) {
|
|
198
|
+
return responsiveFont('code', props);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* Get responsive CSS for the `heading` font style.
|
|
203
|
+
* @internal
|
|
204
|
+
*/
|
|
205
|
+
|
|
206
|
+
function responsiveHeadingFont(props) {
|
|
207
|
+
return responsiveFont('heading', props);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Get responsive CSS for the `label` font style.
|
|
212
|
+
* @internal
|
|
213
|
+
*/
|
|
214
|
+
|
|
215
|
+
function responsiveLabelFont(props) {
|
|
216
|
+
return responsiveFont('label', props);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* Get responsive text align styles.
|
|
221
|
+
* @internal
|
|
222
|
+
*/
|
|
223
|
+
|
|
224
|
+
function responsiveTextAlignStyle(props) {
|
|
225
|
+
const {
|
|
226
|
+
theme
|
|
227
|
+
} = props;
|
|
228
|
+
return _responsive(theme.sanity.media, props.$align, textAlign => {
|
|
229
|
+
return {
|
|
230
|
+
textAlign
|
|
231
|
+
};
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
|
+
* Get responsive CSS for the `text` font style.
|
|
237
|
+
* @internal
|
|
238
|
+
*/
|
|
239
|
+
|
|
240
|
+
function responsiveTextFont(props) {
|
|
241
|
+
return responsiveFont('text', props);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* This API might change. DO NOT USE IN PRODUCTION.
|
|
246
|
+
* @beta
|
|
247
|
+
*/
|
|
248
|
+
|
|
249
|
+
function useArrayProp(val, defaultVal) {
|
|
250
|
+
const __perf_hash__ = JSON.stringify(val != null ? val : defaultVal);
|
|
251
|
+
|
|
252
|
+
return useMemo(() => _getArrayProp(val, defaultVal), // Improve performance: Keep object identify for a given hash of the value
|
|
253
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
254
|
+
[__perf_hash__]);
|
|
255
|
+
}
|
|
256
|
+
|
|
50
257
|
function _getElements(element, elementsArg) {
|
|
51
258
|
const ret = [element];
|
|
52
259
|
|
|
@@ -128,21 +335,107 @@ function useClickOutside(listener, elementsArg = EMPTY_ARRAY, boundaryElement) {
|
|
|
128
335
|
}
|
|
129
336
|
|
|
130
337
|
/**
|
|
131
|
-
*
|
|
338
|
+
* @internal
|
|
339
|
+
*/
|
|
340
|
+
|
|
341
|
+
const _ResizeObserver = typeof window !== 'undefined' && window.ResizeObserver ? window.ResizeObserver : ResizeObserver;
|
|
342
|
+
|
|
343
|
+
// NOTE: this should NOT have size effects
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* @internal
|
|
347
|
+
*/
|
|
348
|
+
|
|
349
|
+
const _elementSizeObserver = _createElementSizeObserver();
|
|
350
|
+
|
|
351
|
+
function _createElementRectValueListener() {
|
|
352
|
+
return {
|
|
353
|
+
subscribe(element, subscriber) {
|
|
354
|
+
const resizeObserver = new _ResizeObserver(([entry]) => {
|
|
355
|
+
subscriber({
|
|
356
|
+
_contentRect: entry.contentRect,
|
|
357
|
+
border: {
|
|
358
|
+
width: entry.borderBoxSize[0].inlineSize,
|
|
359
|
+
height: entry.borderBoxSize[0].blockSize
|
|
360
|
+
},
|
|
361
|
+
content: {
|
|
362
|
+
width: entry.contentRect.width,
|
|
363
|
+
height: entry.contentRect.height
|
|
364
|
+
}
|
|
365
|
+
});
|
|
366
|
+
});
|
|
367
|
+
resizeObserver.observe(element);
|
|
368
|
+
return () => {
|
|
369
|
+
resizeObserver.unobserve(element);
|
|
370
|
+
resizeObserver.disconnect();
|
|
371
|
+
};
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
function _createElementSizeObserver() {
|
|
378
|
+
const disposeCache = new WeakMap();
|
|
379
|
+
const subscribersCache = new WeakMap();
|
|
380
|
+
return {
|
|
381
|
+
subscribe(element, subscriber) {
|
|
382
|
+
const subscribers = subscribersCache.get(element) || [];
|
|
383
|
+
let dispose = disposeCache.get(element);
|
|
384
|
+
|
|
385
|
+
if (!subscribersCache.has(element)) {
|
|
386
|
+
subscribersCache.set(element, subscribers);
|
|
387
|
+
|
|
388
|
+
const listener = _createElementRectValueListener(); // listen
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
dispose = listener.subscribe(element, elementRect => {
|
|
392
|
+
for (const sub of subscribers) {
|
|
393
|
+
sub(elementRect);
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
subscribers.push(subscriber);
|
|
399
|
+
return () => {
|
|
400
|
+
// dispose
|
|
401
|
+
const idx = subscribers.indexOf(subscriber);
|
|
402
|
+
|
|
403
|
+
if (idx > -1) {
|
|
404
|
+
subscribers.splice(idx, 1);
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
if (subscribers.length === 0) {
|
|
408
|
+
// unlisten
|
|
409
|
+
if (dispose) dispose();
|
|
410
|
+
}
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Subscribe to the size of a DOM element.
|
|
132
419
|
* @beta
|
|
133
420
|
*/
|
|
134
421
|
|
|
135
|
-
function
|
|
136
|
-
const [
|
|
422
|
+
function useElementSize(element) {
|
|
423
|
+
const [size, setSize] = useState(null);
|
|
137
424
|
useEffect(() => {
|
|
138
425
|
if (!element) return undefined;
|
|
139
|
-
|
|
140
|
-
setRect(entries[0].contentRect);
|
|
141
|
-
});
|
|
142
|
-
ro.observe(element);
|
|
143
|
-
return () => ro.disconnect();
|
|
426
|
+
return _elementSizeObserver.subscribe(element, setSize);
|
|
144
427
|
}, [element]);
|
|
145
|
-
return
|
|
428
|
+
return size;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
/**
|
|
432
|
+
* Subscribe to the rect of a DOM element.
|
|
433
|
+
* @deprecated Use `useElementSize` instead
|
|
434
|
+
*/
|
|
435
|
+
|
|
436
|
+
function useElementRect(element) {
|
|
437
|
+
const elementSize = useElementSize(element);
|
|
438
|
+
return (elementSize == null ? void 0 : elementSize._contentRect) || null;
|
|
146
439
|
}
|
|
147
440
|
|
|
148
441
|
/**
|
|
@@ -1591,18 +1884,20 @@ const color = createColorTheme({
|
|
|
1591
1884
|
name
|
|
1592
1885
|
}) => {
|
|
1593
1886
|
if (name === 'default') {
|
|
1594
|
-
const
|
|
1887
|
+
const _tints = hues.gray;
|
|
1888
|
+
|
|
1889
|
+
const _skeletonFrom = dark ? _tints[900].hex : _tints[100].hex;
|
|
1595
1890
|
|
|
1596
1891
|
return {
|
|
1597
1892
|
fg: dark ? white$1.hex : black$1.hex,
|
|
1598
1893
|
bg: dark ? black$1.hex : white$1.hex,
|
|
1599
|
-
border:
|
|
1894
|
+
border: _tints[dark ? 800 : 200].hex,
|
|
1600
1895
|
focusRing: hues.blue[dark ? 500 : 500].hex,
|
|
1601
1896
|
shadow: {
|
|
1602
|
-
outline: rgba(
|
|
1603
|
-
umbra:
|
|
1604
|
-
penumbra:
|
|
1605
|
-
ambient:
|
|
1897
|
+
outline: rgba(_tints[500].hex, 0.4),
|
|
1898
|
+
umbra: dark ? rgba(_tints[950].hex, 0.4) : rgba(_tints[500].hex, 0.2),
|
|
1899
|
+
penumbra: dark ? rgba(_tints[950].hex, 0.28) : rgba(_tints[500].hex, 0.14),
|
|
1900
|
+
ambient: dark ? rgba(_tints[950].hex, 0.24) : rgba(_tints[500].hex, 0.12)
|
|
1606
1901
|
},
|
|
1607
1902
|
skeleton: {
|
|
1608
1903
|
from: _skeletonFrom,
|
|
@@ -1612,18 +1907,18 @@ const color = createColorTheme({
|
|
|
1612
1907
|
}
|
|
1613
1908
|
|
|
1614
1909
|
if (name === 'transparent') {
|
|
1615
|
-
const
|
|
1616
|
-
const _skeletonFrom2 =
|
|
1910
|
+
const _tints2 = tones.default;
|
|
1911
|
+
const _skeletonFrom2 = _tints2[dark ? 800 : 200].hex;
|
|
1617
1912
|
return {
|
|
1618
|
-
fg:
|
|
1619
|
-
bg:
|
|
1620
|
-
border:
|
|
1913
|
+
fg: _tints2[dark ? 100 : 900].hex,
|
|
1914
|
+
bg: _tints2[dark ? 950 : 50].hex,
|
|
1915
|
+
border: _tints2[dark ? 800 : 300].hex,
|
|
1621
1916
|
focusRing: hues.blue[500].hex,
|
|
1622
1917
|
shadow: {
|
|
1623
|
-
outline: rgba(
|
|
1624
|
-
umbra:
|
|
1625
|
-
penumbra:
|
|
1626
|
-
ambient:
|
|
1918
|
+
outline: rgba(_tints2[500].hex, 0.4),
|
|
1919
|
+
umbra: dark ? rgba(_tints2[900].hex, 0.4) : rgba(_tints2[500].hex, 0.2),
|
|
1920
|
+
penumbra: dark ? rgba(_tints2[900].hex, 0.28) : rgba(_tints2[500].hex, 0.14),
|
|
1921
|
+
ambient: dark ? rgba(_tints2[900].hex, 0.24) : rgba(_tints2[500].hex, 0.12)
|
|
1627
1922
|
},
|
|
1628
1923
|
skeleton: {
|
|
1629
1924
|
from: _skeletonFrom2,
|
|
@@ -1640,10 +1935,10 @@ const color = createColorTheme({
|
|
|
1640
1935
|
border: tints[dark ? 800 : 200].hex,
|
|
1641
1936
|
focusRing: tints[500].hex,
|
|
1642
1937
|
shadow: {
|
|
1643
|
-
outline: rgba(tints[500].hex,
|
|
1644
|
-
umbra:
|
|
1645
|
-
penumbra:
|
|
1646
|
-
ambient:
|
|
1938
|
+
outline: rgba(tints[500].hex, 0.4),
|
|
1939
|
+
umbra: dark ? rgba(tints[900].hex, 0.4) : rgba(tints[500].hex, 0.2),
|
|
1940
|
+
penumbra: dark ? rgba(tints[900].hex, 0.28) : rgba(tints[500].hex, 0.14),
|
|
1941
|
+
ambient: dark ? rgba(tints[900].hex, 0.24) : rgba(tints[500].hex, 0.12)
|
|
1647
1942
|
},
|
|
1648
1943
|
skeleton: {
|
|
1649
1944
|
from: skeletonFrom,
|
|
@@ -2314,15 +2609,15 @@ const fonts = {
|
|
|
2314
2609
|
lineHeight: 33,
|
|
2315
2610
|
letterSpacing: 0
|
|
2316
2611
|
}, {
|
|
2317
|
-
ascenderHeight:
|
|
2318
|
-
descenderHeight:
|
|
2612
|
+
ascenderHeight: 8,
|
|
2613
|
+
descenderHeight: 8,
|
|
2319
2614
|
fontSize: 33,
|
|
2320
2615
|
iconSize: 49,
|
|
2321
2616
|
lineHeight: 39,
|
|
2322
2617
|
letterSpacing: 0
|
|
2323
2618
|
}, {
|
|
2324
|
-
ascenderHeight:
|
|
2325
|
-
descenderHeight:
|
|
2619
|
+
ascenderHeight: 9,
|
|
2620
|
+
descenderHeight: 9,
|
|
2326
2621
|
fontSize: 38,
|
|
2327
2622
|
iconSize: 53,
|
|
2328
2623
|
lineHeight: 45,
|
|
@@ -2708,310 +3003,109 @@ function _createMediaManager(media) {
|
|
|
2708
3003
|
} else {
|
|
2709
3004
|
mq.removeListener(handleChange);
|
|
2710
3005
|
}
|
|
2711
|
-
});
|
|
2712
|
-
}
|
|
2713
|
-
|
|
2714
|
-
return () => {
|
|
2715
|
-
for (const disposeFn of disposeFns) {
|
|
2716
|
-
disposeFn();
|
|
2717
|
-
}
|
|
2718
|
-
};
|
|
2719
|
-
};
|
|
2720
|
-
|
|
2721
|
-
return {
|
|
2722
|
-
getCurrentIndex,
|
|
2723
|
-
subscribe
|
|
2724
|
-
};
|
|
2725
|
-
}
|
|
2726
|
-
/**
|
|
2727
|
-
* @internal
|
|
2728
|
-
*/
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
function _getMediaManager(media) {
|
|
2732
|
-
let manager = MEDIA_MANAGER_CACHE.get(media);
|
|
2733
|
-
|
|
2734
|
-
if (!manager) {
|
|
2735
|
-
manager = _createMediaManager(media);
|
|
2736
|
-
MEDIA_MANAGER_CACHE.set(media, manager);
|
|
2737
|
-
}
|
|
2738
|
-
|
|
2739
|
-
return manager;
|
|
2740
|
-
}
|
|
2741
|
-
|
|
2742
|
-
/**
|
|
2743
|
-
* This API might change. DO NOT USE IN PRODUCTION.
|
|
2744
|
-
* @beta
|
|
2745
|
-
*/
|
|
2746
|
-
|
|
2747
|
-
function useMediaIndex() {
|
|
2748
|
-
const theme = useTheme();
|
|
2749
|
-
const {
|
|
2750
|
-
media
|
|
2751
|
-
} = theme.sanity;
|
|
2752
|
-
const manager = useMemo(() => _getMediaManager(media), [media]);
|
|
2753
|
-
const [index, setIndex] = useState(manager.getCurrentIndex);
|
|
2754
|
-
useEffect(() => manager.subscribe(setIndex), [manager]);
|
|
2755
|
-
return index;
|
|
2756
|
-
}
|
|
2757
|
-
|
|
2758
|
-
/**
|
|
2759
|
-
* @public
|
|
2760
|
-
*/
|
|
2761
|
-
|
|
2762
|
-
function usePrefersDark() {
|
|
2763
|
-
const mq = useMemo(() => {
|
|
2764
|
-
if (typeof window === 'undefined') return undefined;
|
|
2765
|
-
return window.matchMedia('(prefers-color-scheme: dark)');
|
|
2766
|
-
}, []);
|
|
2767
|
-
const [dark, setDark] = useState((mq == null ? void 0 : mq.matches) || false);
|
|
2768
|
-
useEffect(() => {
|
|
2769
|
-
if (!mq) return undefined;
|
|
2770
|
-
setDark(mq.matches);
|
|
2771
|
-
|
|
2772
|
-
const handleChange = () => setDark(mq.matches);
|
|
2773
|
-
|
|
2774
|
-
mq.addEventListener('change', handleChange);
|
|
2775
|
-
return () => mq.removeEventListener('change', handleChange);
|
|
2776
|
-
}, [mq]);
|
|
2777
|
-
return dark;
|
|
2778
|
-
}
|
|
2779
|
-
|
|
2780
|
-
/**
|
|
2781
|
-
* @beta
|
|
2782
|
-
*/
|
|
2783
|
-
|
|
2784
|
-
const useIsomorphicEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
2785
|
-
|
|
2786
|
-
/**
|
|
2787
|
-
* @beta
|
|
2788
|
-
*/
|
|
2789
|
-
|
|
2790
|
-
function useForwardedRef(ref) {
|
|
2791
|
-
const innerRef = useRef(null);
|
|
2792
|
-
useIsomorphicEffect(() => {
|
|
2793
|
-
if (!ref) return;
|
|
2794
|
-
|
|
2795
|
-
if (typeof ref === 'function') {
|
|
2796
|
-
ref(innerRef.current);
|
|
2797
|
-
} else {
|
|
2798
|
-
ref.current = innerRef.current;
|
|
2799
|
-
}
|
|
2800
|
-
});
|
|
2801
|
-
return innerRef;
|
|
2802
|
-
}
|
|
2803
|
-
|
|
2804
|
-
/**
|
|
2805
|
-
* @beta
|
|
2806
|
-
*/
|
|
2807
|
-
|
|
2808
|
-
function useCustomValidity(ref, customValidity) {
|
|
2809
|
-
useEffect(() => {
|
|
2810
|
-
if (ref.current) {
|
|
2811
|
-
ref.current.setCustomValidity(customValidity || '');
|
|
2812
|
-
}
|
|
2813
|
-
}, [customValidity, ref]);
|
|
2814
|
-
}
|
|
2815
|
-
|
|
2816
|
-
/**
|
|
2817
|
-
* @internal
|
|
2818
|
-
*/
|
|
2819
|
-
|
|
2820
|
-
function fillCSSObject(propKeys, value) {
|
|
2821
|
-
return propKeys.reduce((obj, propKey) => {
|
|
2822
|
-
obj[propKey] = value;
|
|
2823
|
-
return obj;
|
|
2824
|
-
}, {});
|
|
2825
|
-
}
|
|
2826
|
-
/**
|
|
2827
|
-
* @public
|
|
2828
|
-
*/
|
|
2829
|
-
|
|
2830
|
-
function rem(pixelValue) {
|
|
2831
|
-
if (pixelValue === 0) return 0;
|
|
2832
|
-
return `${pixelValue / 16}rem`;
|
|
2833
|
-
}
|
|
2834
|
-
/**
|
|
2835
|
-
* @internal
|
|
2836
|
-
*/
|
|
2837
|
-
|
|
2838
|
-
function responsive(media, values, callback) {
|
|
2839
|
-
const statements = values.map(callback);
|
|
2840
|
-
return statements.map((statement, mediaIndex) => {
|
|
2841
|
-
if (mediaIndex === 0) return statement;
|
|
2842
|
-
return {
|
|
2843
|
-
[`@media screen and (min-width: ${media[mediaIndex - 1]}px)`]: statement
|
|
2844
|
-
};
|
|
2845
|
-
});
|
|
2846
|
-
}
|
|
2847
|
-
/**
|
|
2848
|
-
* @internal
|
|
2849
|
-
*/
|
|
2850
|
-
|
|
2851
|
-
function getResponsiveProp(val, defaultVal) {
|
|
2852
|
-
if (val === undefined) return defaultVal || EMPTY_ARRAY;
|
|
2853
|
-
return Array.isArray(val) ? val : [val];
|
|
2854
|
-
}
|
|
2855
|
-
/**
|
|
2856
|
-
* @internal
|
|
2857
|
-
*/
|
|
2858
|
-
|
|
2859
|
-
function getResponsiveSpace(theme, props, spaceIndexes = EMPTY_ARRAY) {
|
|
2860
|
-
if (!Array.isArray(spaceIndexes)) {
|
|
2861
|
-
throw new Error('the property must be array of numbers');
|
|
2862
|
-
}
|
|
2863
|
-
|
|
2864
|
-
if (spaceIndexes.length === 0) {
|
|
2865
|
-
return null;
|
|
2866
|
-
}
|
|
2867
|
-
|
|
2868
|
-
return responsive(theme.sanity.media, spaceIndexes, spaceIndex => fillCSSObject(props, rem(theme.sanity.space[spaceIndex])));
|
|
2869
|
-
}
|
|
2870
|
-
|
|
2871
|
-
/**
|
|
2872
|
-
* A utility function getting responsive font styles.
|
|
2873
|
-
* @internal
|
|
2874
|
-
*/
|
|
2875
|
-
|
|
2876
|
-
function responsiveFont(fontKey, props) {
|
|
2877
|
-
const {
|
|
2878
|
-
$size,
|
|
2879
|
-
$weight,
|
|
2880
|
-
theme
|
|
2881
|
-
} = props;
|
|
2882
|
-
const {
|
|
2883
|
-
fonts,
|
|
2884
|
-
media
|
|
2885
|
-
} = theme.sanity;
|
|
2886
|
-
const {
|
|
2887
|
-
family,
|
|
2888
|
-
sizes,
|
|
2889
|
-
weights
|
|
2890
|
-
} = fonts[fontKey];
|
|
2891
|
-
const fontWeight = $weight && weights[$weight] || weights.regular; // @todo: make this configurable
|
|
2892
|
-
|
|
2893
|
-
const defaultSize = sizes[2];
|
|
2894
|
-
const base = {
|
|
2895
|
-
position: 'relative',
|
|
2896
|
-
fontFamily: family,
|
|
2897
|
-
fontWeight,
|
|
2898
|
-
padding: '1px 0',
|
|
2899
|
-
margin: 0,
|
|
2900
|
-
'&:before': {
|
|
2901
|
-
content: '""',
|
|
2902
|
-
display: 'block',
|
|
2903
|
-
height: 0
|
|
2904
|
-
},
|
|
2905
|
-
'&:after': {
|
|
2906
|
-
content: '""',
|
|
2907
|
-
display: 'block',
|
|
2908
|
-
height: 0
|
|
2909
|
-
},
|
|
2910
|
-
'& > code, & > span': {
|
|
2911
|
-
display: 'block'
|
|
2912
|
-
},
|
|
2913
|
-
'&:not([hidden])': {
|
|
2914
|
-
display: 'block'
|
|
2915
|
-
}
|
|
2916
|
-
};
|
|
2917
|
-
const resp = responsive(media, getResponsiveProp($size), sizeIndex => fontSize(sizes[sizeIndex] || defaultSize));
|
|
2918
|
-
return [base, ...resp];
|
|
2919
|
-
}
|
|
2920
|
-
function fontSize(size) {
|
|
2921
|
-
const {
|
|
2922
|
-
ascenderHeight,
|
|
2923
|
-
descenderHeight,
|
|
2924
|
-
fontSize,
|
|
2925
|
-
iconSize,
|
|
2926
|
-
letterSpacing,
|
|
2927
|
-
lineHeight
|
|
2928
|
-
} = size;
|
|
2929
|
-
const negHeight = ascenderHeight + descenderHeight;
|
|
2930
|
-
const capHeight = lineHeight - negHeight;
|
|
2931
|
-
const iconOffset = (capHeight - iconSize) / 2;
|
|
2932
|
-
const customIconSize = Math.floor(fontSize * 1.125 / 2) * 2 + 1;
|
|
2933
|
-
const customIconOffset = (capHeight - customIconSize) / 2;
|
|
2934
|
-
return {
|
|
2935
|
-
fontSize: rem(fontSize),
|
|
2936
|
-
lineHeight: `calc(${lineHeight} / ${fontSize})`,
|
|
2937
|
-
letterSpacing: rem(letterSpacing),
|
|
2938
|
-
transform: `translateY(${rem(descenderHeight)})`,
|
|
2939
|
-
'&:before': {
|
|
2940
|
-
marginTop: `calc(${rem(0 - negHeight)} - 1px)`
|
|
2941
|
-
},
|
|
2942
|
-
'&:after': {
|
|
2943
|
-
marginBottom: '-1px'
|
|
2944
|
-
},
|
|
2945
|
-
'& svg:not([data-sanity-icon])': {
|
|
2946
|
-
fontSize: `calc(${customIconSize} / 16 * 1rem)`,
|
|
2947
|
-
margin: rem(customIconOffset)
|
|
2948
|
-
},
|
|
2949
|
-
'& [data-sanity-icon]': {
|
|
2950
|
-
fontSize: `calc(${iconSize} / 16 * 1rem)`,
|
|
2951
|
-
margin: rem(iconOffset)
|
|
3006
|
+
});
|
|
2952
3007
|
}
|
|
3008
|
+
|
|
3009
|
+
return () => {
|
|
3010
|
+
for (const disposeFn of disposeFns) {
|
|
3011
|
+
disposeFn();
|
|
3012
|
+
}
|
|
3013
|
+
};
|
|
2953
3014
|
};
|
|
2954
|
-
}
|
|
2955
3015
|
|
|
3016
|
+
return {
|
|
3017
|
+
getCurrentIndex,
|
|
3018
|
+
subscribe
|
|
3019
|
+
};
|
|
3020
|
+
}
|
|
2956
3021
|
/**
|
|
2957
|
-
* Get responsive CSS for the `code` font style.
|
|
2958
3022
|
* @internal
|
|
2959
3023
|
*/
|
|
2960
3024
|
|
|
2961
|
-
|
|
2962
|
-
|
|
3025
|
+
|
|
3026
|
+
function _getMediaManager(media) {
|
|
3027
|
+
let manager = MEDIA_MANAGER_CACHE.get(media);
|
|
3028
|
+
|
|
3029
|
+
if (!manager) {
|
|
3030
|
+
manager = _createMediaManager(media);
|
|
3031
|
+
MEDIA_MANAGER_CACHE.set(media, manager);
|
|
3032
|
+
}
|
|
3033
|
+
|
|
3034
|
+
return manager;
|
|
2963
3035
|
}
|
|
2964
3036
|
|
|
2965
3037
|
/**
|
|
2966
|
-
*
|
|
2967
|
-
* @
|
|
3038
|
+
* This API might change. DO NOT USE IN PRODUCTION.
|
|
3039
|
+
* @beta
|
|
2968
3040
|
*/
|
|
2969
3041
|
|
|
2970
|
-
function
|
|
2971
|
-
|
|
3042
|
+
function useMediaIndex() {
|
|
3043
|
+
const theme = useTheme();
|
|
3044
|
+
const {
|
|
3045
|
+
media
|
|
3046
|
+
} = theme.sanity;
|
|
3047
|
+
const manager = useMemo(() => _getMediaManager(media), [media]);
|
|
3048
|
+
const [index, setIndex] = useState(manager.getCurrentIndex);
|
|
3049
|
+
useEffect(() => manager.subscribe(setIndex), [manager]);
|
|
3050
|
+
return index;
|
|
2972
3051
|
}
|
|
2973
3052
|
|
|
2974
3053
|
/**
|
|
2975
|
-
*
|
|
2976
|
-
* @internal
|
|
3054
|
+
* @public
|
|
2977
3055
|
*/
|
|
2978
3056
|
|
|
2979
|
-
function
|
|
2980
|
-
|
|
3057
|
+
function usePrefersDark() {
|
|
3058
|
+
const mq = useMemo(() => {
|
|
3059
|
+
if (typeof window === 'undefined') return undefined;
|
|
3060
|
+
return window.matchMedia('(prefers-color-scheme: dark)');
|
|
3061
|
+
}, []);
|
|
3062
|
+
const [dark, setDark] = useState((mq == null ? void 0 : mq.matches) || false);
|
|
3063
|
+
useEffect(() => {
|
|
3064
|
+
if (!mq) return undefined;
|
|
3065
|
+
setDark(mq.matches);
|
|
3066
|
+
|
|
3067
|
+
const handleChange = () => setDark(mq.matches);
|
|
3068
|
+
|
|
3069
|
+
mq.addEventListener('change', handleChange);
|
|
3070
|
+
return () => mq.removeEventListener('change', handleChange);
|
|
3071
|
+
}, [mq]);
|
|
3072
|
+
return dark;
|
|
2981
3073
|
}
|
|
2982
3074
|
|
|
2983
3075
|
/**
|
|
2984
|
-
*
|
|
2985
|
-
* @internal
|
|
3076
|
+
* @beta
|
|
2986
3077
|
*/
|
|
2987
3078
|
|
|
2988
|
-
|
|
2989
|
-
const {
|
|
2990
|
-
theme
|
|
2991
|
-
} = props;
|
|
2992
|
-
return responsive(theme.sanity.media, getResponsiveProp(props.$align), textAlign => {
|
|
2993
|
-
return {
|
|
2994
|
-
textAlign
|
|
2995
|
-
};
|
|
2996
|
-
});
|
|
2997
|
-
}
|
|
3079
|
+
const useIsomorphicEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
2998
3080
|
|
|
2999
3081
|
/**
|
|
3000
|
-
*
|
|
3001
|
-
* @internal
|
|
3082
|
+
* @beta
|
|
3002
3083
|
*/
|
|
3003
3084
|
|
|
3004
|
-
function
|
|
3005
|
-
|
|
3085
|
+
function useForwardedRef(ref) {
|
|
3086
|
+
const innerRef = useRef(null);
|
|
3087
|
+
useIsomorphicEffect(() => {
|
|
3088
|
+
if (!ref) return;
|
|
3089
|
+
|
|
3090
|
+
if (typeof ref === 'function') {
|
|
3091
|
+
ref(innerRef.current);
|
|
3092
|
+
} else {
|
|
3093
|
+
ref.current = innerRef.current;
|
|
3094
|
+
}
|
|
3095
|
+
});
|
|
3096
|
+
return innerRef;
|
|
3006
3097
|
}
|
|
3007
3098
|
|
|
3008
3099
|
/**
|
|
3009
|
-
* This API might change. DO NOT USE IN PRODUCTION.
|
|
3010
3100
|
* @beta
|
|
3011
3101
|
*/
|
|
3012
3102
|
|
|
3013
|
-
function
|
|
3014
|
-
|
|
3103
|
+
function useCustomValidity(ref, customValidity) {
|
|
3104
|
+
useEffect(() => {
|
|
3105
|
+
if (ref.current) {
|
|
3106
|
+
ref.current.setCustomValidity(customValidity || '');
|
|
3107
|
+
}
|
|
3108
|
+
}, [customValidity, ref]);
|
|
3015
3109
|
}
|
|
3016
3110
|
|
|
3017
3111
|
const BORDER_VALUE = '1px solid var(--card-border-color)';
|
|
@@ -3026,7 +3120,7 @@ function border(props) {
|
|
|
3026
3120
|
const {
|
|
3027
3121
|
media
|
|
3028
3122
|
} = theme.sanity;
|
|
3029
|
-
return
|
|
3123
|
+
return _responsive(media, props.$border, value => value ? {
|
|
3030
3124
|
'&&': {
|
|
3031
3125
|
border: BORDER_VALUE
|
|
3032
3126
|
}
|
|
@@ -3044,7 +3138,7 @@ function borderTop(props) {
|
|
|
3044
3138
|
const {
|
|
3045
3139
|
media
|
|
3046
3140
|
} = theme.sanity;
|
|
3047
|
-
return
|
|
3141
|
+
return _responsive(media, props.$borderTop, value => value ? {
|
|
3048
3142
|
'&&': {
|
|
3049
3143
|
borderTop: BORDER_VALUE
|
|
3050
3144
|
}
|
|
@@ -3062,7 +3156,7 @@ function borderRight(props) {
|
|
|
3062
3156
|
const {
|
|
3063
3157
|
media
|
|
3064
3158
|
} = theme.sanity;
|
|
3065
|
-
return
|
|
3159
|
+
return _responsive(media, props.$borderRight, value => value ? {
|
|
3066
3160
|
'&&': {
|
|
3067
3161
|
borderRight: BORDER_VALUE
|
|
3068
3162
|
}
|
|
@@ -3080,7 +3174,7 @@ function borderBottom(props) {
|
|
|
3080
3174
|
const {
|
|
3081
3175
|
media
|
|
3082
3176
|
} = theme.sanity;
|
|
3083
|
-
return
|
|
3177
|
+
return _responsive(media, props.$borderBottom, value => value ? {
|
|
3084
3178
|
'&&': {
|
|
3085
3179
|
borderBottom: BORDER_VALUE
|
|
3086
3180
|
}
|
|
@@ -3098,7 +3192,7 @@ function borderLeft(props) {
|
|
|
3098
3192
|
const {
|
|
3099
3193
|
media
|
|
3100
3194
|
} = theme.sanity;
|
|
3101
|
-
return
|
|
3195
|
+
return _responsive(media, props.$borderLeft, value => value ? {
|
|
3102
3196
|
'&&': {
|
|
3103
3197
|
borderLeft: BORDER_VALUE
|
|
3104
3198
|
}
|
|
@@ -3136,7 +3230,7 @@ function responsiveBoxDisplayStyle(props) {
|
|
|
3136
3230
|
const {
|
|
3137
3231
|
media
|
|
3138
3232
|
} = theme.sanity;
|
|
3139
|
-
return
|
|
3233
|
+
return _responsive(media, props.$display, display => ({
|
|
3140
3234
|
'&:not([hidden])': {
|
|
3141
3235
|
display
|
|
3142
3236
|
}
|
|
@@ -3150,7 +3244,7 @@ function responsiveBoxSizingStyle(props) {
|
|
|
3150
3244
|
const {
|
|
3151
3245
|
media
|
|
3152
3246
|
} = theme.sanity;
|
|
3153
|
-
return
|
|
3247
|
+
return _responsive(media, props.$sizing, sizing => ({
|
|
3154
3248
|
boxSizing: BOX_SIZING[sizing]
|
|
3155
3249
|
}));
|
|
3156
3250
|
}
|
|
@@ -3162,7 +3256,7 @@ function responsiveBoxHeightStyle(props) {
|
|
|
3162
3256
|
const {
|
|
3163
3257
|
media
|
|
3164
3258
|
} = theme.sanity;
|
|
3165
|
-
return
|
|
3259
|
+
return _responsive(media, props.$height, height => ({
|
|
3166
3260
|
height: BOX_HEIGHT[height]
|
|
3167
3261
|
}));
|
|
3168
3262
|
}
|
|
@@ -3174,7 +3268,7 @@ function responsiveBoxOverflowStyle(props) {
|
|
|
3174
3268
|
const {
|
|
3175
3269
|
media
|
|
3176
3270
|
} = theme.sanity;
|
|
3177
|
-
return
|
|
3271
|
+
return _responsive(media, props.$overflow, overflow => ({
|
|
3178
3272
|
overflow
|
|
3179
3273
|
}));
|
|
3180
3274
|
}
|
|
@@ -3194,7 +3288,7 @@ function responsiveFlexAlignStyle(props) {
|
|
|
3194
3288
|
const {
|
|
3195
3289
|
media
|
|
3196
3290
|
} = theme.sanity;
|
|
3197
|
-
return
|
|
3291
|
+
return _responsive(media, props.$align, align => {
|
|
3198
3292
|
return {
|
|
3199
3293
|
alignItems: align
|
|
3200
3294
|
};
|
|
@@ -3209,7 +3303,7 @@ function responsiveFlexGapStyle(props) {
|
|
|
3209
3303
|
media,
|
|
3210
3304
|
space
|
|
3211
3305
|
} = theme.sanity;
|
|
3212
|
-
return
|
|
3306
|
+
return _responsive(media, props.$gap, gap => ({
|
|
3213
3307
|
gap: gap ? rem(space[gap]) : undefined
|
|
3214
3308
|
}));
|
|
3215
3309
|
}
|
|
@@ -3221,7 +3315,7 @@ function responsiveFlexWrapStyle(props) {
|
|
|
3221
3315
|
const {
|
|
3222
3316
|
media
|
|
3223
3317
|
} = theme.sanity;
|
|
3224
|
-
return
|
|
3318
|
+
return _responsive(media, props.$wrap, wrap => {
|
|
3225
3319
|
return {
|
|
3226
3320
|
flexWrap: wrap
|
|
3227
3321
|
};
|
|
@@ -3234,7 +3328,7 @@ function responsiveFlexJustifyStyle(props) {
|
|
|
3234
3328
|
const {
|
|
3235
3329
|
media
|
|
3236
3330
|
} = theme.sanity;
|
|
3237
|
-
return
|
|
3331
|
+
return _responsive(media, props.$justify, justify => {
|
|
3238
3332
|
return {
|
|
3239
3333
|
justifyContent: justify
|
|
3240
3334
|
};
|
|
@@ -3247,7 +3341,7 @@ function responsiveFlexDirectionStyle(props) {
|
|
|
3247
3341
|
const {
|
|
3248
3342
|
media
|
|
3249
3343
|
} = theme.sanity;
|
|
3250
|
-
return
|
|
3344
|
+
return _responsive(media, props.$direction, direction => {
|
|
3251
3345
|
return {
|
|
3252
3346
|
flexDirection: direction
|
|
3253
3347
|
};
|
|
@@ -3268,11 +3362,10 @@ function responsiveFlexItemStyle(props) {
|
|
|
3268
3362
|
const {
|
|
3269
3363
|
media
|
|
3270
3364
|
} = theme.sanity;
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
});
|
|
3365
|
+
if (!props.$flex) return EMPTY_ARRAY;
|
|
3366
|
+
return _responsive(media, props.$flex, flex => ({
|
|
3367
|
+
flex
|
|
3368
|
+
}));
|
|
3276
3369
|
}
|
|
3277
3370
|
|
|
3278
3371
|
function focusRingBorderStyle(border) {
|
|
@@ -3321,7 +3414,7 @@ function responsiveGridAutoFlowStyle(props) {
|
|
|
3321
3414
|
const {
|
|
3322
3415
|
media
|
|
3323
3416
|
} = theme.sanity;
|
|
3324
|
-
return
|
|
3417
|
+
return _responsive(media, props.$autoFlow, autoFlow => ({
|
|
3325
3418
|
gridAutoFlow: autoFlow
|
|
3326
3419
|
}));
|
|
3327
3420
|
}
|
|
@@ -3333,7 +3426,7 @@ function responsiveGridAutoRowsStyle(props) {
|
|
|
3333
3426
|
const {
|
|
3334
3427
|
media
|
|
3335
3428
|
} = theme.sanity;
|
|
3336
|
-
return
|
|
3429
|
+
return _responsive(media, props.$autoRows, autoRows => ({
|
|
3337
3430
|
gridAutoRows: autoRows && GRID_AUTO_ROWS[autoRows]
|
|
3338
3431
|
}));
|
|
3339
3432
|
}
|
|
@@ -3345,7 +3438,7 @@ function responsiveGridAutoColsStyle(props) {
|
|
|
3345
3438
|
const {
|
|
3346
3439
|
media
|
|
3347
3440
|
} = theme.sanity;
|
|
3348
|
-
return
|
|
3441
|
+
return _responsive(media, props.$autoCols, autoCols => ({
|
|
3349
3442
|
gridAutoColumns: autoCols && GRID_AUTO_COLUMS[autoCols]
|
|
3350
3443
|
}));
|
|
3351
3444
|
}
|
|
@@ -3357,7 +3450,7 @@ function responsiveGridColumnsStyle(props) {
|
|
|
3357
3450
|
const {
|
|
3358
3451
|
media
|
|
3359
3452
|
} = theme.sanity;
|
|
3360
|
-
return
|
|
3453
|
+
return _responsive(media, props.$columns, columns => ({
|
|
3361
3454
|
gridTemplateColumns: columns && `repeat(${columns},minmax(0,1fr));`
|
|
3362
3455
|
}));
|
|
3363
3456
|
}
|
|
@@ -3369,7 +3462,7 @@ function responsiveGridRowsStyle(props) {
|
|
|
3369
3462
|
const {
|
|
3370
3463
|
media
|
|
3371
3464
|
} = theme.sanity;
|
|
3372
|
-
return
|
|
3465
|
+
return _responsive(media, props.$rows, rows => ({
|
|
3373
3466
|
gridTemplateRows: rows && `repeat(${rows},minmax(0,1fr));`
|
|
3374
3467
|
}));
|
|
3375
3468
|
}
|
|
@@ -3382,7 +3475,7 @@ function responsiveGridGapStyle(props) {
|
|
|
3382
3475
|
media,
|
|
3383
3476
|
space
|
|
3384
3477
|
} = theme.sanity;
|
|
3385
|
-
return
|
|
3478
|
+
return _responsive(media, props.$gap, gap => ({
|
|
3386
3479
|
gridGap: gap ? rem(space[gap]) : undefined
|
|
3387
3480
|
}));
|
|
3388
3481
|
}
|
|
@@ -3395,7 +3488,7 @@ function responsiveGridGapXStyle(props) {
|
|
|
3395
3488
|
media,
|
|
3396
3489
|
space
|
|
3397
3490
|
} = theme.sanity;
|
|
3398
|
-
return
|
|
3491
|
+
return _responsive(media, props.$gapX, gapX => ({
|
|
3399
3492
|
columnGap: gapX ? rem(space[gapX]) : undefined
|
|
3400
3493
|
}));
|
|
3401
3494
|
}
|
|
@@ -3408,7 +3501,7 @@ function responsiveGridGapYStyle(props) {
|
|
|
3408
3501
|
media,
|
|
3409
3502
|
space
|
|
3410
3503
|
} = theme.sanity;
|
|
3411
|
-
return
|
|
3504
|
+
return _responsive(media, props.$gapY, gapY => ({
|
|
3412
3505
|
rowGap: gapY ? rem(space[gapY]) : undefined
|
|
3413
3506
|
}));
|
|
3414
3507
|
}
|
|
@@ -3432,7 +3525,7 @@ function responsiveGridItemRowStyle(props) {
|
|
|
3432
3525
|
const {
|
|
3433
3526
|
media
|
|
3434
3527
|
} = theme.sanity;
|
|
3435
|
-
return
|
|
3528
|
+
return _responsive(media, props.$row, row => {
|
|
3436
3529
|
if (typeof row === 'number') {
|
|
3437
3530
|
return {
|
|
3438
3531
|
gridRow: `span ${row} / span ${row}`
|
|
@@ -3452,7 +3545,7 @@ function responsiveGridItemRowStartStyle(props) {
|
|
|
3452
3545
|
const {
|
|
3453
3546
|
media
|
|
3454
3547
|
} = theme.sanity;
|
|
3455
|
-
return
|
|
3548
|
+
return _responsive(media, props.$rowStart, rowStart => ({
|
|
3456
3549
|
gridRowStart: rowStart
|
|
3457
3550
|
}));
|
|
3458
3551
|
}
|
|
@@ -3464,7 +3557,7 @@ function responsiveGridItemRowEndStyle(props) {
|
|
|
3464
3557
|
const {
|
|
3465
3558
|
media
|
|
3466
3559
|
} = theme.sanity;
|
|
3467
|
-
return
|
|
3560
|
+
return _responsive(media, props.$rowEnd, rowEnd => ({
|
|
3468
3561
|
gridRowEnd: rowEnd
|
|
3469
3562
|
}));
|
|
3470
3563
|
}
|
|
@@ -3476,7 +3569,7 @@ function responsiveGridItemColumnStyle(props) {
|
|
|
3476
3569
|
const {
|
|
3477
3570
|
media
|
|
3478
3571
|
} = theme.sanity;
|
|
3479
|
-
return
|
|
3572
|
+
return _responsive(media, props.$column, column => {
|
|
3480
3573
|
if (typeof column === 'number') {
|
|
3481
3574
|
return {
|
|
3482
3575
|
gridColumn: `span ${column} / span ${column}`
|
|
@@ -3496,7 +3589,7 @@ function responsiveGridItemColumnStartStyle(props) {
|
|
|
3496
3589
|
const {
|
|
3497
3590
|
media
|
|
3498
3591
|
} = theme.sanity;
|
|
3499
|
-
return
|
|
3592
|
+
return _responsive(media, props.$columnStart, columnStart => ({
|
|
3500
3593
|
gridColumnStart: columnStart
|
|
3501
3594
|
}));
|
|
3502
3595
|
}
|
|
@@ -3508,15 +3601,18 @@ function responsiveGridItemColumnEndStyle(props) {
|
|
|
3508
3601
|
const {
|
|
3509
3602
|
media
|
|
3510
3603
|
} = theme.sanity;
|
|
3511
|
-
return
|
|
3604
|
+
return _responsive(media, props.$columnEnd, columnEnd => ({
|
|
3512
3605
|
gridColumnEnd: columnEnd
|
|
3513
3606
|
}));
|
|
3514
3607
|
}
|
|
3515
3608
|
|
|
3516
3609
|
function responsiveInputPaddingStyle(props) {
|
|
3517
3610
|
const {
|
|
3611
|
+
$fontSize,
|
|
3518
3612
|
$iconLeft,
|
|
3519
3613
|
$iconRight,
|
|
3614
|
+
$padding,
|
|
3615
|
+
$space,
|
|
3520
3616
|
theme
|
|
3521
3617
|
} = props;
|
|
3522
3618
|
const {
|
|
@@ -3524,29 +3620,26 @@ function responsiveInputPaddingStyle(props) {
|
|
|
3524
3620
|
media,
|
|
3525
3621
|
space: spaceScale
|
|
3526
3622
|
} = theme.sanity;
|
|
3527
|
-
const
|
|
3528
|
-
const space = getResponsiveProp(props.$space, [0]);
|
|
3529
|
-
const size = getResponsiveProp(props.$fontSize, [0]);
|
|
3530
|
-
const len = Math.max(padding.length, space.length, size.length);
|
|
3623
|
+
const len = Math.max($padding.length, $space.length, $fontSize.length);
|
|
3531
3624
|
const _padding = [];
|
|
3532
3625
|
const _space = [];
|
|
3533
|
-
const
|
|
3626
|
+
const _fontSize = [];
|
|
3534
3627
|
|
|
3535
3628
|
for (let i = 0; i < len; i += 1) {
|
|
3536
|
-
|
|
3537
|
-
|
|
3538
|
-
|
|
3629
|
+
_fontSize[i] = $fontSize[i] === undefined ? _fontSize[i - 1] : $fontSize[i];
|
|
3630
|
+
_padding[i] = $padding[i] === undefined ? _padding[i - 1] : $padding[i];
|
|
3631
|
+
_space[i] = $space[i] === undefined ? _space[i - 1] : $space[i];
|
|
3539
3632
|
}
|
|
3540
3633
|
|
|
3541
|
-
return
|
|
3542
|
-
const
|
|
3543
|
-
const emSize =
|
|
3634
|
+
return _responsive(media, _padding, (_, i) => {
|
|
3635
|
+
const size = fonts.text.sizes[_fontSize[i]] || fonts.text.sizes[2];
|
|
3636
|
+
const emSize = size.lineHeight - size.ascenderHeight - size.descenderHeight;
|
|
3544
3637
|
const p = spaceScale[_padding[i]];
|
|
3545
3638
|
const s = spaceScale[_space[i]];
|
|
3546
3639
|
const styles = {
|
|
3547
|
-
paddingTop: rem(p -
|
|
3640
|
+
paddingTop: rem(p - size.ascenderHeight),
|
|
3548
3641
|
paddingRight: rem(p),
|
|
3549
|
-
paddingBottom: rem(p -
|
|
3642
|
+
paddingBottom: rem(p - size.descenderHeight),
|
|
3550
3643
|
paddingLeft: rem(p)
|
|
3551
3644
|
};
|
|
3552
3645
|
if ($iconRight) styles.paddingRight = rem(p + emSize + s);
|
|
@@ -3577,14 +3670,13 @@ function textInputRootStyle() {
|
|
|
3577
3670
|
function textInputBaseStyle(props) {
|
|
3578
3671
|
const {
|
|
3579
3672
|
theme,
|
|
3673
|
+
$scheme,
|
|
3674
|
+
$tone,
|
|
3580
3675
|
$weight
|
|
3581
3676
|
} = props;
|
|
3582
3677
|
const font = theme.sanity.fonts.text;
|
|
3583
3678
|
const color = theme.sanity.color.input;
|
|
3584
3679
|
return css(_t2$n || (_t2$n = _$B`
|
|
3585
|
-
--input-fg-color: ${0};
|
|
3586
|
-
--input-placeholder-color: ${0};
|
|
3587
|
-
|
|
3588
3680
|
appearance: none;
|
|
3589
3681
|
background: none;
|
|
3590
3682
|
border: 0;
|
|
@@ -3598,7 +3690,6 @@ function textInputBaseStyle(props) {
|
|
|
3598
3690
|
position: relative;
|
|
3599
3691
|
z-index: 1;
|
|
3600
3692
|
display: block;
|
|
3601
|
-
color: var(--input-fg-color);
|
|
3602
3693
|
|
|
3603
3694
|
/* NOTE: This is a hack to disable Chrome’s autofill styles */
|
|
3604
3695
|
&:-webkit-autofill,
|
|
@@ -3610,39 +3701,46 @@ function textInputBaseStyle(props) {
|
|
|
3610
3701
|
transition-delay: 86400s /* 24h */;
|
|
3611
3702
|
}
|
|
3612
3703
|
|
|
3613
|
-
&::placeholder {
|
|
3614
|
-
color: var(--input-placeholder-color);
|
|
3615
|
-
}
|
|
3616
|
-
|
|
3617
3704
|
/* &:is(textarea) */
|
|
3618
3705
|
&[data-as='textarea'] {
|
|
3619
3706
|
resize: none;
|
|
3620
3707
|
}
|
|
3621
3708
|
|
|
3622
|
-
|
|
3623
|
-
&:not(:invalid):not(:disabled):not(:read-only) {
|
|
3624
|
-
--input-fg-color: ${0};
|
|
3625
|
-
--input-placeholder-color: ${0};
|
|
3626
|
-
}
|
|
3709
|
+
color: var(--input-fg-color);
|
|
3627
3710
|
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
--input-fg-color: ${0};
|
|
3631
|
-
--input-placeholder-color: ${0};
|
|
3711
|
+
&::placeholder {
|
|
3712
|
+
color: var(--input-placeholder-color);
|
|
3632
3713
|
}
|
|
3633
3714
|
|
|
3634
|
-
|
|
3635
|
-
&:invalid {
|
|
3715
|
+
&[data-scheme='${0}'][data-tone='${0}'] {
|
|
3636
3716
|
--input-fg-color: ${0};
|
|
3637
3717
|
--input-placeholder-color: ${0};
|
|
3638
|
-
}
|
|
3639
3718
|
|
|
3640
|
-
|
|
3641
|
-
|
|
3642
|
-
|
|
3643
|
-
|
|
3719
|
+
/* enabled */
|
|
3720
|
+
&:not(:invalid):not(:disabled):not(:read-only) {
|
|
3721
|
+
--input-fg-color: ${0};
|
|
3722
|
+
--input-placeholder-color: ${0};
|
|
3723
|
+
}
|
|
3724
|
+
|
|
3725
|
+
/* disabled */
|
|
3726
|
+
&:not(:invalid):disabled {
|
|
3727
|
+
--input-fg-color: ${0};
|
|
3728
|
+
--input-placeholder-color: ${0};
|
|
3729
|
+
}
|
|
3730
|
+
|
|
3731
|
+
/* invalid */
|
|
3732
|
+
&:invalid {
|
|
3733
|
+
--input-fg-color: ${0};
|
|
3734
|
+
--input-placeholder-color: ${0};
|
|
3735
|
+
}
|
|
3736
|
+
|
|
3737
|
+
/* readOnly */
|
|
3738
|
+
&:read-only {
|
|
3739
|
+
--input-fg-color: ${0};
|
|
3740
|
+
--input-placeholder-color: ${0};
|
|
3741
|
+
}
|
|
3644
3742
|
}
|
|
3645
|
-
`),
|
|
3743
|
+
`), font.family, $weight && font.weights[$weight] || font.weights.regular, $scheme, $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);
|
|
3646
3744
|
}
|
|
3647
3745
|
function textInputFontSizeStyle(props) {
|
|
3648
3746
|
const {
|
|
@@ -3652,7 +3750,7 @@ function textInputFontSizeStyle(props) {
|
|
|
3652
3750
|
fonts,
|
|
3653
3751
|
media
|
|
3654
3752
|
} = theme.sanity;
|
|
3655
|
-
return
|
|
3753
|
+
return _responsive(media, props.$fontSize, sizeIndex => {
|
|
3656
3754
|
const size = fonts.text.sizes[sizeIndex] || fonts.text.sizes[2];
|
|
3657
3755
|
return {
|
|
3658
3756
|
fontSize: rem(size.fontSize),
|
|
@@ -3665,6 +3763,8 @@ function textInputRepresentationStyle(props) {
|
|
|
3665
3763
|
$border,
|
|
3666
3764
|
$hasPrefix,
|
|
3667
3765
|
$hasSuffix,
|
|
3766
|
+
$scheme,
|
|
3767
|
+
$tone,
|
|
3668
3768
|
theme
|
|
3669
3769
|
} = props;
|
|
3670
3770
|
const {
|
|
@@ -3673,8 +3773,6 @@ function textInputRepresentationStyle(props) {
|
|
|
3673
3773
|
} = theme.sanity;
|
|
3674
3774
|
const color = theme.sanity.color.input;
|
|
3675
3775
|
return css(_t3$e || (_t3$e = _$B`
|
|
3676
|
-
--card-bg-color: ${0};
|
|
3677
|
-
--card-fg-color: ${0};
|
|
3678
3776
|
--input-box-shadow: none;
|
|
3679
3777
|
|
|
3680
3778
|
position: absolute;
|
|
@@ -3685,6 +3783,7 @@ function textInputRepresentationStyle(props) {
|
|
|
3685
3783
|
display: block;
|
|
3686
3784
|
pointer-events: none;
|
|
3687
3785
|
z-index: 0;
|
|
3786
|
+
|
|
3688
3787
|
background-color: var(--card-bg-color);
|
|
3689
3788
|
box-shadow: var(--input-box-shadow);
|
|
3690
3789
|
|
|
@@ -3693,48 +3792,53 @@ function textInputRepresentationStyle(props) {
|
|
|
3693
3792
|
border-top-right-radius: ${0};
|
|
3694
3793
|
border-bottom-right-radius: ${0};
|
|
3695
3794
|
|
|
3696
|
-
|
|
3697
|
-
*:not(:disabled) + && {
|
|
3698
|
-
--input-box-shadow: ${0};
|
|
3699
|
-
}
|
|
3700
|
-
|
|
3701
|
-
/* invalid */
|
|
3702
|
-
*:not(:disabled):invalid + && {
|
|
3795
|
+
&[data-scheme='${0}'][data-tone='${0}'] {
|
|
3703
3796
|
--card-bg-color: ${0};
|
|
3704
3797
|
--card-fg-color: ${0};
|
|
3705
|
-
--input-box-shadow: ${0};
|
|
3706
|
-
}
|
|
3707
|
-
|
|
3708
|
-
/* focused */
|
|
3709
|
-
*:not(:disabled):focus + && {
|
|
3710
|
-
--input-box-shadow: ${0};
|
|
3711
|
-
}
|
|
3712
3798
|
|
|
3713
|
-
|
|
3714
|
-
|
|
3715
|
-
|
|
3716
|
-
|
|
3717
|
-
--input-box-shadow: ${0};
|
|
3718
|
-
}
|
|
3799
|
+
/* enabled */
|
|
3800
|
+
*:not(:disabled) + & {
|
|
3801
|
+
--input-box-shadow: ${0};
|
|
3802
|
+
}
|
|
3719
3803
|
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
*:not(:disabled):not(:read-only):not(:invalid):hover + && {
|
|
3804
|
+
/* invalid */
|
|
3805
|
+
*:not(:disabled):invalid + & {
|
|
3723
3806
|
--card-bg-color: ${0};
|
|
3724
3807
|
--card-fg-color: ${0};
|
|
3808
|
+
--input-box-shadow: ${0};
|
|
3725
3809
|
}
|
|
3726
3810
|
|
|
3727
|
-
|
|
3811
|
+
/* focused */
|
|
3812
|
+
*:not(:disabled):focus + & {
|
|
3728
3813
|
--input-box-shadow: ${0};
|
|
3729
3814
|
}
|
|
3730
|
-
}
|
|
3731
3815
|
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3816
|
+
/* disabled */
|
|
3817
|
+
*:disabled + & {
|
|
3818
|
+
--card-bg-color: ${0} !important;
|
|
3819
|
+
--card-fg-color: ${0} !important;
|
|
3820
|
+
--input-box-shadow: ${0};
|
|
3821
|
+
}
|
|
3822
|
+
|
|
3823
|
+
/* readOnly */
|
|
3824
|
+
*:read-only + & {
|
|
3825
|
+
--card-bg-color: ${0} !important;
|
|
3826
|
+
--card-fg-color: ${0} !important;
|
|
3827
|
+
}
|
|
3828
|
+
|
|
3829
|
+
/* hovered */
|
|
3830
|
+
@media (hover: hover) {
|
|
3831
|
+
*:not(:disabled):not(:read-only):not(:invalid):hover + & {
|
|
3832
|
+
--card-bg-color: ${0};
|
|
3833
|
+
--card-fg-color: ${0};
|
|
3834
|
+
}
|
|
3835
|
+
|
|
3836
|
+
*:not(:disabled):not(:read-only):not(:invalid):not(:focus):hover + & {
|
|
3837
|
+
--input-box-shadow: ${0};
|
|
3838
|
+
}
|
|
3839
|
+
}
|
|
3736
3840
|
}
|
|
3737
|
-
`),
|
|
3841
|
+
`), $hasPrefix ? 0 : undefined, $hasPrefix ? 0 : undefined, $hasSuffix ? 0 : undefined, $hasSuffix ? 0 : undefined, $scheme, $tone, color.default.enabled.bg, color.default.enabled.fg, $border ? focusRingBorderStyle({
|
|
3738
3842
|
color: color.default.enabled.border,
|
|
3739
3843
|
width: input.border.width
|
|
3740
3844
|
}) : undefined, color.invalid.enabled.bg, color.invalid.enabled.fg, $border ? focusRingBorderStyle({
|
|
@@ -3749,24 +3853,24 @@ function textInputRepresentationStyle(props) {
|
|
|
3749
3853
|
}), color.default.disabled.bg, color.default.disabled.fg, $border ? focusRingBorderStyle({
|
|
3750
3854
|
color: color.default.disabled.border,
|
|
3751
3855
|
width: input.border.width
|
|
3752
|
-
}) : 'none', color.default.hovered.bg, color.default.hovered.fg, $border ? focusRingBorderStyle({
|
|
3856
|
+
}) : 'none', color.default.readOnly.bg, color.default.readOnly.fg, color.default.hovered.bg, color.default.hovered.fg, $border ? focusRingBorderStyle({
|
|
3753
3857
|
color: color.default.hovered.border,
|
|
3754
3858
|
width: input.border.width
|
|
3755
|
-
}) : 'none'
|
|
3859
|
+
}) : 'none');
|
|
3756
3860
|
}
|
|
3757
3861
|
|
|
3758
3862
|
function responsiveMarginStyle(props) {
|
|
3759
3863
|
const {
|
|
3760
3864
|
theme
|
|
3761
3865
|
} = props;
|
|
3762
|
-
return [
|
|
3866
|
+
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);
|
|
3763
3867
|
}
|
|
3764
3868
|
|
|
3765
3869
|
function responsivePaddingStyle(props) {
|
|
3766
3870
|
const {
|
|
3767
3871
|
theme
|
|
3768
3872
|
} = props;
|
|
3769
|
-
return [
|
|
3873
|
+
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);
|
|
3770
3874
|
}
|
|
3771
3875
|
|
|
3772
3876
|
function responsiveRadiusStyle(props) {
|
|
@@ -3777,7 +3881,7 @@ function responsiveRadiusStyle(props) {
|
|
|
3777
3881
|
media,
|
|
3778
3882
|
radius
|
|
3779
3883
|
} = theme.sanity;
|
|
3780
|
-
return
|
|
3884
|
+
return _responsive(media, props.$radius, radiusIndex => ({
|
|
3781
3885
|
borderRadius: rem(radius[radiusIndex])
|
|
3782
3886
|
}));
|
|
3783
3887
|
}
|
|
@@ -3805,7 +3909,7 @@ function responsiveShadowStyle(props) {
|
|
|
3805
3909
|
media,
|
|
3806
3910
|
shadows
|
|
3807
3911
|
} = theme.sanity;
|
|
3808
|
-
return
|
|
3912
|
+
return _responsive(media, props.$shadow, shadow => shadowStyle(shadows[shadow]));
|
|
3809
3913
|
}
|
|
3810
3914
|
|
|
3811
3915
|
let _$A = t => t,
|
|
@@ -3907,10 +4011,10 @@ const Text = /*#__PURE__*/forwardRef(function Text(props, ref) {
|
|
|
3907
4011
|
"data-ui": "Text"
|
|
3908
4012
|
}, restProps, {
|
|
3909
4013
|
"$accent": accent,
|
|
3910
|
-
"$align": align,
|
|
4014
|
+
"$align": useArrayProp(align),
|
|
3911
4015
|
"$muted": muted,
|
|
3912
4016
|
ref: ref,
|
|
3913
|
-
"$size": size,
|
|
4017
|
+
"$size": useArrayProp(size),
|
|
3914
4018
|
"$weight": weight
|
|
3915
4019
|
}), /*#__PURE__*/React.createElement("span", null, children));
|
|
3916
4020
|
});
|
|
@@ -4013,7 +4117,7 @@ function responsiveAvatarSizeStyle(props) {
|
|
|
4013
4117
|
avatar,
|
|
4014
4118
|
media
|
|
4015
4119
|
} = theme.sanity;
|
|
4016
|
-
return
|
|
4120
|
+
return _responsive(media, props.$size, size => {
|
|
4017
4121
|
const avatarSize = avatar.sizes[size] || avatar.sizes[0];
|
|
4018
4122
|
return {
|
|
4019
4123
|
width: rem(avatarSize.size),
|
|
@@ -4087,12 +4191,12 @@ const Avatar = /*#__PURE__*/forwardRef(function Avatar(props, ref) {
|
|
|
4087
4191
|
arrowPosition: arrowPositionProp,
|
|
4088
4192
|
animateArrowFrom,
|
|
4089
4193
|
status = 'online',
|
|
4090
|
-
size: sizeProp
|
|
4194
|
+
size: sizeProp = 0
|
|
4091
4195
|
} = props,
|
|
4092
4196
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$F);
|
|
4093
4197
|
|
|
4094
4198
|
const as = ReactIs.isValidElementType(asProp) ? asProp : 'div';
|
|
4095
|
-
const size =
|
|
4199
|
+
const size = useArrayProp(sizeProp);
|
|
4096
4200
|
const theme = useTheme();
|
|
4097
4201
|
const color = theme.sanity.color.spot[colorKey] || theme.sanity.color.spot.gray; // @todo: remove this
|
|
4098
4202
|
|
|
@@ -4121,6 +4225,7 @@ const Avatar = /*#__PURE__*/forwardRef(function Avatar(props, ref) {
|
|
|
4121
4225
|
onImageLoadError(new Error('Avatar: the image failed to load'));
|
|
4122
4226
|
}
|
|
4123
4227
|
}, [onImageLoadError]);
|
|
4228
|
+
const initialsSize = useMemo(() => size.map(s => s === 0 ? 0 : s + 1), [size]);
|
|
4124
4229
|
return /*#__PURE__*/React.createElement(Root$D, _extends({
|
|
4125
4230
|
as: as,
|
|
4126
4231
|
"data-as": typeof as === 'string' ? as : undefined,
|
|
@@ -4174,14 +4279,14 @@ const Avatar = /*#__PURE__*/forwardRef(function Avatar(props, ref) {
|
|
|
4174
4279
|
vectorEffect: "non-scaling-stroke"
|
|
4175
4280
|
})), (imageFailed || !src) && initials && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Initials, null, /*#__PURE__*/React.createElement(Text, {
|
|
4176
4281
|
as: "span",
|
|
4177
|
-
size:
|
|
4282
|
+
size: initialsSize
|
|
4178
4283
|
}, /*#__PURE__*/React.createElement("strong", null, initials)))));
|
|
4179
4284
|
});
|
|
4180
4285
|
|
|
4181
4286
|
let _$y = t => t,
|
|
4182
4287
|
_t$A;
|
|
4183
4288
|
|
|
4184
|
-
function
|
|
4289
|
+
function _responsiveAvatarCounterSizeStyle(props) {
|
|
4185
4290
|
const {
|
|
4186
4291
|
theme
|
|
4187
4292
|
} = props;
|
|
@@ -4189,7 +4294,7 @@ function responsiveAvatarCounterSizeStyle(props) {
|
|
|
4189
4294
|
avatar,
|
|
4190
4295
|
media
|
|
4191
4296
|
} = theme.sanity;
|
|
4192
|
-
return
|
|
4297
|
+
return _responsive(media, props.$size, size => {
|
|
4193
4298
|
const avatarSize = avatar.sizes[size];
|
|
4194
4299
|
if (!avatarSize) return EMPTY_RECORD;
|
|
4195
4300
|
return {
|
|
@@ -4200,7 +4305,7 @@ function responsiveAvatarCounterSizeStyle(props) {
|
|
|
4200
4305
|
});
|
|
4201
4306
|
}
|
|
4202
4307
|
|
|
4203
|
-
function
|
|
4308
|
+
function _avatarCounterBaseStyle(props) {
|
|
4204
4309
|
const {
|
|
4205
4310
|
theme
|
|
4206
4311
|
} = props;
|
|
@@ -4221,7 +4326,7 @@ function avatarCounterBaseStyle(props) {
|
|
|
4221
4326
|
`), rem(theme.sanity.space[2]));
|
|
4222
4327
|
}
|
|
4223
4328
|
|
|
4224
|
-
const Root$C = styled.div(
|
|
4329
|
+
const Root$C = styled.div(_responsiveAvatarCounterSizeStyle, _avatarCounterBaseStyle);
|
|
4225
4330
|
/**
|
|
4226
4331
|
* @public
|
|
4227
4332
|
*/
|
|
@@ -4231,13 +4336,15 @@ const AvatarCounter = /*#__PURE__*/forwardRef(function AvatarCounter(props, ref)
|
|
|
4231
4336
|
count,
|
|
4232
4337
|
size: sizeProp = 0
|
|
4233
4338
|
} = props;
|
|
4234
|
-
const size =
|
|
4339
|
+
const size = useArrayProp(sizeProp);
|
|
4340
|
+
const counterSize = useMemo(() => size.map(s => s === 0 ? 0 : s + 1), [size]);
|
|
4235
4341
|
return /*#__PURE__*/React.createElement(Root$C, {
|
|
4236
4342
|
"$size": size,
|
|
4343
|
+
"data-ui": "AvatarCounter",
|
|
4237
4344
|
ref: ref
|
|
4238
4345
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
4239
4346
|
as: "span",
|
|
4240
|
-
size:
|
|
4347
|
+
size: counterSize
|
|
4241
4348
|
}, /*#__PURE__*/React.createElement("strong", null, count)));
|
|
4242
4349
|
});
|
|
4243
4350
|
|
|
@@ -4246,7 +4353,7 @@ function childrenToElementArray(children) {
|
|
|
4246
4353
|
return childrenArray.filter(node => isElement(node) || isFragment(node) || typeof node === 'string');
|
|
4247
4354
|
}
|
|
4248
4355
|
|
|
4249
|
-
const _excluded$E = ["children", "maxLength", "size"
|
|
4356
|
+
const _excluded$E = ["children", "maxLength", "size"];
|
|
4250
4357
|
|
|
4251
4358
|
let _$x = t => t,
|
|
4252
4359
|
_t$z;
|
|
@@ -4274,7 +4381,7 @@ function responsiveAvatarStackSizeStyle(props) {
|
|
|
4274
4381
|
avatar,
|
|
4275
4382
|
media
|
|
4276
4383
|
} = theme.sanity;
|
|
4277
|
-
return
|
|
4384
|
+
return _responsive(media, props.$size, size => {
|
|
4278
4385
|
const avatarSize = avatar.sizes[size];
|
|
4279
4386
|
if (!avatarSize) return EMPTY_RECORD;
|
|
4280
4387
|
return {
|
|
@@ -4294,12 +4401,13 @@ const AvatarStack = /*#__PURE__*/forwardRef(function AvatarStack(props, ref) {
|
|
|
4294
4401
|
const {
|
|
4295
4402
|
children: childrenProp,
|
|
4296
4403
|
maxLength: maxLengthProp = 4,
|
|
4297
|
-
size = 0
|
|
4404
|
+
size: sizeProp = 0
|
|
4298
4405
|
} = props,
|
|
4299
4406
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$E);
|
|
4300
4407
|
|
|
4301
|
-
const maxLength = Math.max(maxLengthProp, 0);
|
|
4302
4408
|
const children = childrenToElementArray(childrenProp).filter(child => typeof child !== 'string');
|
|
4409
|
+
const maxLength = Math.max(maxLengthProp, 0);
|
|
4410
|
+
const size = useArrayProp(sizeProp);
|
|
4303
4411
|
const len = children.length;
|
|
4304
4412
|
const visibleCount = maxLength - 1;
|
|
4305
4413
|
const extraCount = len - visibleCount;
|
|
@@ -4308,7 +4416,7 @@ const AvatarStack = /*#__PURE__*/forwardRef(function AvatarStack(props, ref) {
|
|
|
4308
4416
|
"data-ui": "AvatarStack"
|
|
4309
4417
|
}, restProps, {
|
|
4310
4418
|
ref: ref,
|
|
4311
|
-
size: size
|
|
4419
|
+
"$size": size
|
|
4312
4420
|
}), len === 0 && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(AvatarCounter, {
|
|
4313
4421
|
count: len
|
|
4314
4422
|
})), len !== 0 && extraCount > 1 && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(AvatarCounter, {
|
|
@@ -4362,31 +4470,31 @@ const Box = /*#__PURE__*/forwardRef(function Box(props, ref) {
|
|
|
4362
4470
|
"data-as": typeof asProp === 'string' ? asProp : undefined,
|
|
4363
4471
|
"data-ui": "Box"
|
|
4364
4472
|
}, restProps, {
|
|
4365
|
-
"$column": column,
|
|
4366
|
-
"$columnStart": columnStart,
|
|
4367
|
-
"$columnEnd": columnEnd,
|
|
4368
|
-
"$display": display,
|
|
4369
|
-
"$flex": flex,
|
|
4370
|
-
"$height": height,
|
|
4371
|
-
"$margin": margin,
|
|
4372
|
-
"$marginX": marginX,
|
|
4373
|
-
"$marginY": marginY,
|
|
4374
|
-
"$marginTop": marginTop,
|
|
4375
|
-
"$marginRight": marginRight,
|
|
4376
|
-
"$marginBottom": marginBottom,
|
|
4377
|
-
"$marginLeft": marginLeft,
|
|
4378
|
-
"$overflow": overflow,
|
|
4379
|
-
"$padding": padding,
|
|
4380
|
-
"$paddingX": paddingX,
|
|
4381
|
-
"$paddingY": paddingY,
|
|
4382
|
-
"$paddingTop": paddingTop,
|
|
4383
|
-
"$paddingRight": paddingRight,
|
|
4384
|
-
"$paddingBottom": paddingBottom,
|
|
4385
|
-
"$paddingLeft": paddingLeft,
|
|
4386
|
-
"$row": row,
|
|
4387
|
-
"$rowStart": rowStart,
|
|
4388
|
-
"$rowEnd": rowEnd,
|
|
4389
|
-
"$sizing": sizing,
|
|
4473
|
+
"$column": useArrayProp(column),
|
|
4474
|
+
"$columnStart": useArrayProp(columnStart),
|
|
4475
|
+
"$columnEnd": useArrayProp(columnEnd),
|
|
4476
|
+
"$display": useArrayProp(display),
|
|
4477
|
+
"$flex": useArrayProp(flex),
|
|
4478
|
+
"$height": useArrayProp(height),
|
|
4479
|
+
"$margin": useArrayProp(margin),
|
|
4480
|
+
"$marginX": useArrayProp(marginX),
|
|
4481
|
+
"$marginY": useArrayProp(marginY),
|
|
4482
|
+
"$marginTop": useArrayProp(marginTop),
|
|
4483
|
+
"$marginRight": useArrayProp(marginRight),
|
|
4484
|
+
"$marginBottom": useArrayProp(marginBottom),
|
|
4485
|
+
"$marginLeft": useArrayProp(marginLeft),
|
|
4486
|
+
"$overflow": useArrayProp(overflow),
|
|
4487
|
+
"$padding": useArrayProp(padding),
|
|
4488
|
+
"$paddingX": useArrayProp(paddingX),
|
|
4489
|
+
"$paddingY": useArrayProp(paddingY),
|
|
4490
|
+
"$paddingTop": useArrayProp(paddingTop),
|
|
4491
|
+
"$paddingRight": useArrayProp(paddingRight),
|
|
4492
|
+
"$paddingBottom": useArrayProp(paddingBottom),
|
|
4493
|
+
"$paddingLeft": useArrayProp(paddingLeft),
|
|
4494
|
+
"$row": useArrayProp(row),
|
|
4495
|
+
"$rowStart": useArrayProp(rowStart),
|
|
4496
|
+
"$rowEnd": useArrayProp(rowEnd),
|
|
4497
|
+
"$sizing": useArrayProp(sizing),
|
|
4390
4498
|
as: asProp,
|
|
4391
4499
|
ref: ref
|
|
4392
4500
|
}), props.children);
|
|
@@ -4471,9 +4579,9 @@ const Label = /*#__PURE__*/forwardRef(function Label(props, ref) {
|
|
|
4471
4579
|
"data-ui": "Label"
|
|
4472
4580
|
}, restProps, {
|
|
4473
4581
|
"$accent": accent,
|
|
4474
|
-
"$align": align,
|
|
4582
|
+
"$align": useArrayProp(align),
|
|
4475
4583
|
"$muted": muted,
|
|
4476
|
-
"$size": size,
|
|
4584
|
+
"$size": useArrayProp(size),
|
|
4477
4585
|
"$weight": weight,
|
|
4478
4586
|
ref: ref
|
|
4479
4587
|
}), children);
|
|
@@ -4520,8 +4628,8 @@ const Badge = /*#__PURE__*/forwardRef(function Badge(props, ref) {
|
|
|
4520
4628
|
}, restProps, {
|
|
4521
4629
|
"$mode": mode,
|
|
4522
4630
|
"$tone": tone,
|
|
4523
|
-
"$radius": radius,
|
|
4524
|
-
padding: padding,
|
|
4631
|
+
"$radius": useArrayProp(radius),
|
|
4632
|
+
padding: useArrayProp(padding),
|
|
4525
4633
|
ref: ref
|
|
4526
4634
|
}), /*#__PURE__*/React.createElement(Label, {
|
|
4527
4635
|
size: fontSize
|
|
@@ -4548,11 +4656,11 @@ const Flex = /*#__PURE__*/forwardRef(function Flex(props, ref) {
|
|
|
4548
4656
|
return /*#__PURE__*/React.createElement(Root$x, _extends({
|
|
4549
4657
|
"data-ui": "Flex"
|
|
4550
4658
|
}, restProps, {
|
|
4551
|
-
"$align": align,
|
|
4552
|
-
"$direction": direction,
|
|
4553
|
-
"$gap": gap,
|
|
4554
|
-
"$justify": justify,
|
|
4555
|
-
"$wrap": wrap,
|
|
4659
|
+
"$align": useArrayProp(align),
|
|
4660
|
+
"$direction": useArrayProp(direction),
|
|
4661
|
+
"$gap": useArrayProp(gap),
|
|
4662
|
+
"$justify": useArrayProp(justify),
|
|
4663
|
+
"$wrap": useArrayProp(wrap),
|
|
4556
4664
|
forwardedAs: as,
|
|
4557
4665
|
ref: ref
|
|
4558
4666
|
}));
|
|
@@ -4739,19 +4847,19 @@ const Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
|
|
|
4739
4847
|
fontSize,
|
|
4740
4848
|
icon,
|
|
4741
4849
|
iconRight,
|
|
4742
|
-
justify = 'center',
|
|
4850
|
+
justify: justifyProp = 'center',
|
|
4743
4851
|
loading,
|
|
4744
4852
|
mode = 'default',
|
|
4745
|
-
padding = 3,
|
|
4746
|
-
paddingX,
|
|
4747
|
-
paddingY,
|
|
4748
|
-
paddingTop,
|
|
4749
|
-
paddingBottom,
|
|
4750
|
-
paddingLeft,
|
|
4751
|
-
paddingRight,
|
|
4752
|
-
radius = 2,
|
|
4853
|
+
padding: paddingProp = 3,
|
|
4854
|
+
paddingX: paddingXProp,
|
|
4855
|
+
paddingY: paddingYProp,
|
|
4856
|
+
paddingTop: paddingTopProp,
|
|
4857
|
+
paddingBottom: paddingBottomProp,
|
|
4858
|
+
paddingLeft: paddingLeftProp,
|
|
4859
|
+
paddingRight: paddingRightProp,
|
|
4860
|
+
radius: radiusProp = 2,
|
|
4753
4861
|
selected,
|
|
4754
|
-
space = 3,
|
|
4862
|
+
space: spaceProp = 3,
|
|
4755
4863
|
text,
|
|
4756
4864
|
textAlign,
|
|
4757
4865
|
tone = 'default',
|
|
@@ -4759,6 +4867,16 @@ const Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
|
|
|
4759
4867
|
} = props,
|
|
4760
4868
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$z);
|
|
4761
4869
|
|
|
4870
|
+
const justify = useArrayProp(justifyProp);
|
|
4871
|
+
const padding = useArrayProp(paddingProp);
|
|
4872
|
+
const paddingX = useArrayProp(paddingXProp);
|
|
4873
|
+
const paddingY = useArrayProp(paddingYProp);
|
|
4874
|
+
const paddingTop = useArrayProp(paddingTopProp);
|
|
4875
|
+
const paddingBottom = useArrayProp(paddingBottomProp);
|
|
4876
|
+
const paddingLeft = useArrayProp(paddingLeftProp);
|
|
4877
|
+
const paddingRight = useArrayProp(paddingRightProp);
|
|
4878
|
+
const radius = useArrayProp(radiusProp);
|
|
4879
|
+
const space = useArrayProp(spaceProp);
|
|
4762
4880
|
const theme = useTheme();
|
|
4763
4881
|
const boxProps = useMemo(() => ({
|
|
4764
4882
|
// flex: 1,
|
|
@@ -5002,15 +5120,15 @@ const Card = /*#__PURE__*/forwardRef(function Card(props, ref) {
|
|
|
5002
5120
|
"data-ui": "Card",
|
|
5003
5121
|
"data-tone": tone
|
|
5004
5122
|
}, restProps, {
|
|
5005
|
-
"$border": border,
|
|
5006
|
-
"$borderTop": borderTop,
|
|
5007
|
-
"$borderRight": borderRight,
|
|
5008
|
-
"$borderBottom": borderBottom,
|
|
5009
|
-
"$borderLeft": borderLeft,
|
|
5123
|
+
"$border": useArrayProp(border),
|
|
5124
|
+
"$borderTop": useArrayProp(borderTop),
|
|
5125
|
+
"$borderRight": useArrayProp(borderRight),
|
|
5126
|
+
"$borderBottom": useArrayProp(borderBottom),
|
|
5127
|
+
"$borderLeft": useArrayProp(borderLeft),
|
|
5010
5128
|
"$checkered": checkered,
|
|
5011
5129
|
"$focusRing": focusRing,
|
|
5012
|
-
"$radius": radius,
|
|
5013
|
-
"$shadow": shadow,
|
|
5130
|
+
"$radius": useArrayProp(radius),
|
|
5131
|
+
"$shadow": useArrayProp(shadow),
|
|
5014
5132
|
"$tone": tone,
|
|
5015
5133
|
"data-checkered": checkered ? '' : undefined,
|
|
5016
5134
|
"data-pressed": pressed ? '' : undefined,
|
|
@@ -5330,7 +5448,7 @@ const Code = /*#__PURE__*/forwardRef(function Code(props, ref) {
|
|
|
5330
5448
|
return /*#__PURE__*/React.createElement(Root$s, _extends({
|
|
5331
5449
|
"data-ui": "Code"
|
|
5332
5450
|
}, restProps, {
|
|
5333
|
-
"$size": size,
|
|
5451
|
+
"$size": useArrayProp(size),
|
|
5334
5452
|
"$weight": weight,
|
|
5335
5453
|
ref: ref
|
|
5336
5454
|
}), !(language && registered) && /*#__PURE__*/React.createElement("code", null, children), language && registered && /*#__PURE__*/React.createElement(Refractor, {
|
|
@@ -5355,7 +5473,7 @@ function responsiveContainerWidthStyle(props) {
|
|
|
5355
5473
|
container,
|
|
5356
5474
|
media
|
|
5357
5475
|
} = theme.sanity;
|
|
5358
|
-
return
|
|
5476
|
+
return _responsive(media, props.$width, val => ({
|
|
5359
5477
|
maxWidth: val === 'auto' ? 'none' : rem(container[val])
|
|
5360
5478
|
}));
|
|
5361
5479
|
}
|
|
@@ -5376,7 +5494,7 @@ const Container = /*#__PURE__*/forwardRef(function Container(props, ref) {
|
|
|
5376
5494
|
return /*#__PURE__*/React.createElement(Root$r, _extends({
|
|
5377
5495
|
"data-ui": "Container"
|
|
5378
5496
|
}, restProps, {
|
|
5379
|
-
"$width": width,
|
|
5497
|
+
"$width": useArrayProp(width),
|
|
5380
5498
|
forwardedAs: as,
|
|
5381
5499
|
ref: ref
|
|
5382
5500
|
}));
|
|
@@ -5407,14 +5525,14 @@ const Grid = /*#__PURE__*/forwardRef(function Grid(props, ref) {
|
|
|
5407
5525
|
"data-as": typeof as === 'string' ? as : undefined,
|
|
5408
5526
|
"data-ui": "Grid"
|
|
5409
5527
|
}, restProps, {
|
|
5410
|
-
"$autoRows": autoRows,
|
|
5411
|
-
"$autoCols": autoCols,
|
|
5412
|
-
"$autoFlow": autoFlow,
|
|
5413
|
-
"$columns": columns,
|
|
5414
|
-
"$gap": gap,
|
|
5415
|
-
"$gapX": gapX,
|
|
5416
|
-
"$gapY": gapY,
|
|
5417
|
-
"$rows": rows,
|
|
5528
|
+
"$autoRows": useArrayProp(autoRows),
|
|
5529
|
+
"$autoCols": useArrayProp(autoCols),
|
|
5530
|
+
"$autoFlow": useArrayProp(autoFlow),
|
|
5531
|
+
"$columns": useArrayProp(columns),
|
|
5532
|
+
"$gap": useArrayProp(gap),
|
|
5533
|
+
"$gapX": useArrayProp(gapX),
|
|
5534
|
+
"$gapY": useArrayProp(gapY),
|
|
5535
|
+
"$rows": useArrayProp(rows),
|
|
5418
5536
|
forwardedAs: as,
|
|
5419
5537
|
ref: ref
|
|
5420
5538
|
}), children);
|
|
@@ -5508,9 +5626,9 @@ const Heading = /*#__PURE__*/forwardRef(function Heading(props, ref) {
|
|
|
5508
5626
|
"data-ui": "Heading"
|
|
5509
5627
|
}, restProps, {
|
|
5510
5628
|
"$accent": accent,
|
|
5511
|
-
"$align": align,
|
|
5629
|
+
"$align": useArrayProp(align),
|
|
5512
5630
|
"$muted": muted,
|
|
5513
|
-
"$size": size,
|
|
5631
|
+
"$size": useArrayProp(size),
|
|
5514
5632
|
"$weight": weight,
|
|
5515
5633
|
ref: ref
|
|
5516
5634
|
}), /*#__PURE__*/React.createElement("span", null, children));
|
|
@@ -5532,7 +5650,7 @@ function inlineSpaceStyle(props) {
|
|
|
5532
5650
|
const {
|
|
5533
5651
|
theme
|
|
5534
5652
|
} = props;
|
|
5535
|
-
return
|
|
5653
|
+
return _responsive(theme.sanity.media, props.$space, spaceIndex => {
|
|
5536
5654
|
const space = rem(theme.sanity.space[spaceIndex]);
|
|
5537
5655
|
return {
|
|
5538
5656
|
margin: `-${space} 0 0 -${space}`,
|
|
@@ -5557,16 +5675,16 @@ const Inline = /*#__PURE__*/forwardRef(function Inline(props, ref) {
|
|
|
5557
5675
|
} = props,
|
|
5558
5676
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$s);
|
|
5559
5677
|
|
|
5560
|
-
const children = childrenToElementArray(childrenProp).filter(Boolean)
|
|
5678
|
+
const children = useMemo(() => childrenToElementArray(childrenProp).filter(Boolean).map((child, idx) => /*#__PURE__*/React.createElement("div", {
|
|
5679
|
+
key: idx
|
|
5680
|
+
}, child)), [childrenProp]);
|
|
5561
5681
|
return /*#__PURE__*/React.createElement(Root$o, _extends({
|
|
5562
5682
|
"data-ui": "Inline"
|
|
5563
5683
|
}, restProps, {
|
|
5564
|
-
"$space": space,
|
|
5684
|
+
"$space": useArrayProp(space),
|
|
5565
5685
|
forwardedAs: as,
|
|
5566
5686
|
ref: ref
|
|
5567
|
-
}), children
|
|
5568
|
-
key: idx
|
|
5569
|
-
}, child)));
|
|
5687
|
+
}), children);
|
|
5570
5688
|
});
|
|
5571
5689
|
|
|
5572
5690
|
const _excluded$r = ["children", "fontSize", "padding", "radius"];
|
|
@@ -5603,7 +5721,7 @@ const KBD = /*#__PURE__*/forwardRef(function KBD(props, ref) {
|
|
|
5603
5721
|
return /*#__PURE__*/React.createElement(Root$n, _extends({
|
|
5604
5722
|
"data-ui": "KBD"
|
|
5605
5723
|
}, restProps, {
|
|
5606
|
-
"$radius": radius,
|
|
5724
|
+
"$radius": useArrayProp(radius),
|
|
5607
5725
|
ref: ref
|
|
5608
5726
|
}), /*#__PURE__*/React.createElement(Box, {
|
|
5609
5727
|
as: "span",
|
|
@@ -5657,12 +5775,6 @@ function useBoundaryElement() {
|
|
|
5657
5775
|
return value || DEFAULT_VALUE;
|
|
5658
5776
|
}
|
|
5659
5777
|
|
|
5660
|
-
/**
|
|
5661
|
-
* @internal
|
|
5662
|
-
*/
|
|
5663
|
-
|
|
5664
|
-
const RO = typeof window !== 'undefined' && window.ResizeObserver ? window.ResizeObserver : ResizeObserver$1;
|
|
5665
|
-
|
|
5666
5778
|
function findMaxBreakpoints(media, width) {
|
|
5667
5779
|
const ret = [];
|
|
5668
5780
|
|
|
@@ -5705,20 +5817,14 @@ const ElementQuery = /*#__PURE__*/forwardRef(function ElementQuery(props, ref) {
|
|
|
5705
5817
|
} = props,
|
|
5706
5818
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$q);
|
|
5707
5819
|
|
|
5708
|
-
const [width, setWidth] = useState(() => window.innerWidth);
|
|
5709
5820
|
const forwardedRef = useForwardedRef(ref);
|
|
5710
5821
|
const [element, setElement] = useState(null);
|
|
5711
|
-
|
|
5712
|
-
|
|
5713
|
-
|
|
5714
|
-
const handleResizeEntries = entries => {
|
|
5715
|
-
setWidth(entries[0].contentRect.width);
|
|
5716
|
-
};
|
|
5822
|
+
const elementSize = useElementSize(element);
|
|
5823
|
+
const width = useMemo(() => {
|
|
5824
|
+
var _elementSize$border$w;
|
|
5717
5825
|
|
|
5718
|
-
|
|
5719
|
-
|
|
5720
|
-
return () => ro.disconnect();
|
|
5721
|
-
}, [element]);
|
|
5826
|
+
return (_elementSize$border$w = elementSize == null ? void 0 : elementSize.border.width) != null ? _elementSize$border$w : window.innerWidth;
|
|
5827
|
+
}, [elementSize]);
|
|
5722
5828
|
const max = useMemo(() => findMaxBreakpoints(media, width), [media, width]);
|
|
5723
5829
|
const min = useMemo(() => findMinBreakpoints(media, width), [media, width]);
|
|
5724
5830
|
const setRef = useCallback(el => {
|
|
@@ -5811,7 +5917,7 @@ function LayerProvider(props) {
|
|
|
5811
5917
|
zOffset: zOffsetProp = 0
|
|
5812
5918
|
} = props;
|
|
5813
5919
|
const parent = useContext(LayerContext);
|
|
5814
|
-
const zOffset =
|
|
5920
|
+
const zOffset = useArrayProp(zOffsetProp);
|
|
5815
5921
|
const maxMediaIndex = zOffset.length - 1;
|
|
5816
5922
|
const mediaIndex = Math.min(useMediaIndex(), maxMediaIndex);
|
|
5817
5923
|
const zIndex = parent ? parent.zIndex + zOffset[mediaIndex] : zOffset[mediaIndex];
|
|
@@ -6256,7 +6362,7 @@ const VirtualList = /*#__PURE__*/forwardRef(function VirtualList(props, ref) {
|
|
|
6256
6362
|
scrollEl.addEventListener('scroll', _handleScroll, {
|
|
6257
6363
|
passive: true
|
|
6258
6364
|
});
|
|
6259
|
-
const ro = new
|
|
6365
|
+
const ro = new _ResizeObserver(entries => {
|
|
6260
6366
|
setScrollHeight(entries[0].contentRect.height);
|
|
6261
6367
|
});
|
|
6262
6368
|
ro.observe(scrollEl);
|
|
@@ -6662,7 +6768,7 @@ const Popover = /*#__PURE__*/forwardRef(function Popover(props, ref) {
|
|
|
6662
6768
|
tether,
|
|
6663
6769
|
tetherOffset,
|
|
6664
6770
|
tone = 'inherit',
|
|
6665
|
-
width = 0,
|
|
6771
|
+
width: widthProp = 0,
|
|
6666
6772
|
zOffset = (_theme$sanity$layer = theme.sanity.layer) == null ? void 0 : _theme$sanity$layer.popover.zOffset
|
|
6667
6773
|
} = props,
|
|
6668
6774
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$n);
|
|
@@ -6673,6 +6779,7 @@ const Popover = /*#__PURE__*/forwardRef(function Popover(props, ref) {
|
|
|
6673
6779
|
const [popperElement, setPopperElement] = useState(null);
|
|
6674
6780
|
const [arrowElement, setArrowElement] = useState(null);
|
|
6675
6781
|
const popperReferenceElement = referenceElementProp || referenceElement;
|
|
6782
|
+
const width = useArrayProp(matchReferenceWidth ? 'auto' : widthProp);
|
|
6676
6783
|
const modifiers = usePopoverModifiers({
|
|
6677
6784
|
allowedAutoPlacements,
|
|
6678
6785
|
arrow,
|
|
@@ -6713,13 +6820,21 @@ const Popover = /*#__PURE__*/forwardRef(function Popover(props, ref) {
|
|
|
6713
6820
|
forwardedRef.current = el;
|
|
6714
6821
|
}, [forwardedRef]);
|
|
6715
6822
|
const popoverStyle = useMemo(() => _extends({}, style, styles.popper), [style, styles]);
|
|
6823
|
+
const updateTimeoutRef = useRef(null);
|
|
6716
6824
|
useEffect(() => {
|
|
6717
|
-
if (
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
} catch (_) {// ignore caught error
|
|
6721
|
-
}
|
|
6825
|
+
if (updateTimeoutRef.current) {
|
|
6826
|
+
clearTimeout(updateTimeoutRef.current);
|
|
6827
|
+
updateTimeoutRef.current = null;
|
|
6722
6828
|
}
|
|
6829
|
+
|
|
6830
|
+
updateTimeoutRef.current = setTimeout(() => {
|
|
6831
|
+
if (forceUpdate) {
|
|
6832
|
+
try {
|
|
6833
|
+
forceUpdate();
|
|
6834
|
+
} catch (_) {// ignore caught error
|
|
6835
|
+
}
|
|
6836
|
+
}
|
|
6837
|
+
}, 0);
|
|
6723
6838
|
}, [content, forceUpdate, open, popperReferenceElement]);
|
|
6724
6839
|
|
|
6725
6840
|
if (disabled) {
|
|
@@ -6735,13 +6850,13 @@ const Popover = /*#__PURE__*/forwardRef(function Popover(props, ref) {
|
|
|
6735
6850
|
zOffset: zOffset
|
|
6736
6851
|
}, attributes.popper), /*#__PURE__*/React.createElement(PopoverCard, {
|
|
6737
6852
|
"$constrainSize": constrainSize,
|
|
6853
|
+
"$width": width,
|
|
6738
6854
|
"data-ui": "PopoverCard",
|
|
6739
6855
|
padding: padding,
|
|
6740
6856
|
radius: radius,
|
|
6741
6857
|
scheme: scheme,
|
|
6742
6858
|
shadow: shadow,
|
|
6743
|
-
tone: tone
|
|
6744
|
-
width: width
|
|
6859
|
+
tone: tone
|
|
6745
6860
|
}, arrow && /*#__PURE__*/React.createElement(PopoverArrow, {
|
|
6746
6861
|
ref: setArrowElement,
|
|
6747
6862
|
style: styles.arrow
|
|
@@ -7013,7 +7128,7 @@ function inputTextSizeStyle(props) {
|
|
|
7013
7128
|
const {
|
|
7014
7129
|
sizes
|
|
7015
7130
|
} = theme.sanity.fonts.text;
|
|
7016
|
-
return
|
|
7131
|
+
return _responsive(theme.sanity.media, $fontSize, sizeIndex => textSize(sizes[sizeIndex] || sizes[2]));
|
|
7017
7132
|
}
|
|
7018
7133
|
|
|
7019
7134
|
function inputStyle() {
|
|
@@ -7088,10 +7203,10 @@ const Select = /*#__PURE__*/forwardRef(function Select(props, forwardedRef) {
|
|
|
7088
7203
|
"data-read-only": !disabled && readOnly ? '' : undefined,
|
|
7089
7204
|
"data-ui": "Select"
|
|
7090
7205
|
}, restProps, {
|
|
7091
|
-
"$fontSize": fontSize,
|
|
7092
|
-
"$padding": padding,
|
|
7093
|
-
"$radius": radius,
|
|
7094
|
-
"$space": space,
|
|
7206
|
+
"$fontSize": useArrayProp(fontSize),
|
|
7207
|
+
"$padding": useArrayProp(padding),
|
|
7208
|
+
"$radius": useArrayProp(radius),
|
|
7209
|
+
"$space": useArrayProp(space),
|
|
7095
7210
|
disabled: disabled || readOnly,
|
|
7096
7211
|
ref: ref
|
|
7097
7212
|
}), children), /*#__PURE__*/React.createElement(IconBox, {
|
|
@@ -7122,7 +7237,7 @@ function responsiveStackSpaceStyle(props) {
|
|
|
7122
7237
|
media,
|
|
7123
7238
|
space
|
|
7124
7239
|
} = theme.sanity;
|
|
7125
|
-
return
|
|
7240
|
+
return _responsive(media, props.$space, spaceIndex => ({
|
|
7126
7241
|
gridGap: rem(space[spaceIndex])
|
|
7127
7242
|
}));
|
|
7128
7243
|
}
|
|
@@ -7144,7 +7259,7 @@ const Stack = /*#__PURE__*/forwardRef(function Stack(props, ref) {
|
|
|
7144
7259
|
"data-as": typeof as === 'string' ? as : undefined,
|
|
7145
7260
|
"data-ui": "Stack"
|
|
7146
7261
|
}, restProps, {
|
|
7147
|
-
"$space": space,
|
|
7262
|
+
"$space": useArrayProp(space),
|
|
7148
7263
|
forwardedAs: as,
|
|
7149
7264
|
ref: ref
|
|
7150
7265
|
}));
|
|
@@ -7156,7 +7271,7 @@ let _$f = t => t,
|
|
|
7156
7271
|
_t3$6,
|
|
7157
7272
|
_t4$4,
|
|
7158
7273
|
_t5$3,
|
|
7159
|
-
_t6$
|
|
7274
|
+
_t6$2,
|
|
7160
7275
|
_t7;
|
|
7161
7276
|
/* Root */
|
|
7162
7277
|
|
|
@@ -7321,7 +7436,7 @@ function switchThumbStyles(props) {
|
|
|
7321
7436
|
${0}
|
|
7322
7437
|
|
|
7323
7438
|
${0}
|
|
7324
|
-
`), rem(trackPadding), rem(trackPadding), rem(size), rem(size), rem(size / 2), input.switch.transitionDurationMs, input.switch.transitionTimingFunction, checked && css(_t6$
|
|
7439
|
+
`), rem(trackPadding), rem(trackPadding), rem(size), rem(size), rem(size / 2), input.switch.transitionDurationMs, input.switch.transitionTimingFunction, checked && css(_t6$2 || (_t6$2 = _$f`
|
|
7325
7440
|
transform: translate3d(${0}px, 0, 0);
|
|
7326
7441
|
`), checkedOffset), $indeterminate && css(_t7 || (_t7 = _$f`
|
|
7327
7442
|
transform: translate3d(${0}px, 0, 0);
|
|
@@ -7376,7 +7491,7 @@ const Switch = /*#__PURE__*/forwardRef(function Switch(props, forwardedRef) {
|
|
|
7376
7491
|
})));
|
|
7377
7492
|
});
|
|
7378
7493
|
|
|
7379
|
-
const _excluded$i = ["border", "customValidity", "disabled", "fontSize", "padding", "radius"];
|
|
7494
|
+
const _excluded$i = ["border", "customValidity", "disabled", "fontSize", "padding", "radius", "weight"];
|
|
7380
7495
|
|
|
7381
7496
|
let _$e = t => t,
|
|
7382
7497
|
_t$f;
|
|
@@ -7400,39 +7515,54 @@ const TextArea = /*#__PURE__*/forwardRef(function TextArea(props, forwardedRef)
|
|
|
7400
7515
|
disabled = false,
|
|
7401
7516
|
fontSize = 2,
|
|
7402
7517
|
padding = 3,
|
|
7403
|
-
radius = 1
|
|
7518
|
+
radius = 1,
|
|
7519
|
+
weight
|
|
7404
7520
|
} = props,
|
|
7405
7521
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$i);
|
|
7406
7522
|
|
|
7407
7523
|
const ref = useForwardedRef(forwardedRef);
|
|
7524
|
+
const rootTheme = useRootTheme();
|
|
7408
7525
|
useCustomValidity(ref, customValidity);
|
|
7409
7526
|
return /*#__PURE__*/React.createElement(Root$d, {
|
|
7410
7527
|
"data-ui": "TextArea"
|
|
7411
7528
|
}, /*#__PURE__*/React.createElement(InputRoot$1, null, /*#__PURE__*/React.createElement(Input$1, _extends({
|
|
7412
|
-
"data-as": "textarea"
|
|
7529
|
+
"data-as": "textarea",
|
|
7530
|
+
"data-scheme": rootTheme.scheme,
|
|
7531
|
+
"data-tone": rootTheme.tone
|
|
7413
7532
|
}, restProps, {
|
|
7414
|
-
"$fontSize": fontSize,
|
|
7415
|
-
"$padding": padding,
|
|
7533
|
+
"$fontSize": useArrayProp(fontSize),
|
|
7534
|
+
"$padding": useArrayProp(padding),
|
|
7535
|
+
"$scheme": rootTheme.scheme,
|
|
7536
|
+
"$space": useArrayProp(0),
|
|
7537
|
+
"$tone": rootTheme.tone,
|
|
7538
|
+
"$weight": weight,
|
|
7416
7539
|
disabled: disabled,
|
|
7417
7540
|
ref: ref
|
|
7418
7541
|
})), /*#__PURE__*/React.createElement(Presentation$1, {
|
|
7419
7542
|
"$border": border,
|
|
7420
|
-
"$radius": radius
|
|
7543
|
+
"$radius": useArrayProp(radius),
|
|
7544
|
+
"$scheme": rootTheme.scheme,
|
|
7545
|
+
"$tone": rootTheme.tone,
|
|
7546
|
+
"data-scheme": rootTheme.scheme,
|
|
7547
|
+
"data-tone": rootTheme.tone
|
|
7421
7548
|
})));
|
|
7422
7549
|
});
|
|
7423
7550
|
|
|
7424
|
-
const _excluded$h = ["border", "clearButton", "disabled", "fontSize", "icon", "iconRight", "onClear", "padding", "prefix", "radius", "readOnly", "space", "suffix", "customValidity", "type"];
|
|
7551
|
+
const _excluded$h = ["border", "clearButton", "disabled", "fontSize", "icon", "iconRight", "onClear", "padding", "prefix", "radius", "readOnly", "space", "suffix", "customValidity", "type", "weight"];
|
|
7425
7552
|
|
|
7426
7553
|
let _$d = t => t,
|
|
7427
7554
|
_t$e,
|
|
7428
7555
|
_t2$a,
|
|
7429
7556
|
_t3$5,
|
|
7430
7557
|
_t4$3,
|
|
7431
|
-
_t5$2
|
|
7558
|
+
_t5$2,
|
|
7559
|
+
_t6$1;
|
|
7432
7560
|
const CLEAR_BUTTON_BOX_STYLE = {
|
|
7433
7561
|
zIndex: 2
|
|
7434
7562
|
};
|
|
7435
|
-
const Root$c = styled.
|
|
7563
|
+
const Root$c = styled(Card).attrs({
|
|
7564
|
+
forwardedAs: 'span'
|
|
7565
|
+
})(textInputRootStyle);
|
|
7436
7566
|
const InputRoot = styled.span(_t$e || (_t$e = _$d`
|
|
7437
7567
|
flex: 1;
|
|
7438
7568
|
min-width: 0;
|
|
@@ -7468,7 +7598,12 @@ const LeftBox = styled(Box)(_t4$3 || (_t4$3 = _$d`
|
|
|
7468
7598
|
top: 0;
|
|
7469
7599
|
left: 0;
|
|
7470
7600
|
`));
|
|
7471
|
-
const
|
|
7601
|
+
const RightBox = styled(Box)(_t5$2 || (_t5$2 = _$d`
|
|
7602
|
+
position: absolute;
|
|
7603
|
+
top: 0;
|
|
7604
|
+
right: 0;
|
|
7605
|
+
`));
|
|
7606
|
+
const RightCard = styled(Card)(_t6$1 || (_t6$1 = _$d`
|
|
7472
7607
|
background-color: transparent;
|
|
7473
7608
|
position: absolute;
|
|
7474
7609
|
top: 0;
|
|
@@ -7483,7 +7618,7 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
|
|
|
7483
7618
|
border = true,
|
|
7484
7619
|
clearButton,
|
|
7485
7620
|
disabled = false,
|
|
7486
|
-
fontSize = 2,
|
|
7621
|
+
fontSize: fontSizeProp = 2,
|
|
7487
7622
|
icon,
|
|
7488
7623
|
iconRight,
|
|
7489
7624
|
onClear,
|
|
@@ -7491,16 +7626,20 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
|
|
|
7491
7626
|
prefix,
|
|
7492
7627
|
radius: radiusProp = 1,
|
|
7493
7628
|
readOnly,
|
|
7494
|
-
space = 3,
|
|
7629
|
+
space: spaceProp = 3,
|
|
7495
7630
|
suffix,
|
|
7496
7631
|
customValidity,
|
|
7497
|
-
type = 'text'
|
|
7632
|
+
type = 'text',
|
|
7633
|
+
weight
|
|
7498
7634
|
} = props,
|
|
7499
7635
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$h);
|
|
7500
7636
|
|
|
7501
7637
|
const ref = useForwardedRef(forwardedRef);
|
|
7502
|
-
const
|
|
7503
|
-
const
|
|
7638
|
+
const rootTheme = useRootTheme();
|
|
7639
|
+
const fontSize = useArrayProp(fontSizeProp);
|
|
7640
|
+
const padding = useArrayProp(paddingProp);
|
|
7641
|
+
const radius = useArrayProp(radiusProp);
|
|
7642
|
+
const space = useArrayProp(spaceProp); // Transient properties
|
|
7504
7643
|
|
|
7505
7644
|
const $hasClearButton = Boolean(clearButton);
|
|
7506
7645
|
const $hasIcon = Boolean(icon);
|
|
@@ -7536,16 +7675,20 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
|
|
|
7536
7675
|
"$border": border,
|
|
7537
7676
|
"$hasPrefix": $hasPrefix,
|
|
7538
7677
|
"$hasSuffix": $hasSuffix,
|
|
7539
|
-
"$radius": radius
|
|
7678
|
+
"$radius": radius,
|
|
7679
|
+
"$scheme": rootTheme.scheme,
|
|
7680
|
+
"$tone": rootTheme.tone,
|
|
7681
|
+
"data-scheme": rootTheme.scheme,
|
|
7682
|
+
"data-tone": rootTheme.tone
|
|
7540
7683
|
}, icon && /*#__PURE__*/React.createElement(LeftBox, {
|
|
7541
7684
|
padding: padding
|
|
7542
7685
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
7543
7686
|
size: fontSize
|
|
7544
|
-
}, /*#__PURE__*/isValidElement(icon) && icon, isValidElementType(icon) && /*#__PURE__*/createElement(icon))), !$hasClearButton && iconRight && /*#__PURE__*/React.createElement(
|
|
7687
|
+
}, /*#__PURE__*/isValidElement(icon) && icon, isValidElementType(icon) && /*#__PURE__*/createElement(icon))), !$hasClearButton && iconRight && /*#__PURE__*/React.createElement(RightBox, {
|
|
7545
7688
|
padding: padding
|
|
7546
7689
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
7547
7690
|
size: fontSize
|
|
7548
|
-
}, /*#__PURE__*/isValidElement(iconRight) && iconRight, isValidElementType(iconRight) && /*#__PURE__*/createElement(iconRight)))), [border, fontSize, icon, iconRight, padding, radius, $hasClearButton, $hasPrefix, $hasSuffix]); // Render clear button (memoized)
|
|
7691
|
+
}, /*#__PURE__*/isValidElement(iconRight) && iconRight, isValidElementType(iconRight) && /*#__PURE__*/createElement(iconRight)))), [border, fontSize, icon, iconRight, padding, radius, rootTheme, $hasClearButton, $hasPrefix, $hasSuffix]); // Render clear button (memoized)
|
|
7549
7692
|
|
|
7550
7693
|
const clearButtonBoxPadding = useMemo(() => padding.map(v => {
|
|
7551
7694
|
if (v === 0) return 0;
|
|
@@ -7586,15 +7729,21 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
|
|
|
7586
7729
|
tone: "inherit"
|
|
7587
7730
|
}, /*#__PURE__*/React.createElement("span", null, suffix)), [radius, suffix]);
|
|
7588
7731
|
return /*#__PURE__*/React.createElement(Root$c, {
|
|
7589
|
-
"data-ui": "TextInput"
|
|
7732
|
+
"data-ui": "TextInput",
|
|
7733
|
+
tone: rootTheme.tone
|
|
7590
7734
|
}, prefixNode, /*#__PURE__*/React.createElement(InputRoot, null, /*#__PURE__*/React.createElement(Input, _extends({
|
|
7591
|
-
"data-as": "input"
|
|
7735
|
+
"data-as": "input",
|
|
7736
|
+
"data-scheme": rootTheme.scheme,
|
|
7737
|
+
"data-tone": rootTheme.tone
|
|
7592
7738
|
}, restProps, {
|
|
7739
|
+
"$fontSize": fontSize,
|
|
7593
7740
|
"$iconLeft": $hasIcon,
|
|
7594
7741
|
"$iconRight": $hasIconRight || $hasClearButton,
|
|
7595
7742
|
"$padding": padding,
|
|
7743
|
+
"$scheme": rootTheme.scheme,
|
|
7596
7744
|
"$space": space,
|
|
7597
|
-
"$
|
|
7745
|
+
"$tone": rootTheme.tone,
|
|
7746
|
+
"$weight": weight,
|
|
7598
7747
|
disabled: disabled,
|
|
7599
7748
|
readOnly: readOnly,
|
|
7600
7749
|
ref: ref,
|
|
@@ -7696,7 +7845,7 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
|
|
|
7696
7845
|
children,
|
|
7697
7846
|
content,
|
|
7698
7847
|
disabled,
|
|
7699
|
-
fallbackPlacements,
|
|
7848
|
+
fallbackPlacements: fallbackPlacementsProp,
|
|
7700
7849
|
placement = 'bottom',
|
|
7701
7850
|
portal,
|
|
7702
7851
|
scheme,
|
|
@@ -7704,6 +7853,7 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
|
|
|
7704
7853
|
} = props,
|
|
7705
7854
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$g);
|
|
7706
7855
|
|
|
7856
|
+
const fallbackPlacements = useArrayProp(fallbackPlacementsProp);
|
|
7707
7857
|
const forwardedRef = useForwardedRef(ref);
|
|
7708
7858
|
const [referenceElement, setReferenceElement] = useState(null);
|
|
7709
7859
|
const [popperElement, setPopperElement] = useState(null);
|
|
@@ -7765,13 +7915,21 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
|
|
|
7765
7915
|
window.removeEventListener('mousemove', handleWindowMouseMove);
|
|
7766
7916
|
};
|
|
7767
7917
|
}, [isOpen, referenceElement]);
|
|
7918
|
+
const updateTimeoutRef = useRef(null);
|
|
7768
7919
|
useEffect(() => {
|
|
7769
|
-
if (
|
|
7770
|
-
|
|
7771
|
-
|
|
7772
|
-
} catch (_) {// ignore caught error
|
|
7773
|
-
}
|
|
7920
|
+
if (updateTimeoutRef.current) {
|
|
7921
|
+
clearTimeout(updateTimeoutRef.current);
|
|
7922
|
+
updateTimeoutRef.current = null;
|
|
7774
7923
|
}
|
|
7924
|
+
|
|
7925
|
+
updateTimeoutRef.current = setTimeout(() => {
|
|
7926
|
+
if (forceUpdate) {
|
|
7927
|
+
try {
|
|
7928
|
+
forceUpdate();
|
|
7929
|
+
} catch (_) {// ignore caught error
|
|
7930
|
+
}
|
|
7931
|
+
}
|
|
7932
|
+
}, 0);
|
|
7775
7933
|
}, [forceUpdate, content]); // Close when `disabled` changes to `true`
|
|
7776
7934
|
|
|
7777
7935
|
useEffect(() => {
|
|
@@ -8069,7 +8227,7 @@ const InnerAutocomplete = /*#__PURE__*/forwardRef(function InnerAutocomplete(pro
|
|
|
8069
8227
|
const popoverMouseWithinRef = useRef(false);
|
|
8070
8228
|
const listBoxId = `${id}-listbox`;
|
|
8071
8229
|
const options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY;
|
|
8072
|
-
const padding =
|
|
8230
|
+
const padding = useArrayProp(paddingProp);
|
|
8073
8231
|
const currentOption = useMemo(() => value !== null ? options.find(o => o.value === value) : undefined, [options, value]);
|
|
8074
8232
|
const filteredOptions = useMemo(() => options.filter(option => query ? filterOption(query, option) : true), [filterOption, options, query]);
|
|
8075
8233
|
const filteredOptionsLen = filteredOptions.length;
|
|
@@ -8487,10 +8645,11 @@ const Breadcrumbs = /*#__PURE__*/forwardRef(function Breadcrumbs(props, ref) {
|
|
|
8487
8645
|
children,
|
|
8488
8646
|
maxLength,
|
|
8489
8647
|
separator,
|
|
8490
|
-
space = 2
|
|
8648
|
+
space: spaceRaw = 2
|
|
8491
8649
|
} = props,
|
|
8492
8650
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$e);
|
|
8493
8651
|
|
|
8652
|
+
const space = useArrayProp(spaceRaw);
|
|
8494
8653
|
const [open, setOpen] = useState(false);
|
|
8495
8654
|
const [expandElement, setExpandElement] = useState(null);
|
|
8496
8655
|
const [popoverElement, setPopoverElement] = useState(null);
|
|
@@ -8564,7 +8723,7 @@ function dialogStyle({
|
|
|
8564
8723
|
alignItems: 'center',
|
|
8565
8724
|
justifyContent: 'center',
|
|
8566
8725
|
outline: 'none',
|
|
8567
|
-
background: color.shadow.
|
|
8726
|
+
background: color.shadow.umbra
|
|
8568
8727
|
};
|
|
8569
8728
|
}
|
|
8570
8729
|
function responsiveDialogPositionStyle(props) {
|
|
@@ -8574,7 +8733,7 @@ function responsiveDialogPositionStyle(props) {
|
|
|
8574
8733
|
const {
|
|
8575
8734
|
media
|
|
8576
8735
|
} = theme.sanity;
|
|
8577
|
-
return
|
|
8736
|
+
return _responsive(media, props.$position, position => ({
|
|
8578
8737
|
'&&': {
|
|
8579
8738
|
position
|
|
8580
8739
|
}
|
|
@@ -8670,11 +8829,14 @@ const DialogCard = /*#__PURE__*/forwardRef(function DialogCard(props, ref) {
|
|
|
8670
8829
|
id,
|
|
8671
8830
|
onClickOutside,
|
|
8672
8831
|
onClose,
|
|
8673
|
-
radius,
|
|
8832
|
+
radius: radiusProp,
|
|
8674
8833
|
scheme,
|
|
8675
|
-
shadow,
|
|
8676
|
-
width
|
|
8834
|
+
shadow: shadowProp,
|
|
8835
|
+
width: widthProp
|
|
8677
8836
|
} = props;
|
|
8837
|
+
const radius = useArrayProp(radiusProp);
|
|
8838
|
+
const shadow = useArrayProp(shadowProp);
|
|
8839
|
+
const width = useArrayProp(widthProp);
|
|
8678
8840
|
const forwardedRef = useForwardedRef(ref);
|
|
8679
8841
|
const [rootElement, setRootElement] = useState(null);
|
|
8680
8842
|
const localContentRef = useRef(null);
|
|
@@ -8757,7 +8919,7 @@ const Dialog = /*#__PURE__*/forwardRef(function Dialog(props, ref) {
|
|
|
8757
8919
|
const {
|
|
8758
8920
|
__unstable_autoFocus: autoFocus = true,
|
|
8759
8921
|
__unstable_hideCloseButton: hideCloseButton = false,
|
|
8760
|
-
cardRadius = 3,
|
|
8922
|
+
cardRadius: cardRadiusProp = 3,
|
|
8761
8923
|
cardShadow = 4,
|
|
8762
8924
|
children,
|
|
8763
8925
|
contentRef,
|
|
@@ -8766,15 +8928,20 @@ const Dialog = /*#__PURE__*/forwardRef(function Dialog(props, ref) {
|
|
|
8766
8928
|
id,
|
|
8767
8929
|
onClickOutside,
|
|
8768
8930
|
onClose,
|
|
8769
|
-
padding = 4,
|
|
8931
|
+
padding: paddingProp = 4,
|
|
8770
8932
|
portal,
|
|
8771
|
-
position = dialog.position || 'fixed',
|
|
8933
|
+
position: positionProp = dialog.position || 'fixed',
|
|
8772
8934
|
scheme,
|
|
8773
|
-
width = 0,
|
|
8774
|
-
zOffset = dialog.zOffset || ((_theme$sanity$layer = theme.sanity.layer) == null ? void 0 : _theme$sanity$layer.dialog.zOffset)
|
|
8935
|
+
width: widthProp = 0,
|
|
8936
|
+
zOffset: zOffsetProp = dialog.zOffset || ((_theme$sanity$layer = theme.sanity.layer) == null ? void 0 : _theme$sanity$layer.dialog.zOffset)
|
|
8775
8937
|
} = props,
|
|
8776
8938
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$d);
|
|
8777
8939
|
|
|
8940
|
+
const cardRadius = useArrayProp(cardRadiusProp);
|
|
8941
|
+
const padding = useArrayProp(paddingProp);
|
|
8942
|
+
const position = useArrayProp(positionProp);
|
|
8943
|
+
const width = useArrayProp(widthProp);
|
|
8944
|
+
const zOffset = useArrayProp(zOffsetProp);
|
|
8778
8945
|
const preDivRef = useRef(null);
|
|
8779
8946
|
const postDivRef = useRef(null);
|
|
8780
8947
|
const cardRef = useRef(null);
|
|
@@ -8880,10 +9047,12 @@ const Hotkeys = /*#__PURE__*/forwardRef(function Hotkeys(props, ref) {
|
|
|
8880
9047
|
keys,
|
|
8881
9048
|
padding,
|
|
8882
9049
|
radius,
|
|
8883
|
-
space = 1
|
|
9050
|
+
space: spaceProp = 1
|
|
8884
9051
|
} = props,
|
|
8885
9052
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$c);
|
|
8886
9053
|
|
|
9054
|
+
const space = useArrayProp(spaceProp);
|
|
9055
|
+
|
|
8887
9056
|
if (!keys || keys.length === 0) {
|
|
8888
9057
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
8889
9058
|
}
|
|
@@ -9543,7 +9712,7 @@ function selectableColorStyle(props) {
|
|
|
9543
9712
|
* @internal
|
|
9544
9713
|
*/
|
|
9545
9714
|
|
|
9546
|
-
const Selectable = styled(Box)(
|
|
9715
|
+
const Selectable = styled(Box)(responsiveRadiusStyle, selectableBaseStyle, selectableColorStyle);
|
|
9547
9716
|
|
|
9548
9717
|
function useMenu() {
|
|
9549
9718
|
const value = useContext(MenuContext);
|
|
@@ -9575,7 +9744,7 @@ function MenuGroup(props) {
|
|
|
9575
9744
|
icon,
|
|
9576
9745
|
onClick,
|
|
9577
9746
|
padding = 3,
|
|
9578
|
-
popover
|
|
9747
|
+
popover,
|
|
9579
9748
|
radius = 2,
|
|
9580
9749
|
space = 3,
|
|
9581
9750
|
text,
|
|
@@ -9673,7 +9842,7 @@ function MenuGroup(props) {
|
|
|
9673
9842
|
"aria-pressed": as === 'button' ? withinMenu : undefined,
|
|
9674
9843
|
"data-pressed": as !== 'button' ? withinMenu : undefined,
|
|
9675
9844
|
"data-selected": !withinMenu && active ? '' : undefined,
|
|
9676
|
-
"$radius": radius,
|
|
9845
|
+
"$radius": useArrayProp(radius),
|
|
9677
9846
|
"$tone": tone,
|
|
9678
9847
|
onClick: handleClick,
|
|
9679
9848
|
onKeyDown: handleKeyDown,
|
|
@@ -9767,13 +9936,13 @@ const MenuItem = /*#__PURE__*/forwardRef(function MenuItem(props, forwardedRef)
|
|
|
9767
9936
|
"data-selected": active ? '' : undefined,
|
|
9768
9937
|
"data-disabled": disabled ? '' : undefined,
|
|
9769
9938
|
forwardedAs: as,
|
|
9770
|
-
"$radius": radius,
|
|
9939
|
+
"$radius": useArrayProp(radius),
|
|
9940
|
+
"$padding": useArrayProp(0),
|
|
9771
9941
|
"$tone": tone,
|
|
9772
9942
|
disabled: disabled,
|
|
9773
9943
|
onClick: handleClick,
|
|
9774
9944
|
onMouseEnter: onItemMouseEnter,
|
|
9775
9945
|
onMouseLeave: onItemMouseLeave,
|
|
9776
|
-
padding: 0,
|
|
9777
9946
|
ref: setRef,
|
|
9778
9947
|
role: "menuitem",
|
|
9779
9948
|
tabIndex: -1,
|
|
@@ -9891,7 +10060,7 @@ const Skeleton = /*#__PURE__*/forwardRef(function Skeleton(props, ref) {
|
|
|
9891
10060
|
}, [delay]);
|
|
9892
10061
|
return /*#__PURE__*/React.createElement(Root$4, _extends({}, restProps, {
|
|
9893
10062
|
"$animated": animated,
|
|
9894
|
-
"$radius": radius,
|
|
10063
|
+
"$radius": useArrayProp(radius),
|
|
9895
10064
|
"$visible": visible,
|
|
9896
10065
|
ref: ref
|
|
9897
10066
|
}));
|
|
@@ -9910,13 +10079,15 @@ const Root$3 = styled(Skeleton)(({
|
|
|
9910
10079
|
media
|
|
9911
10080
|
} = theme.sanity;
|
|
9912
10081
|
const font = theme.sanity.fonts[$style];
|
|
9913
|
-
|
|
10082
|
+
|
|
10083
|
+
const styles = _responsive(media, $size, sizeIndex => {
|
|
9914
10084
|
const fontSize = font.sizes[sizeIndex];
|
|
9915
10085
|
const capHeight = fontSize.lineHeight - fontSize.ascenderHeight - fontSize.descenderHeight;
|
|
9916
10086
|
return {
|
|
9917
10087
|
height: capHeight
|
|
9918
10088
|
};
|
|
9919
10089
|
});
|
|
10090
|
+
|
|
9920
10091
|
return styles;
|
|
9921
10092
|
});
|
|
9922
10093
|
/**
|
|
@@ -9930,7 +10101,7 @@ const TextSkeleton = /*#__PURE__*/forwardRef(function TextSkeleton(props, ref) {
|
|
|
9930
10101
|
} = props,
|
|
9931
10102
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$7);
|
|
9932
10103
|
|
|
9933
|
-
const $size =
|
|
10104
|
+
const $size = useArrayProp(size);
|
|
9934
10105
|
return /*#__PURE__*/React.createElement(Root$3, _extends({}, restProps, {
|
|
9935
10106
|
"$size": $size,
|
|
9936
10107
|
ref: ref,
|
|
@@ -9948,7 +10119,7 @@ const LabelSkeleton = /*#__PURE__*/forwardRef(function TextSkeleton(props, ref)
|
|
|
9948
10119
|
} = props,
|
|
9949
10120
|
restProps = _objectWithoutPropertiesLoose(props, _excluded2);
|
|
9950
10121
|
|
|
9951
|
-
const $size =
|
|
10122
|
+
const $size = useArrayProp(size);
|
|
9952
10123
|
return /*#__PURE__*/React.createElement(Root$3, _extends({}, restProps, {
|
|
9953
10124
|
"$size": $size,
|
|
9954
10125
|
ref: ref,
|
|
@@ -9966,7 +10137,7 @@ const HeadingSkeleton = /*#__PURE__*/forwardRef(function TextSkeleton(props, ref
|
|
|
9966
10137
|
} = props,
|
|
9967
10138
|
restProps = _objectWithoutPropertiesLoose(props, _excluded3);
|
|
9968
10139
|
|
|
9969
|
-
const $size =
|
|
10140
|
+
const $size = useArrayProp(size);
|
|
9970
10141
|
return /*#__PURE__*/React.createElement(Root$3, _extends({}, restProps, {
|
|
9971
10142
|
"$size": $size,
|
|
9972
10143
|
ref: ref,
|
|
@@ -9984,7 +10155,7 @@ const CodeSkeleton = /*#__PURE__*/forwardRef(function TextSkeleton(props, ref) {
|
|
|
9984
10155
|
} = props,
|
|
9985
10156
|
restProps = _objectWithoutPropertiesLoose(props, _excluded4);
|
|
9986
10157
|
|
|
9987
|
-
const $size =
|
|
10158
|
+
const $size = useArrayProp(size);
|
|
9988
10159
|
return /*#__PURE__*/React.createElement(Root$3, _extends({}, restProps, {
|
|
9989
10160
|
"$size": $size,
|
|
9990
10161
|
ref: ref,
|
|
@@ -10936,5 +11107,5 @@ const TreeItem = /*#__PURE__*/memo(function TreeItem(props) {
|
|
|
10936
11107
|
}, children)));
|
|
10937
11108
|
});
|
|
10938
11109
|
|
|
10939
|
-
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,
|
|
11110
|
+
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 };
|
|
10940
11111
|
//# sourceMappingURL=sanity-ui.modern.js.map
|