@sanity/ui 0.37.20 → 0.37.22
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 +1 -2
- package/lib/dts/src/hooks/index.d.ts.map +1 -1
- 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/useResponsiveProp.d.ts +6 -0
- package/lib/dts/src/hooks/useResponsiveProp.d.ts.map +1 -0
- package/lib/dts/src/index.d.ts +0 -1
- package/lib/dts/src/index.d.ts.map +1 -1
- package/lib/dts/src/primitives/_selectable/selectable.d.ts +2 -1
- 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 +1 -5
- package/lib/dts/src/primitives/select/styles.d.ts.map +1 -1
- package/lib/dts/src/primitives/spinner/spinner.d.ts +1 -1
- package/lib/dts/src/primitives/spinner/spinner.d.ts.map +1 -1
- package/lib/dts/src/primitives/spinner/styles.d.ts +9 -0
- package/lib/dts/src/primitives/spinner/styles.d.ts.map +1 -0
- 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 +2 -7
- 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 +1 -0
- package/lib/dts/src/utils/index.d.ts.map +1 -1
- package/lib/dts/src/utils/resizeObserver.d.ts +6 -0
- package/lib/dts/src/utils/resizeObserver.d.ts.map +1 -0
- package/lib/dts/src/utils/virtualList/virtualList.d.ts.map +1 -1
- package/lib/sanity-ui.js +630 -751
- package/lib/sanity-ui.js.map +1 -1
- package/lib/sanity-ui.modern.js +610 -737
- package/lib/sanity-ui.modern.js.map +1 -1
- package/lib/sanity-ui.module.js +626 -745
- package/lib/sanity-ui.module.js.map +1 -1
- package/package.json +11 -11
- package/src/__workshop__/color/overview.tsx +11 -9
- package/src/components/autocomplete/__workshop__/async.tsx +12 -14
- package/src/components/autocomplete/__workshop__/constrainedHeight.tsx +0 -36
- package/src/components/autocomplete/autocomplete.tsx +2 -2
- package/src/components/breadcrumbs/breadcrumbs.tsx +2 -3
- package/src/components/dialog/dialog.tsx +9 -17
- package/src/components/dialog/styles.ts +4 -4
- package/src/components/hotkeys/hotkeys.tsx +1 -3
- package/src/components/menu/__workshop__/constrainedInBoundary.tsx +14 -11
- package/src/components/menu/__workshop__/groups.tsx +1 -1
- package/src/components/menu/menuGroup.tsx +2 -3
- package/src/components/menu/menuItem.tsx +3 -3
- package/src/components/skeleton/skeleton.tsx +1 -10
- package/src/components/skeleton/textSkeleton.tsx +7 -7
- package/src/hooks/index.ts +1 -2
- package/src/hooks/useElementRect/useElementRect.ts +16 -4
- package/src/hooks/useResponsiveProp.ts +10 -0
- package/src/index.ts +0 -1
- package/src/primitives/_selectable/selectable.tsx +4 -5
- package/src/primitives/avatar/avatar.tsx +5 -7
- package/src/primitives/avatar/avatarCounter.tsx +11 -12
- package/src/primitives/avatar/avatarStack.tsx +10 -15
- package/src/primitives/avatar/styles.ts +2 -2
- package/src/primitives/badge/badge.tsx +2 -3
- package/src/primitives/box/box.tsx +25 -26
- package/src/primitives/button/__workshop__/props.tsx +2 -0
- package/src/primitives/button/button.tsx +10 -22
- package/src/primitives/card/card.tsx +7 -8
- package/src/primitives/checkbox/__workshop__/example.tsx +2 -4
- package/src/primitives/checkbox/__workshop__/props.tsx +2 -4
- package/src/primitives/checkbox/__workshop__/readOnly.tsx +2 -4
- package/src/primitives/code/__workshop__/props.tsx +1 -1
- package/src/primitives/code/code.tsx +1 -2
- package/src/primitives/container/container.tsx +1 -10
- package/src/primitives/container/styles.ts +2 -2
- package/src/primitives/container/types.ts +1 -1
- package/src/primitives/flex/flex.tsx +5 -6
- package/src/primitives/grid/__workshop__/responsive.tsx +12 -13
- package/src/primitives/grid/grid.tsx +8 -9
- package/src/primitives/heading/__workshop__/opticalAlignment.tsx +7 -19
- package/src/primitives/heading/heading.tsx +2 -3
- package/src/primitives/inline/inline.tsx +6 -12
- package/src/primitives/inline/styles.ts +2 -2
- package/src/primitives/inline/types.ts +1 -1
- package/src/primitives/kbd/kbd.tsx +1 -2
- package/src/primitives/label/label.tsx +3 -4
- package/src/primitives/popover/__workshop__/index.ts +5 -10
- package/src/primitives/popover/__workshop__/{MarginsStory.tsx → margins.tsx} +1 -1
- package/src/primitives/popover/__workshop__/{MatchReferenceWidthStory.tsx → matchReferenceWidth.tsx} +0 -0
- package/src/primitives/popover/__workshop__/{PlainStory.tsx → plain.tsx} +14 -12
- package/src/primitives/popover/__workshop__/{RecursiveStory.tsx → recursive.tsx} +1 -4
- package/src/primitives/popover/__workshop__/rightAligned.tsx +57 -0
- package/src/primitives/popover/popover.tsx +10 -29
- package/src/primitives/select/select.tsx +9 -9
- package/src/primitives/select/styles.ts +4 -10
- package/src/primitives/spinner/spinner.tsx +8 -19
- package/src/primitives/spinner/styles.ts +43 -0
- package/src/primitives/stack/stack.tsx +1 -2
- package/src/primitives/stack/styles.ts +3 -3
- package/src/primitives/text/__workshop__/opticalAlignment.tsx +5 -15
- package/src/primitives/text/text.tsx +2 -3
- package/src/primitives/textArea/__workshop__/plain.tsx +18 -23
- package/src/primitives/textArea/textArea.tsx +5 -21
- package/src/primitives/textInput/__workshop__/clearButton.tsx +8 -14
- package/src/primitives/textInput/__workshop__/index.ts +2 -2
- package/src/primitives/textInput/__workshop__/plain.tsx +32 -39
- package/src/primitives/textInput/__workshop__/tones.tsx +95 -234
- package/src/primitives/textInput/__workshop__/typed.tsx +2 -8
- package/src/primitives/textInput/textInput.tsx +12 -47
- package/src/primitives/tooltip/__workshop__/props.tsx +2 -7
- package/src/primitives/tooltip/tooltip.tsx +9 -19
- 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 +4 -5
- package/src/styles/flex/flexStyle.ts +6 -6
- package/src/styles/flex/types.ts +6 -6
- package/src/styles/font/responsiveFont.ts +4 -2
- package/src/styles/font/textAlignStyle.ts +2 -2
- package/src/styles/font/types.ts +3 -4
- 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 +27 -24
- package/src/styles/input/textInputStyle.ts +80 -92
- 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 +5 -2
- package/src/styles/shadow/types.ts +1 -1
- package/src/theme/studioTheme/color.ts +14 -15
- package/src/theme/studioTheme/fonts.ts +4 -4
- package/src/utils/elementQuery/elementQuery.tsx +18 -5
- package/src/utils/index.ts +1 -0
- package/src/utils/layer/layerProvider.tsx +2 -2
- package/src/{observers → utils}/resizeObserver.ts +3 -1
- package/src/utils/virtualList/virtualList.tsx +1 -3
- package/lib/dts/src/hooks/useArrayProp.d.ts +0 -7
- package/lib/dts/src/hooks/useArrayProp.d.ts.map +0 -1
- package/lib/dts/src/hooks/useElementSize.d.ts +0 -7
- package/lib/dts/src/hooks/useElementSize.d.ts.map +0 -1
- package/lib/dts/src/observers/elementSizeObserver.d.ts +0 -37
- package/lib/dts/src/observers/elementSizeObserver.d.ts.map +0 -1
- package/lib/dts/src/observers/index.d.ts +0 -3
- package/lib/dts/src/observers/index.d.ts.map +0 -1
- package/lib/dts/src/observers/resizeObserver.d.ts +0 -5
- package/lib/dts/src/observers/resizeObserver.d.ts.map +0 -1
- package/src/hooks/useArrayProp.ts +0 -23
- package/src/hooks/useElementSize.ts +0 -18
- package/src/observers/elementSizeObserver.ts +0 -116
- package/src/observers/index.ts +0 -2
- package/src/primitives/popover/__workshop__/RightAlignedStory.tsx +0 -60
- package/src/primitives/popover/__workshop__/TestStory.tsx +0 -79
package/lib/sanity-ui.modern.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useId } from '@reach/auto-id';
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { useState, useRef, useEffect, createContext, useContext, useMemo, 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';
|
|
6
5
|
import { white as white$1, black as black$1, hues } from '@sanity/color';
|
|
7
6
|
import { SpinnerIcon, CheckmarkIcon, RemoveIcon, SelectIcon, CloseIcon, ChevronDownIcon, ChevronRightIcon, ToggleArrowRightIcon } from '@sanity/icons';
|
|
8
7
|
import Refractor from 'react-refractor';
|
|
9
8
|
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,213 +47,6 @@ 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
|
-
|
|
257
50
|
function _getElements(element, elementsArg) {
|
|
258
51
|
const ret = [element];
|
|
259
52
|
|
|
@@ -335,107 +128,21 @@ function useClickOutside(listener, elementsArg = EMPTY_ARRAY, boundaryElement) {
|
|
|
335
128
|
}
|
|
336
129
|
|
|
337
130
|
/**
|
|
338
|
-
*
|
|
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.
|
|
131
|
+
* Subscribe to the rect of a DOM element.
|
|
419
132
|
* @beta
|
|
420
133
|
*/
|
|
421
134
|
|
|
422
|
-
function
|
|
423
|
-
const [
|
|
135
|
+
function useElementRect(element) {
|
|
136
|
+
const [rect, setRect] = useState(null);
|
|
424
137
|
useEffect(() => {
|
|
425
138
|
if (!element) return undefined;
|
|
426
|
-
|
|
139
|
+
const ro = new ResizeObserver(entries => {
|
|
140
|
+
setRect(entries[0].contentRect);
|
|
141
|
+
});
|
|
142
|
+
ro.observe(element);
|
|
143
|
+
return () => ro.disconnect();
|
|
427
144
|
}, [element]);
|
|
428
|
-
return
|
|
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;
|
|
145
|
+
return rect;
|
|
439
146
|
}
|
|
440
147
|
|
|
441
148
|
/**
|
|
@@ -1884,20 +1591,18 @@ const color = createColorTheme({
|
|
|
1884
1591
|
name
|
|
1885
1592
|
}) => {
|
|
1886
1593
|
if (name === 'default') {
|
|
1887
|
-
const
|
|
1888
|
-
|
|
1889
|
-
const _skeletonFrom = dark ? _tints[900].hex : _tints[100].hex;
|
|
1594
|
+
const _skeletonFrom = dark ? hues.gray[900].hex : hues.gray[100].hex;
|
|
1890
1595
|
|
|
1891
1596
|
return {
|
|
1892
1597
|
fg: dark ? white$1.hex : black$1.hex,
|
|
1893
1598
|
bg: dark ? black$1.hex : white$1.hex,
|
|
1894
|
-
border:
|
|
1599
|
+
border: hues.gray[dark ? 800 : 200].hex,
|
|
1895
1600
|
focusRing: hues.blue[dark ? 500 : 500].hex,
|
|
1896
1601
|
shadow: {
|
|
1897
|
-
outline: rgba(
|
|
1898
|
-
umbra: dark ?
|
|
1899
|
-
penumbra: dark ?
|
|
1900
|
-
ambient: dark ?
|
|
1602
|
+
outline: rgba(hues.gray[500].hex, 0.4),
|
|
1603
|
+
umbra: rgba(dark ? black$1.hex : hues.gray[500].hex, 0.2),
|
|
1604
|
+
penumbra: rgba(dark ? black$1.hex : hues.gray[500].hex, 0.14),
|
|
1605
|
+
ambient: rgba(dark ? black$1.hex : hues.gray[500].hex, 0.12)
|
|
1901
1606
|
},
|
|
1902
1607
|
skeleton: {
|
|
1903
1608
|
from: _skeletonFrom,
|
|
@@ -1907,18 +1612,18 @@ const color = createColorTheme({
|
|
|
1907
1612
|
}
|
|
1908
1613
|
|
|
1909
1614
|
if (name === 'transparent') {
|
|
1910
|
-
const
|
|
1911
|
-
const _skeletonFrom2 =
|
|
1615
|
+
const _tints = tones.default;
|
|
1616
|
+
const _skeletonFrom2 = _tints[dark ? 800 : 200].hex;
|
|
1912
1617
|
return {
|
|
1913
|
-
fg:
|
|
1914
|
-
bg:
|
|
1915
|
-
border:
|
|
1618
|
+
fg: _tints[dark ? 100 : 900].hex,
|
|
1619
|
+
bg: _tints[dark ? 950 : 50].hex,
|
|
1620
|
+
border: _tints[dark ? 800 : 300].hex,
|
|
1916
1621
|
focusRing: hues.blue[500].hex,
|
|
1917
1622
|
shadow: {
|
|
1918
|
-
outline: rgba(
|
|
1919
|
-
umbra: dark ?
|
|
1920
|
-
penumbra: dark ?
|
|
1921
|
-
ambient: dark ?
|
|
1623
|
+
outline: rgba(_tints[500].hex, dark ? 0.2 : 0.4),
|
|
1624
|
+
umbra: rgba(dark ? black$1.hex : _tints[500].hex, 0.2),
|
|
1625
|
+
penumbra: rgba(dark ? black$1.hex : _tints[500].hex, 0.14),
|
|
1626
|
+
ambient: rgba(dark ? black$1.hex : _tints[500].hex, 0.12)
|
|
1922
1627
|
},
|
|
1923
1628
|
skeleton: {
|
|
1924
1629
|
from: _skeletonFrom2,
|
|
@@ -1935,10 +1640,10 @@ const color = createColorTheme({
|
|
|
1935
1640
|
border: tints[dark ? 800 : 200].hex,
|
|
1936
1641
|
focusRing: tints[500].hex,
|
|
1937
1642
|
shadow: {
|
|
1938
|
-
outline: rgba(tints[500].hex, 0.4),
|
|
1939
|
-
umbra: dark ?
|
|
1940
|
-
penumbra: dark ?
|
|
1941
|
-
ambient: dark ?
|
|
1643
|
+
outline: rgba(tints[500].hex, dark ? 0.2 : 0.4),
|
|
1644
|
+
umbra: rgba(dark ? black$1.hex : tints[500].hex, 0.2),
|
|
1645
|
+
penumbra: rgba(dark ? black$1.hex : tints[500].hex, 0.14),
|
|
1646
|
+
ambient: rgba(dark ? black$1.hex : tints[500].hex, 0.12)
|
|
1942
1647
|
},
|
|
1943
1648
|
skeleton: {
|
|
1944
1649
|
from: skeletonFrom,
|
|
@@ -2609,15 +2314,15 @@ const fonts = {
|
|
|
2609
2314
|
lineHeight: 33,
|
|
2610
2315
|
letterSpacing: 0
|
|
2611
2316
|
}, {
|
|
2612
|
-
ascenderHeight:
|
|
2613
|
-
descenderHeight:
|
|
2317
|
+
ascenderHeight: 9,
|
|
2318
|
+
descenderHeight: 7,
|
|
2614
2319
|
fontSize: 33,
|
|
2615
2320
|
iconSize: 49,
|
|
2616
2321
|
lineHeight: 39,
|
|
2617
2322
|
letterSpacing: 0
|
|
2618
2323
|
}, {
|
|
2619
|
-
ascenderHeight:
|
|
2620
|
-
descenderHeight:
|
|
2324
|
+
ascenderHeight: 10,
|
|
2325
|
+
descenderHeight: 8,
|
|
2621
2326
|
fontSize: 38,
|
|
2622
2327
|
iconSize: 53,
|
|
2623
2328
|
lineHeight: 45,
|
|
@@ -2839,7 +2544,7 @@ globalScope[key$7] = globalScope[key$7] || /*#__PURE__*/createContext(null);
|
|
|
2839
2544
|
|
|
2840
2545
|
const ThemeContext = globalScope[key$7];
|
|
2841
2546
|
|
|
2842
|
-
const _excluded$
|
|
2547
|
+
const _excluded$I = ["color", "layer"];
|
|
2843
2548
|
/**
|
|
2844
2549
|
* @public
|
|
2845
2550
|
*/
|
|
@@ -2859,7 +2564,7 @@ function ThemeProvider(props) {
|
|
|
2859
2564
|
color: rootColor,
|
|
2860
2565
|
layer: rootLayer
|
|
2861
2566
|
} = themeProp,
|
|
2862
|
-
restTheme = _objectWithoutPropertiesLoose(themeProp, _excluded$
|
|
2567
|
+
restTheme = _objectWithoutPropertiesLoose(themeProp, _excluded$I);
|
|
2863
2568
|
|
|
2864
2569
|
const colorScheme = rootColor[scheme] || rootColor.light;
|
|
2865
2570
|
const color = colorScheme[tone] || colorScheme.default;
|
|
@@ -3073,39 +2778,240 @@ function usePrefersDark() {
|
|
|
3073
2778
|
}
|
|
3074
2779
|
|
|
3075
2780
|
/**
|
|
3076
|
-
* @beta
|
|
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)
|
|
2952
|
+
}
|
|
2953
|
+
};
|
|
2954
|
+
}
|
|
2955
|
+
|
|
2956
|
+
/**
|
|
2957
|
+
* Get responsive CSS for the `code` font style.
|
|
2958
|
+
* @internal
|
|
2959
|
+
*/
|
|
2960
|
+
|
|
2961
|
+
function responsiveCodeFontStyle(props) {
|
|
2962
|
+
return responsiveFont('code', props);
|
|
2963
|
+
}
|
|
2964
|
+
|
|
2965
|
+
/**
|
|
2966
|
+
* Get responsive CSS for the `heading` font style.
|
|
2967
|
+
* @internal
|
|
3077
2968
|
*/
|
|
3078
2969
|
|
|
3079
|
-
|
|
2970
|
+
function responsiveHeadingFont(props) {
|
|
2971
|
+
return responsiveFont('heading', props);
|
|
2972
|
+
}
|
|
3080
2973
|
|
|
3081
2974
|
/**
|
|
3082
|
-
*
|
|
2975
|
+
* Get responsive CSS for the `label` font style.
|
|
2976
|
+
* @internal
|
|
3083
2977
|
*/
|
|
3084
2978
|
|
|
3085
|
-
function
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
if (!ref) return;
|
|
2979
|
+
function responsiveLabelFont(props) {
|
|
2980
|
+
return responsiveFont('label', props);
|
|
2981
|
+
}
|
|
3089
2982
|
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
|
|
3093
|
-
|
|
3094
|
-
|
|
2983
|
+
/**
|
|
2984
|
+
* Get responsive text align styles.
|
|
2985
|
+
* @internal
|
|
2986
|
+
*/
|
|
2987
|
+
|
|
2988
|
+
function responsiveTextAlignStyle(props) {
|
|
2989
|
+
const {
|
|
2990
|
+
theme
|
|
2991
|
+
} = props;
|
|
2992
|
+
return responsive(theme.sanity.media, getResponsiveProp(props.$align), textAlign => {
|
|
2993
|
+
return {
|
|
2994
|
+
textAlign
|
|
2995
|
+
};
|
|
3095
2996
|
});
|
|
3096
|
-
return innerRef;
|
|
3097
2997
|
}
|
|
3098
2998
|
|
|
3099
2999
|
/**
|
|
3000
|
+
* Get responsive CSS for the `text` font style.
|
|
3001
|
+
* @internal
|
|
3002
|
+
*/
|
|
3003
|
+
|
|
3004
|
+
function responsiveTextFont(props) {
|
|
3005
|
+
return responsiveFont('text', props);
|
|
3006
|
+
}
|
|
3007
|
+
|
|
3008
|
+
/**
|
|
3009
|
+
* This API might change. DO NOT USE IN PRODUCTION.
|
|
3100
3010
|
* @beta
|
|
3101
3011
|
*/
|
|
3102
3012
|
|
|
3103
|
-
function
|
|
3104
|
-
|
|
3105
|
-
if (ref.current) {
|
|
3106
|
-
ref.current.setCustomValidity(customValidity || '');
|
|
3107
|
-
}
|
|
3108
|
-
}, [customValidity, ref]);
|
|
3013
|
+
function useResponsiveProp(val, defaultVal) {
|
|
3014
|
+
return useMemo(() => getResponsiveProp(val, defaultVal), [defaultVal, val]);
|
|
3109
3015
|
}
|
|
3110
3016
|
|
|
3111
3017
|
const BORDER_VALUE = '1px solid var(--card-border-color)';
|
|
@@ -3120,7 +3026,7 @@ function border(props) {
|
|
|
3120
3026
|
const {
|
|
3121
3027
|
media
|
|
3122
3028
|
} = theme.sanity;
|
|
3123
|
-
return
|
|
3029
|
+
return responsive(media, getResponsiveProp(props.$border), value => value ? {
|
|
3124
3030
|
'&&': {
|
|
3125
3031
|
border: BORDER_VALUE
|
|
3126
3032
|
}
|
|
@@ -3138,7 +3044,7 @@ function borderTop(props) {
|
|
|
3138
3044
|
const {
|
|
3139
3045
|
media
|
|
3140
3046
|
} = theme.sanity;
|
|
3141
|
-
return
|
|
3047
|
+
return responsive(media, getResponsiveProp(props.$borderTop), value => value ? {
|
|
3142
3048
|
'&&': {
|
|
3143
3049
|
borderTop: BORDER_VALUE
|
|
3144
3050
|
}
|
|
@@ -3156,7 +3062,7 @@ function borderRight(props) {
|
|
|
3156
3062
|
const {
|
|
3157
3063
|
media
|
|
3158
3064
|
} = theme.sanity;
|
|
3159
|
-
return
|
|
3065
|
+
return responsive(media, getResponsiveProp(props.$borderRight), value => value ? {
|
|
3160
3066
|
'&&': {
|
|
3161
3067
|
borderRight: BORDER_VALUE
|
|
3162
3068
|
}
|
|
@@ -3174,7 +3080,7 @@ function borderBottom(props) {
|
|
|
3174
3080
|
const {
|
|
3175
3081
|
media
|
|
3176
3082
|
} = theme.sanity;
|
|
3177
|
-
return
|
|
3083
|
+
return responsive(media, getResponsiveProp(props.$borderBottom), value => value ? {
|
|
3178
3084
|
'&&': {
|
|
3179
3085
|
borderBottom: BORDER_VALUE
|
|
3180
3086
|
}
|
|
@@ -3192,7 +3098,7 @@ function borderLeft(props) {
|
|
|
3192
3098
|
const {
|
|
3193
3099
|
media
|
|
3194
3100
|
} = theme.sanity;
|
|
3195
|
-
return
|
|
3101
|
+
return responsive(media, getResponsiveProp(props.$borderLeft), value => value ? {
|
|
3196
3102
|
'&&': {
|
|
3197
3103
|
borderLeft: BORDER_VALUE
|
|
3198
3104
|
}
|
|
@@ -3230,7 +3136,7 @@ function responsiveBoxDisplayStyle(props) {
|
|
|
3230
3136
|
const {
|
|
3231
3137
|
media
|
|
3232
3138
|
} = theme.sanity;
|
|
3233
|
-
return
|
|
3139
|
+
return responsive(media, getResponsiveProp(props.$display), display => ({
|
|
3234
3140
|
'&:not([hidden])': {
|
|
3235
3141
|
display
|
|
3236
3142
|
}
|
|
@@ -3244,7 +3150,7 @@ function responsiveBoxSizingStyle(props) {
|
|
|
3244
3150
|
const {
|
|
3245
3151
|
media
|
|
3246
3152
|
} = theme.sanity;
|
|
3247
|
-
return
|
|
3153
|
+
return responsive(media, getResponsiveProp(props.$sizing), sizing => ({
|
|
3248
3154
|
boxSizing: BOX_SIZING[sizing]
|
|
3249
3155
|
}));
|
|
3250
3156
|
}
|
|
@@ -3256,7 +3162,7 @@ function responsiveBoxHeightStyle(props) {
|
|
|
3256
3162
|
const {
|
|
3257
3163
|
media
|
|
3258
3164
|
} = theme.sanity;
|
|
3259
|
-
return
|
|
3165
|
+
return responsive(media, getResponsiveProp(props.$height), height => ({
|
|
3260
3166
|
height: BOX_HEIGHT[height]
|
|
3261
3167
|
}));
|
|
3262
3168
|
}
|
|
@@ -3268,7 +3174,7 @@ function responsiveBoxOverflowStyle(props) {
|
|
|
3268
3174
|
const {
|
|
3269
3175
|
media
|
|
3270
3176
|
} = theme.sanity;
|
|
3271
|
-
return
|
|
3177
|
+
return responsive(media, getResponsiveProp(props.$overflow), overflow => ({
|
|
3272
3178
|
overflow
|
|
3273
3179
|
}));
|
|
3274
3180
|
}
|
|
@@ -3288,7 +3194,7 @@ function responsiveFlexAlignStyle(props) {
|
|
|
3288
3194
|
const {
|
|
3289
3195
|
media
|
|
3290
3196
|
} = theme.sanity;
|
|
3291
|
-
return
|
|
3197
|
+
return responsive(media, getResponsiveProp(props.$align), align => {
|
|
3292
3198
|
return {
|
|
3293
3199
|
alignItems: align
|
|
3294
3200
|
};
|
|
@@ -3303,7 +3209,7 @@ function responsiveFlexGapStyle(props) {
|
|
|
3303
3209
|
media,
|
|
3304
3210
|
space
|
|
3305
3211
|
} = theme.sanity;
|
|
3306
|
-
return
|
|
3212
|
+
return responsive(media, getResponsiveProp(props.$gap), gap => ({
|
|
3307
3213
|
gap: gap ? rem(space[gap]) : undefined
|
|
3308
3214
|
}));
|
|
3309
3215
|
}
|
|
@@ -3315,7 +3221,7 @@ function responsiveFlexWrapStyle(props) {
|
|
|
3315
3221
|
const {
|
|
3316
3222
|
media
|
|
3317
3223
|
} = theme.sanity;
|
|
3318
|
-
return
|
|
3224
|
+
return responsive(media, getResponsiveProp(props.$wrap), wrap => {
|
|
3319
3225
|
return {
|
|
3320
3226
|
flexWrap: wrap
|
|
3321
3227
|
};
|
|
@@ -3328,7 +3234,7 @@ function responsiveFlexJustifyStyle(props) {
|
|
|
3328
3234
|
const {
|
|
3329
3235
|
media
|
|
3330
3236
|
} = theme.sanity;
|
|
3331
|
-
return
|
|
3237
|
+
return responsive(media, getResponsiveProp(props.$justify), justify => {
|
|
3332
3238
|
return {
|
|
3333
3239
|
justifyContent: justify
|
|
3334
3240
|
};
|
|
@@ -3341,7 +3247,7 @@ function responsiveFlexDirectionStyle(props) {
|
|
|
3341
3247
|
const {
|
|
3342
3248
|
media
|
|
3343
3249
|
} = theme.sanity;
|
|
3344
|
-
return
|
|
3250
|
+
return responsive(media, getResponsiveProp(props.$direction), direction => {
|
|
3345
3251
|
return {
|
|
3346
3252
|
flexDirection: direction
|
|
3347
3253
|
};
|
|
@@ -3362,10 +3268,11 @@ function responsiveFlexItemStyle(props) {
|
|
|
3362
3268
|
const {
|
|
3363
3269
|
media
|
|
3364
3270
|
} = theme.sanity;
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3271
|
+
return responsive(media, getResponsiveProp(props.$flex), flex => {
|
|
3272
|
+
return {
|
|
3273
|
+
flex
|
|
3274
|
+
};
|
|
3275
|
+
});
|
|
3369
3276
|
}
|
|
3370
3277
|
|
|
3371
3278
|
function focusRingBorderStyle(border) {
|
|
@@ -3414,7 +3321,7 @@ function responsiveGridAutoFlowStyle(props) {
|
|
|
3414
3321
|
const {
|
|
3415
3322
|
media
|
|
3416
3323
|
} = theme.sanity;
|
|
3417
|
-
return
|
|
3324
|
+
return responsive(media, getResponsiveProp(props.$autoFlow), autoFlow => ({
|
|
3418
3325
|
gridAutoFlow: autoFlow
|
|
3419
3326
|
}));
|
|
3420
3327
|
}
|
|
@@ -3426,7 +3333,7 @@ function responsiveGridAutoRowsStyle(props) {
|
|
|
3426
3333
|
const {
|
|
3427
3334
|
media
|
|
3428
3335
|
} = theme.sanity;
|
|
3429
|
-
return
|
|
3336
|
+
return responsive(media, getResponsiveProp(props.$autoRows), autoRows => ({
|
|
3430
3337
|
gridAutoRows: autoRows && GRID_AUTO_ROWS[autoRows]
|
|
3431
3338
|
}));
|
|
3432
3339
|
}
|
|
@@ -3438,7 +3345,7 @@ function responsiveGridAutoColsStyle(props) {
|
|
|
3438
3345
|
const {
|
|
3439
3346
|
media
|
|
3440
3347
|
} = theme.sanity;
|
|
3441
|
-
return
|
|
3348
|
+
return responsive(media, getResponsiveProp(props.$autoCols), autoCols => ({
|
|
3442
3349
|
gridAutoColumns: autoCols && GRID_AUTO_COLUMS[autoCols]
|
|
3443
3350
|
}));
|
|
3444
3351
|
}
|
|
@@ -3450,7 +3357,7 @@ function responsiveGridColumnsStyle(props) {
|
|
|
3450
3357
|
const {
|
|
3451
3358
|
media
|
|
3452
3359
|
} = theme.sanity;
|
|
3453
|
-
return
|
|
3360
|
+
return responsive(media, getResponsiveProp(props.$columns), columns => ({
|
|
3454
3361
|
gridTemplateColumns: columns && `repeat(${columns},minmax(0,1fr));`
|
|
3455
3362
|
}));
|
|
3456
3363
|
}
|
|
@@ -3462,7 +3369,7 @@ function responsiveGridRowsStyle(props) {
|
|
|
3462
3369
|
const {
|
|
3463
3370
|
media
|
|
3464
3371
|
} = theme.sanity;
|
|
3465
|
-
return
|
|
3372
|
+
return responsive(media, getResponsiveProp(props.$rows), rows => ({
|
|
3466
3373
|
gridTemplateRows: rows && `repeat(${rows},minmax(0,1fr));`
|
|
3467
3374
|
}));
|
|
3468
3375
|
}
|
|
@@ -3475,7 +3382,7 @@ function responsiveGridGapStyle(props) {
|
|
|
3475
3382
|
media,
|
|
3476
3383
|
space
|
|
3477
3384
|
} = theme.sanity;
|
|
3478
|
-
return
|
|
3385
|
+
return responsive(media, getResponsiveProp(props.$gap), gap => ({
|
|
3479
3386
|
gridGap: gap ? rem(space[gap]) : undefined
|
|
3480
3387
|
}));
|
|
3481
3388
|
}
|
|
@@ -3488,7 +3395,7 @@ function responsiveGridGapXStyle(props) {
|
|
|
3488
3395
|
media,
|
|
3489
3396
|
space
|
|
3490
3397
|
} = theme.sanity;
|
|
3491
|
-
return
|
|
3398
|
+
return responsive(media, getResponsiveProp(props.$gapX), gapX => ({
|
|
3492
3399
|
columnGap: gapX ? rem(space[gapX]) : undefined
|
|
3493
3400
|
}));
|
|
3494
3401
|
}
|
|
@@ -3501,7 +3408,7 @@ function responsiveGridGapYStyle(props) {
|
|
|
3501
3408
|
media,
|
|
3502
3409
|
space
|
|
3503
3410
|
} = theme.sanity;
|
|
3504
|
-
return
|
|
3411
|
+
return responsive(media, getResponsiveProp(props.$gapY), gapY => ({
|
|
3505
3412
|
rowGap: gapY ? rem(space[gapY]) : undefined
|
|
3506
3413
|
}));
|
|
3507
3414
|
}
|
|
@@ -3525,7 +3432,7 @@ function responsiveGridItemRowStyle(props) {
|
|
|
3525
3432
|
const {
|
|
3526
3433
|
media
|
|
3527
3434
|
} = theme.sanity;
|
|
3528
|
-
return
|
|
3435
|
+
return responsive(media, getResponsiveProp(props.$row), row => {
|
|
3529
3436
|
if (typeof row === 'number') {
|
|
3530
3437
|
return {
|
|
3531
3438
|
gridRow: `span ${row} / span ${row}`
|
|
@@ -3545,7 +3452,7 @@ function responsiveGridItemRowStartStyle(props) {
|
|
|
3545
3452
|
const {
|
|
3546
3453
|
media
|
|
3547
3454
|
} = theme.sanity;
|
|
3548
|
-
return
|
|
3455
|
+
return responsive(media, getResponsiveProp(props.$rowStart), rowStart => ({
|
|
3549
3456
|
gridRowStart: rowStart
|
|
3550
3457
|
}));
|
|
3551
3458
|
}
|
|
@@ -3557,7 +3464,7 @@ function responsiveGridItemRowEndStyle(props) {
|
|
|
3557
3464
|
const {
|
|
3558
3465
|
media
|
|
3559
3466
|
} = theme.sanity;
|
|
3560
|
-
return
|
|
3467
|
+
return responsive(media, getResponsiveProp(props.$rowEnd), rowEnd => ({
|
|
3561
3468
|
gridRowEnd: rowEnd
|
|
3562
3469
|
}));
|
|
3563
3470
|
}
|
|
@@ -3569,7 +3476,7 @@ function responsiveGridItemColumnStyle(props) {
|
|
|
3569
3476
|
const {
|
|
3570
3477
|
media
|
|
3571
3478
|
} = theme.sanity;
|
|
3572
|
-
return
|
|
3479
|
+
return responsive(media, getResponsiveProp(props.$column), column => {
|
|
3573
3480
|
if (typeof column === 'number') {
|
|
3574
3481
|
return {
|
|
3575
3482
|
gridColumn: `span ${column} / span ${column}`
|
|
@@ -3589,7 +3496,7 @@ function responsiveGridItemColumnStartStyle(props) {
|
|
|
3589
3496
|
const {
|
|
3590
3497
|
media
|
|
3591
3498
|
} = theme.sanity;
|
|
3592
|
-
return
|
|
3499
|
+
return responsive(media, getResponsiveProp(props.$columnStart), columnStart => ({
|
|
3593
3500
|
gridColumnStart: columnStart
|
|
3594
3501
|
}));
|
|
3595
3502
|
}
|
|
@@ -3601,18 +3508,15 @@ function responsiveGridItemColumnEndStyle(props) {
|
|
|
3601
3508
|
const {
|
|
3602
3509
|
media
|
|
3603
3510
|
} = theme.sanity;
|
|
3604
|
-
return
|
|
3511
|
+
return responsive(media, getResponsiveProp(props.$columnEnd), columnEnd => ({
|
|
3605
3512
|
gridColumnEnd: columnEnd
|
|
3606
3513
|
}));
|
|
3607
3514
|
}
|
|
3608
3515
|
|
|
3609
3516
|
function responsiveInputPaddingStyle(props) {
|
|
3610
3517
|
const {
|
|
3611
|
-
$fontSize,
|
|
3612
3518
|
$iconLeft,
|
|
3613
3519
|
$iconRight,
|
|
3614
|
-
$padding,
|
|
3615
|
-
$space,
|
|
3616
3520
|
theme
|
|
3617
3521
|
} = props;
|
|
3618
3522
|
const {
|
|
@@ -3620,26 +3524,29 @@ function responsiveInputPaddingStyle(props) {
|
|
|
3620
3524
|
media,
|
|
3621
3525
|
space: spaceScale
|
|
3622
3526
|
} = theme.sanity;
|
|
3623
|
-
const
|
|
3527
|
+
const padding = getResponsiveProp(props.$padding, [0]);
|
|
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);
|
|
3624
3531
|
const _padding = [];
|
|
3625
3532
|
const _space = [];
|
|
3626
|
-
const
|
|
3533
|
+
const _size = [];
|
|
3627
3534
|
|
|
3628
3535
|
for (let i = 0; i < len; i += 1) {
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3536
|
+
_padding[i] = padding[i] === undefined ? _padding[i - 1] : padding[i];
|
|
3537
|
+
_space[i] = space[i] === undefined ? _space[i - 1] : space[i];
|
|
3538
|
+
_size[i] = size[i] === undefined ? _size[i - 1] : size[i];
|
|
3632
3539
|
}
|
|
3633
3540
|
|
|
3634
|
-
return
|
|
3635
|
-
const
|
|
3636
|
-
const emSize =
|
|
3541
|
+
return responsive(media, _padding, (_, i) => {
|
|
3542
|
+
const fontSize = fonts.text.sizes[_size[i]] || fonts.text.sizes[2];
|
|
3543
|
+
const emSize = fontSize.lineHeight - fontSize.ascenderHeight - fontSize.descenderHeight;
|
|
3637
3544
|
const p = spaceScale[_padding[i]];
|
|
3638
3545
|
const s = spaceScale[_space[i]];
|
|
3639
3546
|
const styles = {
|
|
3640
|
-
paddingTop: rem(p -
|
|
3547
|
+
paddingTop: rem(p - fontSize.ascenderHeight),
|
|
3641
3548
|
paddingRight: rem(p),
|
|
3642
|
-
paddingBottom: rem(p -
|
|
3549
|
+
paddingBottom: rem(p - fontSize.descenderHeight),
|
|
3643
3550
|
paddingLeft: rem(p)
|
|
3644
3551
|
};
|
|
3645
3552
|
if ($iconRight) styles.paddingRight = rem(p + emSize + s);
|
|
@@ -3670,13 +3577,14 @@ function textInputRootStyle() {
|
|
|
3670
3577
|
function textInputBaseStyle(props) {
|
|
3671
3578
|
const {
|
|
3672
3579
|
theme,
|
|
3673
|
-
$scheme,
|
|
3674
|
-
$tone,
|
|
3675
3580
|
$weight
|
|
3676
3581
|
} = props;
|
|
3677
3582
|
const font = theme.sanity.fonts.text;
|
|
3678
3583
|
const color = theme.sanity.color.input;
|
|
3679
3584
|
return css(_t2$n || (_t2$n = _$B`
|
|
3585
|
+
--input-fg-color: ${0};
|
|
3586
|
+
--input-placeholder-color: ${0};
|
|
3587
|
+
|
|
3680
3588
|
appearance: none;
|
|
3681
3589
|
background: none;
|
|
3682
3590
|
border: 0;
|
|
@@ -3690,6 +3598,7 @@ function textInputBaseStyle(props) {
|
|
|
3690
3598
|
position: relative;
|
|
3691
3599
|
z-index: 1;
|
|
3692
3600
|
display: block;
|
|
3601
|
+
color: var(--input-fg-color);
|
|
3693
3602
|
|
|
3694
3603
|
/* NOTE: This is a hack to disable Chrome’s autofill styles */
|
|
3695
3604
|
&:-webkit-autofill,
|
|
@@ -3701,46 +3610,39 @@ function textInputBaseStyle(props) {
|
|
|
3701
3610
|
transition-delay: 86400s /* 24h */;
|
|
3702
3611
|
}
|
|
3703
3612
|
|
|
3613
|
+
&::placeholder {
|
|
3614
|
+
color: var(--input-placeholder-color);
|
|
3615
|
+
}
|
|
3616
|
+
|
|
3704
3617
|
/* &:is(textarea) */
|
|
3705
3618
|
&[data-as='textarea'] {
|
|
3706
3619
|
resize: none;
|
|
3707
3620
|
}
|
|
3708
3621
|
|
|
3709
|
-
|
|
3710
|
-
|
|
3711
|
-
|
|
3712
|
-
|
|
3622
|
+
/* enabled */
|
|
3623
|
+
&:not(:invalid):not(:disabled):not(:read-only) {
|
|
3624
|
+
--input-fg-color: ${0};
|
|
3625
|
+
--input-placeholder-color: ${0};
|
|
3713
3626
|
}
|
|
3714
3627
|
|
|
3715
|
-
|
|
3628
|
+
/* disabled */
|
|
3629
|
+
&:not(:invalid):disabled {
|
|
3716
3630
|
--input-fg-color: ${0};
|
|
3717
3631
|
--input-placeholder-color: ${0};
|
|
3632
|
+
}
|
|
3718
3633
|
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
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
|
-
}
|
|
3634
|
+
/* invalid */
|
|
3635
|
+
&:invalid {
|
|
3636
|
+
--input-fg-color: ${0};
|
|
3637
|
+
--input-placeholder-color: ${0};
|
|
3638
|
+
}
|
|
3736
3639
|
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
|
|
3740
|
-
|
|
3741
|
-
}
|
|
3640
|
+
/* readOnly */
|
|
3641
|
+
&:read-only {
|
|
3642
|
+
--input-fg-color: ${0};
|
|
3643
|
+
--input-placeholder-color: ${0};
|
|
3742
3644
|
}
|
|
3743
|
-
`), font.family, $weight && font.weights[$weight] || font.weights.regular,
|
|
3645
|
+
`), color.default.enabled.fg, color.default.enabled.placeholder, font.family, $weight && font.weights[$weight] || font.weights.regular, 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);
|
|
3744
3646
|
}
|
|
3745
3647
|
function textInputFontSizeStyle(props) {
|
|
3746
3648
|
const {
|
|
@@ -3750,7 +3652,7 @@ function textInputFontSizeStyle(props) {
|
|
|
3750
3652
|
fonts,
|
|
3751
3653
|
media
|
|
3752
3654
|
} = theme.sanity;
|
|
3753
|
-
return
|
|
3655
|
+
return responsive(media, getResponsiveProp(props.$fontSize, [2]), sizeIndex => {
|
|
3754
3656
|
const size = fonts.text.sizes[sizeIndex] || fonts.text.sizes[2];
|
|
3755
3657
|
return {
|
|
3756
3658
|
fontSize: rem(size.fontSize),
|
|
@@ -3763,8 +3665,6 @@ function textInputRepresentationStyle(props) {
|
|
|
3763
3665
|
$border,
|
|
3764
3666
|
$hasPrefix,
|
|
3765
3667
|
$hasSuffix,
|
|
3766
|
-
$scheme,
|
|
3767
|
-
$tone,
|
|
3768
3668
|
theme
|
|
3769
3669
|
} = props;
|
|
3770
3670
|
const {
|
|
@@ -3773,6 +3673,8 @@ function textInputRepresentationStyle(props) {
|
|
|
3773
3673
|
} = theme.sanity;
|
|
3774
3674
|
const color = theme.sanity.color.input;
|
|
3775
3675
|
return css(_t3$e || (_t3$e = _$B`
|
|
3676
|
+
--card-bg-color: ${0};
|
|
3677
|
+
--card-fg-color: ${0};
|
|
3776
3678
|
--input-box-shadow: none;
|
|
3777
3679
|
|
|
3778
3680
|
position: absolute;
|
|
@@ -3783,7 +3685,6 @@ function textInputRepresentationStyle(props) {
|
|
|
3783
3685
|
display: block;
|
|
3784
3686
|
pointer-events: none;
|
|
3785
3687
|
z-index: 0;
|
|
3786
|
-
|
|
3787
3688
|
background-color: var(--card-bg-color);
|
|
3788
3689
|
box-shadow: var(--input-box-shadow);
|
|
3789
3690
|
|
|
@@ -3792,53 +3693,48 @@ function textInputRepresentationStyle(props) {
|
|
|
3792
3693
|
border-top-right-radius: ${0};
|
|
3793
3694
|
border-bottom-right-radius: ${0};
|
|
3794
3695
|
|
|
3795
|
-
|
|
3696
|
+
/* enabled */
|
|
3697
|
+
*:not(:disabled) + && {
|
|
3698
|
+
--input-box-shadow: ${0};
|
|
3699
|
+
}
|
|
3700
|
+
|
|
3701
|
+
/* invalid */
|
|
3702
|
+
*:not(:disabled):invalid + && {
|
|
3796
3703
|
--card-bg-color: ${0};
|
|
3797
3704
|
--card-fg-color: ${0};
|
|
3705
|
+
--input-box-shadow: ${0};
|
|
3706
|
+
}
|
|
3798
3707
|
|
|
3799
|
-
|
|
3800
|
-
|
|
3801
|
-
|
|
3802
|
-
|
|
3708
|
+
/* focused */
|
|
3709
|
+
*:not(:disabled):focus + && {
|
|
3710
|
+
--input-box-shadow: ${0};
|
|
3711
|
+
}
|
|
3712
|
+
|
|
3713
|
+
/* disabled */
|
|
3714
|
+
*:disabled + && {
|
|
3715
|
+
--card-bg-color: ${0};
|
|
3716
|
+
--card-fg-color: ${0};
|
|
3717
|
+
--input-box-shadow: ${0};
|
|
3718
|
+
}
|
|
3803
3719
|
|
|
3804
|
-
|
|
3805
|
-
|
|
3720
|
+
/* hovered */
|
|
3721
|
+
@media (hover: hover) {
|
|
3722
|
+
*:not(:disabled):not(:read-only):not(:invalid):hover + && {
|
|
3806
3723
|
--card-bg-color: ${0};
|
|
3807
3724
|
--card-fg-color: ${0};
|
|
3808
|
-
--input-box-shadow: ${0};
|
|
3809
|
-
}
|
|
3810
|
-
|
|
3811
|
-
/* focused */
|
|
3812
|
-
*:not(:disabled):focus + & {
|
|
3813
|
-
--input-box-shadow: ${0};
|
|
3814
3725
|
}
|
|
3815
3726
|
|
|
3816
|
-
|
|
3817
|
-
*:disabled + & {
|
|
3818
|
-
--card-bg-color: ${0} !important;
|
|
3819
|
-
--card-fg-color: ${0} !important;
|
|
3727
|
+
*:not(:disabled):not(:read-only):not(:invalid):not(:focus):hover + && {
|
|
3820
3728
|
--input-box-shadow: ${0};
|
|
3821
3729
|
}
|
|
3730
|
+
}
|
|
3822
3731
|
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
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
|
-
}
|
|
3732
|
+
/* readOnly */
|
|
3733
|
+
*:read-only + && {
|
|
3734
|
+
--card-bg-color: ${0};
|
|
3735
|
+
--card-fg-color: ${0};
|
|
3840
3736
|
}
|
|
3841
|
-
`), $hasPrefix ? 0 : undefined, $hasPrefix ? 0 : undefined, $hasSuffix ? 0 : undefined, $hasSuffix ? 0 : undefined, $
|
|
3737
|
+
`), color.default.enabled.bg, color.default.enabled.fg, $hasPrefix ? 0 : undefined, $hasPrefix ? 0 : undefined, $hasSuffix ? 0 : undefined, $hasSuffix ? 0 : undefined, $border ? focusRingBorderStyle({
|
|
3842
3738
|
color: color.default.enabled.border,
|
|
3843
3739
|
width: input.border.width
|
|
3844
3740
|
}) : undefined, color.invalid.enabled.bg, color.invalid.enabled.fg, $border ? focusRingBorderStyle({
|
|
@@ -3853,24 +3749,24 @@ function textInputRepresentationStyle(props) {
|
|
|
3853
3749
|
}), color.default.disabled.bg, color.default.disabled.fg, $border ? focusRingBorderStyle({
|
|
3854
3750
|
color: color.default.disabled.border,
|
|
3855
3751
|
width: input.border.width
|
|
3856
|
-
}) : 'none', color.default.
|
|
3752
|
+
}) : 'none', color.default.hovered.bg, color.default.hovered.fg, $border ? focusRingBorderStyle({
|
|
3857
3753
|
color: color.default.hovered.border,
|
|
3858
3754
|
width: input.border.width
|
|
3859
|
-
}) : 'none');
|
|
3755
|
+
}) : 'none', color.default.readOnly.bg, color.default.readOnly.fg);
|
|
3860
3756
|
}
|
|
3861
3757
|
|
|
3862
3758
|
function responsiveMarginStyle(props) {
|
|
3863
3759
|
const {
|
|
3864
3760
|
theme
|
|
3865
3761
|
} = props;
|
|
3866
|
-
return [
|
|
3762
|
+
return [getResponsiveSpace(theme, ['margin'], getResponsiveProp(props.$margin)), getResponsiveSpace(theme, ['marginLeft', 'marginRight'], getResponsiveProp(props.$marginX)), getResponsiveSpace(theme, ['marginTop', 'marginBottom'], getResponsiveProp(props.$marginY)), getResponsiveSpace(theme, ['marginTop'], getResponsiveProp(props.$marginTop)), getResponsiveSpace(theme, ['marginRight'], getResponsiveProp(props.$marginRight)), getResponsiveSpace(theme, ['marginBottom'], getResponsiveProp(props.$marginBottom)), getResponsiveSpace(theme, ['marginLeft'], getResponsiveProp(props.$marginLeft))].filter(Boolean);
|
|
3867
3763
|
}
|
|
3868
3764
|
|
|
3869
3765
|
function responsivePaddingStyle(props) {
|
|
3870
3766
|
const {
|
|
3871
3767
|
theme
|
|
3872
3768
|
} = props;
|
|
3873
|
-
return [
|
|
3769
|
+
return [getResponsiveSpace(theme, ['padding'], getResponsiveProp(props.$padding)), getResponsiveSpace(theme, ['paddingLeft', 'paddingRight'], getResponsiveProp(props.$paddingX)), getResponsiveSpace(theme, ['paddingTop', 'paddingBottom'], getResponsiveProp(props.$paddingY)), getResponsiveSpace(theme, ['paddingTop'], getResponsiveProp(props.$paddingTop)), getResponsiveSpace(theme, ['paddingRight'], getResponsiveProp(props.$paddingRight)), getResponsiveSpace(theme, ['paddingBottom'], getResponsiveProp(props.$paddingBottom)), getResponsiveSpace(theme, ['paddingLeft'], getResponsiveProp(props.$paddingLeft))].filter(Boolean);
|
|
3874
3770
|
}
|
|
3875
3771
|
|
|
3876
3772
|
function responsiveRadiusStyle(props) {
|
|
@@ -3881,7 +3777,7 @@ function responsiveRadiusStyle(props) {
|
|
|
3881
3777
|
media,
|
|
3882
3778
|
radius
|
|
3883
3779
|
} = theme.sanity;
|
|
3884
|
-
return
|
|
3780
|
+
return responsive(media, getResponsiveProp(props.$radius), radiusIndex => ({
|
|
3885
3781
|
borderRadius: rem(radius[radiusIndex])
|
|
3886
3782
|
}));
|
|
3887
3783
|
}
|
|
@@ -3909,7 +3805,7 @@ function responsiveShadowStyle(props) {
|
|
|
3909
3805
|
media,
|
|
3910
3806
|
shadows
|
|
3911
3807
|
} = theme.sanity;
|
|
3912
|
-
return
|
|
3808
|
+
return responsive(media, getResponsiveProp(props.$shadow), shadow => shadowStyle(shadows[shadow]));
|
|
3913
3809
|
}
|
|
3914
3810
|
|
|
3915
3811
|
let _$A = t => t,
|
|
@@ -3974,7 +3870,7 @@ function textBaseStyle(props) {
|
|
|
3974
3870
|
`)), theme.sanity.fonts.code.family, weights.bold);
|
|
3975
3871
|
}
|
|
3976
3872
|
|
|
3977
|
-
const _excluded$
|
|
3873
|
+
const _excluded$H = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
|
|
3978
3874
|
|
|
3979
3875
|
let _$z = t => t,
|
|
3980
3876
|
_t$B;
|
|
@@ -3999,7 +3895,7 @@ const Text = /*#__PURE__*/forwardRef(function Text(props, ref) {
|
|
|
3999
3895
|
textOverflow,
|
|
4000
3896
|
weight
|
|
4001
3897
|
} = props,
|
|
4002
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
3898
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$H);
|
|
4003
3899
|
|
|
4004
3900
|
let children = childrenProp;
|
|
4005
3901
|
|
|
@@ -4011,10 +3907,10 @@ const Text = /*#__PURE__*/forwardRef(function Text(props, ref) {
|
|
|
4011
3907
|
"data-ui": "Text"
|
|
4012
3908
|
}, restProps, {
|
|
4013
3909
|
"$accent": accent,
|
|
4014
|
-
"$align":
|
|
3910
|
+
"$align": align,
|
|
4015
3911
|
"$muted": muted,
|
|
4016
3912
|
ref: ref,
|
|
4017
|
-
"$size":
|
|
3913
|
+
"$size": size,
|
|
4018
3914
|
"$weight": weight
|
|
4019
3915
|
}), /*#__PURE__*/React.createElement("span", null, children));
|
|
4020
3916
|
});
|
|
@@ -4117,7 +4013,7 @@ function responsiveAvatarSizeStyle(props) {
|
|
|
4117
4013
|
avatar,
|
|
4118
4014
|
media
|
|
4119
4015
|
} = theme.sanity;
|
|
4120
|
-
return
|
|
4016
|
+
return responsive(media, props.$size, size => {
|
|
4121
4017
|
const avatarSize = avatar.sizes[size] || avatar.sizes[0];
|
|
4122
4018
|
return {
|
|
4123
4019
|
width: rem(avatarSize.size),
|
|
@@ -4170,7 +4066,7 @@ function avatarStrokeStyle() {
|
|
|
4170
4066
|
};
|
|
4171
4067
|
}
|
|
4172
4068
|
|
|
4173
|
-
const _excluded$
|
|
4069
|
+
const _excluded$G = ["as", "color", "src", "title", "initials", "onImageLoadError", "arrowPosition", "animateArrowFrom", "status", "size"];
|
|
4174
4070
|
const Root$D = styled.div(responsiveAvatarSizeStyle, avatarStyle.root);
|
|
4175
4071
|
const Arrow = styled.div(avatarStyle.arrow);
|
|
4176
4072
|
const BgStroke = styled.ellipse(avatarStyle.bgStroke);
|
|
@@ -4191,12 +4087,12 @@ const Avatar = /*#__PURE__*/forwardRef(function Avatar(props, ref) {
|
|
|
4191
4087
|
arrowPosition: arrowPositionProp,
|
|
4192
4088
|
animateArrowFrom,
|
|
4193
4089
|
status = 'online',
|
|
4194
|
-
size: sizeProp
|
|
4090
|
+
size: sizeProp
|
|
4195
4091
|
} = props,
|
|
4196
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
4092
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$G);
|
|
4197
4093
|
|
|
4198
4094
|
const as = ReactIs.isValidElementType(asProp) ? asProp : 'div';
|
|
4199
|
-
const size =
|
|
4095
|
+
const size = useResponsiveProp(sizeProp, [0]);
|
|
4200
4096
|
const theme = useTheme();
|
|
4201
4097
|
const color = theme.sanity.color.spot[colorKey] || theme.sanity.color.spot.gray; // @todo: remove this
|
|
4202
4098
|
|
|
@@ -4225,7 +4121,6 @@ const Avatar = /*#__PURE__*/forwardRef(function Avatar(props, ref) {
|
|
|
4225
4121
|
onImageLoadError(new Error('Avatar: the image failed to load'));
|
|
4226
4122
|
}
|
|
4227
4123
|
}, [onImageLoadError]);
|
|
4228
|
-
const initialsSize = useMemo(() => size.map(s => s === 0 ? 0 : s + 1), [size]);
|
|
4229
4124
|
return /*#__PURE__*/React.createElement(Root$D, _extends({
|
|
4230
4125
|
as: as,
|
|
4231
4126
|
"data-as": typeof as === 'string' ? as : undefined,
|
|
@@ -4279,14 +4174,14 @@ const Avatar = /*#__PURE__*/forwardRef(function Avatar(props, ref) {
|
|
|
4279
4174
|
vectorEffect: "non-scaling-stroke"
|
|
4280
4175
|
})), (imageFailed || !src) && initials && /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Initials, null, /*#__PURE__*/React.createElement(Text, {
|
|
4281
4176
|
as: "span",
|
|
4282
|
-
size:
|
|
4177
|
+
size: size.map(s => s === 0 ? 0 : s + 1)
|
|
4283
4178
|
}, /*#__PURE__*/React.createElement("strong", null, initials)))));
|
|
4284
4179
|
});
|
|
4285
4180
|
|
|
4286
4181
|
let _$y = t => t,
|
|
4287
4182
|
_t$A;
|
|
4288
4183
|
|
|
4289
|
-
function
|
|
4184
|
+
function responsiveAvatarCounterSizeStyle(props) {
|
|
4290
4185
|
const {
|
|
4291
4186
|
theme
|
|
4292
4187
|
} = props;
|
|
@@ -4294,7 +4189,7 @@ function _responsiveAvatarCounterSizeStyle(props) {
|
|
|
4294
4189
|
avatar,
|
|
4295
4190
|
media
|
|
4296
4191
|
} = theme.sanity;
|
|
4297
|
-
return
|
|
4192
|
+
return responsive(media, props.$size, size => {
|
|
4298
4193
|
const avatarSize = avatar.sizes[size];
|
|
4299
4194
|
if (!avatarSize) return EMPTY_RECORD;
|
|
4300
4195
|
return {
|
|
@@ -4305,7 +4200,7 @@ function _responsiveAvatarCounterSizeStyle(props) {
|
|
|
4305
4200
|
});
|
|
4306
4201
|
}
|
|
4307
4202
|
|
|
4308
|
-
function
|
|
4203
|
+
function avatarCounterBaseStyle(props) {
|
|
4309
4204
|
const {
|
|
4310
4205
|
theme
|
|
4311
4206
|
} = props;
|
|
@@ -4326,7 +4221,7 @@ function _avatarCounterBaseStyle(props) {
|
|
|
4326
4221
|
`), rem(theme.sanity.space[2]));
|
|
4327
4222
|
}
|
|
4328
4223
|
|
|
4329
|
-
const Root$C = styled.div(
|
|
4224
|
+
const Root$C = styled.div(responsiveAvatarCounterSizeStyle, avatarCounterBaseStyle);
|
|
4330
4225
|
/**
|
|
4331
4226
|
* @public
|
|
4332
4227
|
*/
|
|
@@ -4336,15 +4231,13 @@ const AvatarCounter = /*#__PURE__*/forwardRef(function AvatarCounter(props, ref)
|
|
|
4336
4231
|
count,
|
|
4337
4232
|
size: sizeProp = 0
|
|
4338
4233
|
} = props;
|
|
4339
|
-
const size =
|
|
4340
|
-
const counterSize = useMemo(() => size.map(s => s === 0 ? 0 : s + 1), [size]);
|
|
4234
|
+
const size = useResponsiveProp(sizeProp, [0]);
|
|
4341
4235
|
return /*#__PURE__*/React.createElement(Root$C, {
|
|
4342
4236
|
"$size": size,
|
|
4343
|
-
"data-ui": "AvatarCounter",
|
|
4344
4237
|
ref: ref
|
|
4345
4238
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
4346
4239
|
as: "span",
|
|
4347
|
-
size:
|
|
4240
|
+
size: size.map(s => s === 0 ? 0 : s + 1)
|
|
4348
4241
|
}, /*#__PURE__*/React.createElement("strong", null, count)));
|
|
4349
4242
|
});
|
|
4350
4243
|
|
|
@@ -4353,7 +4246,7 @@ function childrenToElementArray(children) {
|
|
|
4353
4246
|
return childrenArray.filter(node => isElement(node) || isFragment(node) || typeof node === 'string');
|
|
4354
4247
|
}
|
|
4355
4248
|
|
|
4356
|
-
const _excluded$
|
|
4249
|
+
const _excluded$F = ["children", "maxLength", "size", "tone"];
|
|
4357
4250
|
|
|
4358
4251
|
let _$x = t => t,
|
|
4359
4252
|
_t$z;
|
|
@@ -4381,7 +4274,7 @@ function responsiveAvatarStackSizeStyle(props) {
|
|
|
4381
4274
|
avatar,
|
|
4382
4275
|
media
|
|
4383
4276
|
} = theme.sanity;
|
|
4384
|
-
return
|
|
4277
|
+
return responsive(media, getResponsiveProp(props.size), size => {
|
|
4385
4278
|
const avatarSize = avatar.sizes[size];
|
|
4386
4279
|
if (!avatarSize) return EMPTY_RECORD;
|
|
4387
4280
|
return {
|
|
@@ -4401,13 +4294,12 @@ const AvatarStack = /*#__PURE__*/forwardRef(function AvatarStack(props, ref) {
|
|
|
4401
4294
|
const {
|
|
4402
4295
|
children: childrenProp,
|
|
4403
4296
|
maxLength: maxLengthProp = 4,
|
|
4404
|
-
size
|
|
4297
|
+
size = 0
|
|
4405
4298
|
} = props,
|
|
4406
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
4299
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$F);
|
|
4407
4300
|
|
|
4408
|
-
const children = childrenToElementArray(childrenProp).filter(child => typeof child !== 'string');
|
|
4409
4301
|
const maxLength = Math.max(maxLengthProp, 0);
|
|
4410
|
-
const
|
|
4302
|
+
const children = childrenToElementArray(childrenProp).filter(child => typeof child !== 'string');
|
|
4411
4303
|
const len = children.length;
|
|
4412
4304
|
const visibleCount = maxLength - 1;
|
|
4413
4305
|
const extraCount = len - visibleCount;
|
|
@@ -4416,7 +4308,7 @@ const AvatarStack = /*#__PURE__*/forwardRef(function AvatarStack(props, ref) {
|
|
|
4416
4308
|
"data-ui": "AvatarStack"
|
|
4417
4309
|
}, restProps, {
|
|
4418
4310
|
ref: ref,
|
|
4419
|
-
|
|
4311
|
+
size: size
|
|
4420
4312
|
}), len === 0 && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(AvatarCounter, {
|
|
4421
4313
|
count: len
|
|
4422
4314
|
})), len !== 0 && extraCount > 1 && /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement(AvatarCounter, {
|
|
@@ -4429,7 +4321,7 @@ const AvatarStack = /*#__PURE__*/forwardRef(function AvatarStack(props, ref) {
|
|
|
4429
4321
|
}))));
|
|
4430
4322
|
});
|
|
4431
4323
|
|
|
4432
|
-
const _excluded$
|
|
4324
|
+
const _excluded$E = ["as", "column", "columnStart", "columnEnd", "display", "flex", "height", "margin", "marginX", "marginY", "marginTop", "marginRight", "marginBottom", "marginLeft", "overflow", "padding", "paddingX", "paddingY", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft", "row", "rowStart", "rowEnd", "sizing"];
|
|
4433
4325
|
const Root$A = styled.div(boxStyle, flexItemStyle, responsiveBoxStyle, responsiveGridItemStyle, responsiveMarginStyle, responsivePaddingStyle);
|
|
4434
4326
|
/**
|
|
4435
4327
|
* @public
|
|
@@ -4464,37 +4356,37 @@ const Box = /*#__PURE__*/forwardRef(function Box(props, ref) {
|
|
|
4464
4356
|
rowEnd,
|
|
4465
4357
|
sizing
|
|
4466
4358
|
} = props,
|
|
4467
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
4359
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$E);
|
|
4468
4360
|
|
|
4469
4361
|
return /*#__PURE__*/React.createElement(Root$A, _extends({
|
|
4470
4362
|
"data-as": typeof asProp === 'string' ? asProp : undefined,
|
|
4471
4363
|
"data-ui": "Box"
|
|
4472
4364
|
}, restProps, {
|
|
4473
|
-
"$column":
|
|
4474
|
-
"$columnStart":
|
|
4475
|
-
"$columnEnd":
|
|
4476
|
-
"$display":
|
|
4477
|
-
"$flex":
|
|
4478
|
-
"$height":
|
|
4479
|
-
"$margin":
|
|
4480
|
-
"$marginX":
|
|
4481
|
-
"$marginY":
|
|
4482
|
-
"$marginTop":
|
|
4483
|
-
"$marginRight":
|
|
4484
|
-
"$marginBottom":
|
|
4485
|
-
"$marginLeft":
|
|
4486
|
-
"$overflow":
|
|
4487
|
-
"$padding":
|
|
4488
|
-
"$paddingX":
|
|
4489
|
-
"$paddingY":
|
|
4490
|
-
"$paddingTop":
|
|
4491
|
-
"$paddingRight":
|
|
4492
|
-
"$paddingBottom":
|
|
4493
|
-
"$paddingLeft":
|
|
4494
|
-
"$row":
|
|
4495
|
-
"$rowStart":
|
|
4496
|
-
"$rowEnd":
|
|
4497
|
-
"$sizing":
|
|
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,
|
|
4498
4390
|
as: asProp,
|
|
4499
4391
|
ref: ref
|
|
4500
4392
|
}), props.children);
|
|
@@ -4540,7 +4432,7 @@ function labelBaseStyle(props) {
|
|
|
4540
4432
|
`)), fonts.code.family);
|
|
4541
4433
|
}
|
|
4542
4434
|
|
|
4543
|
-
const _excluded$
|
|
4435
|
+
const _excluded$D = ["accent", "align", "children", "muted", "size", "textOverflow", "weight"];
|
|
4544
4436
|
|
|
4545
4437
|
let _$v = t => t,
|
|
4546
4438
|
_t$x;
|
|
@@ -4565,7 +4457,7 @@ const Label = /*#__PURE__*/forwardRef(function Label(props, ref) {
|
|
|
4565
4457
|
textOverflow,
|
|
4566
4458
|
weight
|
|
4567
4459
|
} = props,
|
|
4568
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
4460
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$D);
|
|
4569
4461
|
|
|
4570
4462
|
let children = childrenProp;
|
|
4571
4463
|
|
|
@@ -4579,9 +4471,9 @@ const Label = /*#__PURE__*/forwardRef(function Label(props, ref) {
|
|
|
4579
4471
|
"data-ui": "Label"
|
|
4580
4472
|
}, restProps, {
|
|
4581
4473
|
"$accent": accent,
|
|
4582
|
-
"$align":
|
|
4474
|
+
"$align": align,
|
|
4583
4475
|
"$muted": muted,
|
|
4584
|
-
"$size":
|
|
4476
|
+
"$size": size,
|
|
4585
4477
|
"$weight": weight,
|
|
4586
4478
|
ref: ref
|
|
4587
4479
|
}), children);
|
|
@@ -4606,7 +4498,7 @@ function badgeStyle(props) {
|
|
|
4606
4498
|
};
|
|
4607
4499
|
}
|
|
4608
4500
|
|
|
4609
|
-
const _excluded$
|
|
4501
|
+
const _excluded$C = ["children", "fontSize", "mode", "padding", "radius", "tone"];
|
|
4610
4502
|
const Root$y = styled(Box)(responsiveRadiusStyle, badgeStyle);
|
|
4611
4503
|
/**
|
|
4612
4504
|
* @public
|
|
@@ -4621,22 +4513,22 @@ const Badge = /*#__PURE__*/forwardRef(function Badge(props, ref) {
|
|
|
4621
4513
|
radius = 2,
|
|
4622
4514
|
tone = 'default'
|
|
4623
4515
|
} = props,
|
|
4624
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
4516
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$C);
|
|
4625
4517
|
|
|
4626
4518
|
return /*#__PURE__*/React.createElement(Root$y, _extends({
|
|
4627
4519
|
"data-ui": "Badge"
|
|
4628
4520
|
}, restProps, {
|
|
4629
4521
|
"$mode": mode,
|
|
4630
4522
|
"$tone": tone,
|
|
4631
|
-
"$radius":
|
|
4632
|
-
padding:
|
|
4523
|
+
"$radius": radius,
|
|
4524
|
+
padding: padding,
|
|
4633
4525
|
ref: ref
|
|
4634
4526
|
}), /*#__PURE__*/React.createElement(Label, {
|
|
4635
4527
|
size: fontSize
|
|
4636
4528
|
}, children));
|
|
4637
4529
|
});
|
|
4638
4530
|
|
|
4639
|
-
const _excluded$
|
|
4531
|
+
const _excluded$B = ["align", "as", "direction", "gap", "justify", "wrap"];
|
|
4640
4532
|
const Root$x = styled(Box)(flexItemStyle, responsiveFlexStyle);
|
|
4641
4533
|
/**
|
|
4642
4534
|
* @public
|
|
@@ -4651,16 +4543,16 @@ const Flex = /*#__PURE__*/forwardRef(function Flex(props, ref) {
|
|
|
4651
4543
|
justify,
|
|
4652
4544
|
wrap
|
|
4653
4545
|
} = props,
|
|
4654
|
-
restProps = _objectWithoutPropertiesLoose(props, _excluded$
|
|
4546
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$B);
|
|
4655
4547
|
|
|
4656
4548
|
return /*#__PURE__*/React.createElement(Root$x, _extends({
|
|
4657
4549
|
"data-ui": "Flex"
|
|
4658
4550
|
}, restProps, {
|
|
4659
|
-
"$align":
|
|
4660
|
-
"$direction":
|
|
4661
|
-
"$gap":
|
|
4662
|
-
"$justify":
|
|
4663
|
-
"$wrap":
|
|
4551
|
+
"$align": align,
|
|
4552
|
+
"$direction": direction,
|
|
4553
|
+
"$gap": gap,
|
|
4554
|
+
"$justify": justify,
|
|
4555
|
+
"$wrap": wrap,
|
|
4664
4556
|
forwardedAs: as,
|
|
4665
4557
|
ref: ref
|
|
4666
4558
|
}));
|
|
@@ -4670,27 +4562,71 @@ let _$u = t => t,
|
|
|
4670
4562
|
_t$w,
|
|
4671
4563
|
_t2$k;
|
|
4672
4564
|
const rotate$1 = keyframes(_t$w || (_t$w = _$u`
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4565
|
+
from {
|
|
4566
|
+
transform: rotate(0deg);
|
|
4567
|
+
}
|
|
4676
4568
|
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4569
|
+
to {
|
|
4570
|
+
transform: rotate(360deg);
|
|
4571
|
+
}
|
|
4680
4572
|
`));
|
|
4681
|
-
|
|
4682
|
-
|
|
4573
|
+
function spinnerStyle(props) {
|
|
4574
|
+
const {
|
|
4575
|
+
$muted
|
|
4576
|
+
} = props;
|
|
4577
|
+
return css(_t2$k || (_t2$k = _$u`
|
|
4683
4578
|
animation: ${0} 500ms linear infinite;
|
|
4684
|
-
|
|
4685
|
-
`), rotate$1);
|
|
4579
|
+
color: ${0};
|
|
4580
|
+
`), rotate$1, $muted ? 'var(--card-muted-fg-color)' : 'var(--card-fg-color)');
|
|
4581
|
+
}
|
|
4582
|
+
function spinnerSizeStyle(props) {
|
|
4583
|
+
const {
|
|
4584
|
+
$size
|
|
4585
|
+
} = props;
|
|
4586
|
+
const {
|
|
4587
|
+
fonts,
|
|
4588
|
+
media
|
|
4589
|
+
} = props.theme.sanity;
|
|
4590
|
+
return responsive(media, $size, size => {
|
|
4591
|
+
const {
|
|
4592
|
+
ascenderHeight,
|
|
4593
|
+
descenderHeight,
|
|
4594
|
+
lineHeight,
|
|
4595
|
+
iconSize
|
|
4596
|
+
} = fonts.text.sizes[size];
|
|
4597
|
+
const capHeight = lineHeight - ascenderHeight - descenderHeight;
|
|
4598
|
+
return {
|
|
4599
|
+
width: rem(capHeight),
|
|
4600
|
+
height: rem(capHeight),
|
|
4601
|
+
'& > svg': {
|
|
4602
|
+
display: 'block',
|
|
4603
|
+
width: rem(iconSize),
|
|
4604
|
+
height: rem(iconSize),
|
|
4605
|
+
margin: (capHeight - iconSize) / 2
|
|
4606
|
+
}
|
|
4607
|
+
};
|
|
4608
|
+
});
|
|
4609
|
+
}
|
|
4610
|
+
|
|
4611
|
+
const _excluded$A = ["muted", "size"];
|
|
4612
|
+
const Root$w = styled.div(spinnerStyle, spinnerSizeStyle);
|
|
4686
4613
|
/**
|
|
4687
4614
|
* @public
|
|
4688
4615
|
*/
|
|
4689
4616
|
|
|
4690
4617
|
const Spinner = /*#__PURE__*/forwardRef(function Spinner(props, ref) {
|
|
4618
|
+
const {
|
|
4619
|
+
muted,
|
|
4620
|
+
size = 2
|
|
4621
|
+
} = props,
|
|
4622
|
+
restProps = _objectWithoutPropertiesLoose(props, _excluded$A);
|
|
4623
|
+
|
|
4624
|
+
const $size = useMemo(() => Array.isArray(size) ? size : [size], [size]);
|
|
4691
4625
|
return /*#__PURE__*/React.createElement(Root$w, _extends({
|
|
4692
4626
|
"data-ui": "Spinner"
|
|
4693
|
-
},
|
|
4627
|
+
}, restProps, {
|
|
4628
|
+
"$muted": muted,
|
|
4629
|
+
"$size": $size,
|
|
4694
4630
|
ref: ref
|
|
4695
4631
|
}), /*#__PURE__*/React.createElement(SpinnerIcon, null));
|
|
4696
4632
|
});
|
|
@@ -4847,19 +4783,19 @@ const Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
|
|
|
4847
4783
|
fontSize,
|
|
4848
4784
|
icon,
|
|
4849
4785
|
iconRight,
|
|
4850
|
-
justify
|
|
4786
|
+
justify = 'center',
|
|
4851
4787
|
loading,
|
|
4852
4788
|
mode = 'default',
|
|
4853
|
-
padding
|
|
4854
|
-
paddingX
|
|
4855
|
-
paddingY
|
|
4856
|
-
paddingTop
|
|
4857
|
-
paddingBottom
|
|
4858
|
-
paddingLeft
|
|
4859
|
-
paddingRight
|
|
4860
|
-
radius
|
|
4789
|
+
padding = 3,
|
|
4790
|
+
paddingX,
|
|
4791
|
+
paddingY,
|
|
4792
|
+
paddingTop,
|
|
4793
|
+
paddingBottom,
|
|
4794
|
+
paddingLeft,
|
|
4795
|
+
paddingRight,
|
|
4796
|
+
radius = 2,
|
|
4861
4797
|
selected,
|
|
4862
|
-
space
|
|
4798
|
+
space = 3,
|
|
4863
4799
|
text,
|
|
4864
4800
|
textAlign,
|
|
4865
4801
|
tone = 'default',
|
|
@@ -4867,16 +4803,6 @@ const Button = /*#__PURE__*/forwardRef(function Button(props, ref) {
|
|
|
4867
4803
|
} = props,
|
|
4868
4804
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$z);
|
|
4869
4805
|
|
|
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);
|
|
4880
4806
|
const theme = useTheme();
|
|
4881
4807
|
const boxProps = useMemo(() => ({
|
|
4882
4808
|
// flex: 1,
|
|
@@ -5120,15 +5046,15 @@ const Card = /*#__PURE__*/forwardRef(function Card(props, ref) {
|
|
|
5120
5046
|
"data-ui": "Card",
|
|
5121
5047
|
"data-tone": tone
|
|
5122
5048
|
}, restProps, {
|
|
5123
|
-
"$border":
|
|
5124
|
-
"$borderTop":
|
|
5125
|
-
"$borderRight":
|
|
5126
|
-
"$borderBottom":
|
|
5127
|
-
"$borderLeft":
|
|
5049
|
+
"$border": border,
|
|
5050
|
+
"$borderTop": borderTop,
|
|
5051
|
+
"$borderRight": borderRight,
|
|
5052
|
+
"$borderBottom": borderBottom,
|
|
5053
|
+
"$borderLeft": borderLeft,
|
|
5128
5054
|
"$checkered": checkered,
|
|
5129
5055
|
"$focusRing": focusRing,
|
|
5130
|
-
"$radius":
|
|
5131
|
-
"$shadow":
|
|
5056
|
+
"$radius": radius,
|
|
5057
|
+
"$shadow": shadow,
|
|
5132
5058
|
"$tone": tone,
|
|
5133
5059
|
"data-checkered": checkered ? '' : undefined,
|
|
5134
5060
|
"data-pressed": pressed ? '' : undefined,
|
|
@@ -5448,7 +5374,7 @@ const Code = /*#__PURE__*/forwardRef(function Code(props, ref) {
|
|
|
5448
5374
|
return /*#__PURE__*/React.createElement(Root$s, _extends({
|
|
5449
5375
|
"data-ui": "Code"
|
|
5450
5376
|
}, restProps, {
|
|
5451
|
-
"$size":
|
|
5377
|
+
"$size": size,
|
|
5452
5378
|
"$weight": weight,
|
|
5453
5379
|
ref: ref
|
|
5454
5380
|
}), !(language && registered) && /*#__PURE__*/React.createElement("code", null, children), language && registered && /*#__PURE__*/React.createElement(Refractor, {
|
|
@@ -5473,7 +5399,7 @@ function responsiveContainerWidthStyle(props) {
|
|
|
5473
5399
|
container,
|
|
5474
5400
|
media
|
|
5475
5401
|
} = theme.sanity;
|
|
5476
|
-
return
|
|
5402
|
+
return responsive(media, getResponsiveProp(props.$width), val => ({
|
|
5477
5403
|
maxWidth: val === 'auto' ? 'none' : rem(container[val])
|
|
5478
5404
|
}));
|
|
5479
5405
|
}
|
|
@@ -5494,7 +5420,7 @@ const Container = /*#__PURE__*/forwardRef(function Container(props, ref) {
|
|
|
5494
5420
|
return /*#__PURE__*/React.createElement(Root$r, _extends({
|
|
5495
5421
|
"data-ui": "Container"
|
|
5496
5422
|
}, restProps, {
|
|
5497
|
-
"$width":
|
|
5423
|
+
"$width": width,
|
|
5498
5424
|
forwardedAs: as,
|
|
5499
5425
|
ref: ref
|
|
5500
5426
|
}));
|
|
@@ -5525,14 +5451,14 @@ const Grid = /*#__PURE__*/forwardRef(function Grid(props, ref) {
|
|
|
5525
5451
|
"data-as": typeof as === 'string' ? as : undefined,
|
|
5526
5452
|
"data-ui": "Grid"
|
|
5527
5453
|
}, restProps, {
|
|
5528
|
-
"$autoRows":
|
|
5529
|
-
"$autoCols":
|
|
5530
|
-
"$autoFlow":
|
|
5531
|
-
"$columns":
|
|
5532
|
-
"$gap":
|
|
5533
|
-
"$gapX":
|
|
5534
|
-
"$gapY":
|
|
5535
|
-
"$rows":
|
|
5454
|
+
"$autoRows": autoRows,
|
|
5455
|
+
"$autoCols": autoCols,
|
|
5456
|
+
"$autoFlow": autoFlow,
|
|
5457
|
+
"$columns": columns,
|
|
5458
|
+
"$gap": gap,
|
|
5459
|
+
"$gapX": gapX,
|
|
5460
|
+
"$gapY": gapY,
|
|
5461
|
+
"$rows": rows,
|
|
5536
5462
|
forwardedAs: as,
|
|
5537
5463
|
ref: ref
|
|
5538
5464
|
}), children);
|
|
@@ -5626,9 +5552,9 @@ const Heading = /*#__PURE__*/forwardRef(function Heading(props, ref) {
|
|
|
5626
5552
|
"data-ui": "Heading"
|
|
5627
5553
|
}, restProps, {
|
|
5628
5554
|
"$accent": accent,
|
|
5629
|
-
"$align":
|
|
5555
|
+
"$align": align,
|
|
5630
5556
|
"$muted": muted,
|
|
5631
|
-
"$size":
|
|
5557
|
+
"$size": size,
|
|
5632
5558
|
"$weight": weight,
|
|
5633
5559
|
ref: ref
|
|
5634
5560
|
}), /*#__PURE__*/React.createElement("span", null, children));
|
|
@@ -5650,7 +5576,7 @@ function inlineSpaceStyle(props) {
|
|
|
5650
5576
|
const {
|
|
5651
5577
|
theme
|
|
5652
5578
|
} = props;
|
|
5653
|
-
return
|
|
5579
|
+
return responsive(theme.sanity.media, getResponsiveProp(props.$space), spaceIndex => {
|
|
5654
5580
|
const space = rem(theme.sanity.space[spaceIndex]);
|
|
5655
5581
|
return {
|
|
5656
5582
|
margin: `-${space} 0 0 -${space}`,
|
|
@@ -5675,16 +5601,16 @@ const Inline = /*#__PURE__*/forwardRef(function Inline(props, ref) {
|
|
|
5675
5601
|
} = props,
|
|
5676
5602
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$s);
|
|
5677
5603
|
|
|
5678
|
-
const children =
|
|
5679
|
-
key: idx
|
|
5680
|
-
}, child)), [childrenProp]);
|
|
5604
|
+
const children = childrenToElementArray(childrenProp).filter(Boolean);
|
|
5681
5605
|
return /*#__PURE__*/React.createElement(Root$o, _extends({
|
|
5682
5606
|
"data-ui": "Inline"
|
|
5683
5607
|
}, restProps, {
|
|
5684
|
-
"$space":
|
|
5608
|
+
"$space": space,
|
|
5685
5609
|
forwardedAs: as,
|
|
5686
5610
|
ref: ref
|
|
5687
|
-
}), children)
|
|
5611
|
+
}), children.map((child, idx) => /*#__PURE__*/React.createElement("div", {
|
|
5612
|
+
key: idx
|
|
5613
|
+
}, child)));
|
|
5688
5614
|
});
|
|
5689
5615
|
|
|
5690
5616
|
const _excluded$r = ["children", "fontSize", "padding", "radius"];
|
|
@@ -5721,7 +5647,7 @@ const KBD = /*#__PURE__*/forwardRef(function KBD(props, ref) {
|
|
|
5721
5647
|
return /*#__PURE__*/React.createElement(Root$n, _extends({
|
|
5722
5648
|
"data-ui": "KBD"
|
|
5723
5649
|
}, restProps, {
|
|
5724
|
-
"$radius":
|
|
5650
|
+
"$radius": radius,
|
|
5725
5651
|
ref: ref
|
|
5726
5652
|
}), /*#__PURE__*/React.createElement(Box, {
|
|
5727
5653
|
as: "span",
|
|
@@ -5775,6 +5701,12 @@ function useBoundaryElement() {
|
|
|
5775
5701
|
return value || DEFAULT_VALUE;
|
|
5776
5702
|
}
|
|
5777
5703
|
|
|
5704
|
+
/**
|
|
5705
|
+
* @internal
|
|
5706
|
+
*/
|
|
5707
|
+
|
|
5708
|
+
const RO = typeof window !== 'undefined' && window.ResizeObserver ? window.ResizeObserver : ResizeObserver$1;
|
|
5709
|
+
|
|
5778
5710
|
function findMaxBreakpoints(media, width) {
|
|
5779
5711
|
const ret = [];
|
|
5780
5712
|
|
|
@@ -5817,14 +5749,20 @@ const ElementQuery = /*#__PURE__*/forwardRef(function ElementQuery(props, ref) {
|
|
|
5817
5749
|
} = props,
|
|
5818
5750
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$q);
|
|
5819
5751
|
|
|
5752
|
+
const [width, setWidth] = useState(() => window.innerWidth);
|
|
5820
5753
|
const forwardedRef = useForwardedRef(ref);
|
|
5821
5754
|
const [element, setElement] = useState(null);
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5755
|
+
useEffect(() => {
|
|
5756
|
+
if (!element) return;
|
|
5757
|
+
|
|
5758
|
+
const handleResizeEntries = entries => {
|
|
5759
|
+
setWidth(entries[0].contentRect.width);
|
|
5760
|
+
};
|
|
5825
5761
|
|
|
5826
|
-
|
|
5827
|
-
|
|
5762
|
+
const ro = new RO(handleResizeEntries);
|
|
5763
|
+
ro.observe(element);
|
|
5764
|
+
return () => ro.disconnect();
|
|
5765
|
+
}, [element]);
|
|
5828
5766
|
const max = useMemo(() => findMaxBreakpoints(media, width), [media, width]);
|
|
5829
5767
|
const min = useMemo(() => findMinBreakpoints(media, width), [media, width]);
|
|
5830
5768
|
const setRef = useCallback(el => {
|
|
@@ -5917,7 +5855,7 @@ function LayerProvider(props) {
|
|
|
5917
5855
|
zOffset: zOffsetProp = 0
|
|
5918
5856
|
} = props;
|
|
5919
5857
|
const parent = useContext(LayerContext);
|
|
5920
|
-
const zOffset =
|
|
5858
|
+
const zOffset = useResponsiveProp(zOffsetProp);
|
|
5921
5859
|
const maxMediaIndex = zOffset.length - 1;
|
|
5922
5860
|
const mediaIndex = Math.min(useMediaIndex(), maxMediaIndex);
|
|
5923
5861
|
const zIndex = parent ? parent.zIndex + zOffset[mediaIndex] : zOffset[mediaIndex];
|
|
@@ -6362,7 +6300,7 @@ const VirtualList = /*#__PURE__*/forwardRef(function VirtualList(props, ref) {
|
|
|
6362
6300
|
scrollEl.addEventListener('scroll', _handleScroll, {
|
|
6363
6301
|
passive: true
|
|
6364
6302
|
});
|
|
6365
|
-
const ro = new
|
|
6303
|
+
const ro = new ResizeObserver(entries => {
|
|
6366
6304
|
setScrollHeight(entries[0].contentRect.height);
|
|
6367
6305
|
});
|
|
6368
6306
|
ro.observe(scrollEl);
|
|
@@ -6768,7 +6706,7 @@ const Popover = /*#__PURE__*/forwardRef(function Popover(props, ref) {
|
|
|
6768
6706
|
tether,
|
|
6769
6707
|
tetherOffset,
|
|
6770
6708
|
tone = 'inherit',
|
|
6771
|
-
width
|
|
6709
|
+
width = 0,
|
|
6772
6710
|
zOffset = (_theme$sanity$layer = theme.sanity.layer) == null ? void 0 : _theme$sanity$layer.popover.zOffset
|
|
6773
6711
|
} = props,
|
|
6774
6712
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$n);
|
|
@@ -6779,7 +6717,6 @@ const Popover = /*#__PURE__*/forwardRef(function Popover(props, ref) {
|
|
|
6779
6717
|
const [popperElement, setPopperElement] = useState(null);
|
|
6780
6718
|
const [arrowElement, setArrowElement] = useState(null);
|
|
6781
6719
|
const popperReferenceElement = referenceElementProp || referenceElement;
|
|
6782
|
-
const width = useArrayProp(matchReferenceWidth ? 'auto' : widthProp);
|
|
6783
6720
|
const modifiers = usePopoverModifiers({
|
|
6784
6721
|
allowedAutoPlacements,
|
|
6785
6722
|
arrow,
|
|
@@ -6820,21 +6757,13 @@ const Popover = /*#__PURE__*/forwardRef(function Popover(props, ref) {
|
|
|
6820
6757
|
forwardedRef.current = el;
|
|
6821
6758
|
}, [forwardedRef]);
|
|
6822
6759
|
const popoverStyle = useMemo(() => _extends({}, style, styles.popper), [style, styles]);
|
|
6823
|
-
const updateTimeoutRef = useRef(null);
|
|
6824
6760
|
useEffect(() => {
|
|
6825
|
-
if (
|
|
6826
|
-
|
|
6827
|
-
|
|
6828
|
-
|
|
6829
|
-
|
|
6830
|
-
updateTimeoutRef.current = setTimeout(() => {
|
|
6831
|
-
if (forceUpdate) {
|
|
6832
|
-
try {
|
|
6833
|
-
forceUpdate();
|
|
6834
|
-
} catch (_) {// ignore caught error
|
|
6835
|
-
}
|
|
6761
|
+
if (forceUpdate) {
|
|
6762
|
+
try {
|
|
6763
|
+
forceUpdate();
|
|
6764
|
+
} catch (_) {// ignore caught error
|
|
6836
6765
|
}
|
|
6837
|
-
}
|
|
6766
|
+
}
|
|
6838
6767
|
}, [content, forceUpdate, open, popperReferenceElement]);
|
|
6839
6768
|
|
|
6840
6769
|
if (disabled) {
|
|
@@ -6850,13 +6779,13 @@ const Popover = /*#__PURE__*/forwardRef(function Popover(props, ref) {
|
|
|
6850
6779
|
zOffset: zOffset
|
|
6851
6780
|
}, attributes.popper), /*#__PURE__*/React.createElement(PopoverCard, {
|
|
6852
6781
|
"$constrainSize": constrainSize,
|
|
6853
|
-
"$width": width,
|
|
6854
6782
|
"data-ui": "PopoverCard",
|
|
6855
6783
|
padding: padding,
|
|
6856
6784
|
radius: radius,
|
|
6857
6785
|
scheme: scheme,
|
|
6858
6786
|
shadow: shadow,
|
|
6859
|
-
tone: tone
|
|
6787
|
+
tone: tone,
|
|
6788
|
+
width: width
|
|
6860
6789
|
}, arrow && /*#__PURE__*/React.createElement(PopoverArrow, {
|
|
6861
6790
|
ref: setArrowElement,
|
|
6862
6791
|
style: styles.arrow
|
|
@@ -7128,7 +7057,7 @@ function inputTextSizeStyle(props) {
|
|
|
7128
7057
|
const {
|
|
7129
7058
|
sizes
|
|
7130
7059
|
} = theme.sanity.fonts.text;
|
|
7131
|
-
return
|
|
7060
|
+
return responsive(theme.sanity.media, getResponsiveProp($fontSize), sizeIndex => textSize(sizes[sizeIndex] || sizes[2]));
|
|
7132
7061
|
}
|
|
7133
7062
|
|
|
7134
7063
|
function inputStyle() {
|
|
@@ -7203,10 +7132,10 @@ const Select = /*#__PURE__*/forwardRef(function Select(props, forwardedRef) {
|
|
|
7203
7132
|
"data-read-only": !disabled && readOnly ? '' : undefined,
|
|
7204
7133
|
"data-ui": "Select"
|
|
7205
7134
|
}, restProps, {
|
|
7206
|
-
"$fontSize":
|
|
7207
|
-
"$padding":
|
|
7208
|
-
"$radius":
|
|
7209
|
-
"$space":
|
|
7135
|
+
"$fontSize": fontSize,
|
|
7136
|
+
"$padding": padding,
|
|
7137
|
+
"$radius": radius,
|
|
7138
|
+
"$space": space,
|
|
7210
7139
|
disabled: disabled || readOnly,
|
|
7211
7140
|
ref: ref
|
|
7212
7141
|
}), children), /*#__PURE__*/React.createElement(IconBox, {
|
|
@@ -7237,7 +7166,7 @@ function responsiveStackSpaceStyle(props) {
|
|
|
7237
7166
|
media,
|
|
7238
7167
|
space
|
|
7239
7168
|
} = theme.sanity;
|
|
7240
|
-
return
|
|
7169
|
+
return responsive(media, getResponsiveProp(props.$space), spaceIndex => ({
|
|
7241
7170
|
gridGap: rem(space[spaceIndex])
|
|
7242
7171
|
}));
|
|
7243
7172
|
}
|
|
@@ -7259,7 +7188,7 @@ const Stack = /*#__PURE__*/forwardRef(function Stack(props, ref) {
|
|
|
7259
7188
|
"data-as": typeof as === 'string' ? as : undefined,
|
|
7260
7189
|
"data-ui": "Stack"
|
|
7261
7190
|
}, restProps, {
|
|
7262
|
-
"$space":
|
|
7191
|
+
"$space": space,
|
|
7263
7192
|
forwardedAs: as,
|
|
7264
7193
|
ref: ref
|
|
7265
7194
|
}));
|
|
@@ -7271,7 +7200,7 @@ let _$f = t => t,
|
|
|
7271
7200
|
_t3$6,
|
|
7272
7201
|
_t4$4,
|
|
7273
7202
|
_t5$3,
|
|
7274
|
-
_t6$
|
|
7203
|
+
_t6$1,
|
|
7275
7204
|
_t7;
|
|
7276
7205
|
/* Root */
|
|
7277
7206
|
|
|
@@ -7436,7 +7365,7 @@ function switchThumbStyles(props) {
|
|
|
7436
7365
|
${0}
|
|
7437
7366
|
|
|
7438
7367
|
${0}
|
|
7439
|
-
`), rem(trackPadding), rem(trackPadding), rem(size), rem(size), rem(size / 2), input.switch.transitionDurationMs, input.switch.transitionTimingFunction, checked && css(_t6$
|
|
7368
|
+
`), rem(trackPadding), rem(trackPadding), rem(size), rem(size), rem(size / 2), input.switch.transitionDurationMs, input.switch.transitionTimingFunction, checked && css(_t6$1 || (_t6$1 = _$f`
|
|
7440
7369
|
transform: translate3d(${0}px, 0, 0);
|
|
7441
7370
|
`), checkedOffset), $indeterminate && css(_t7 || (_t7 = _$f`
|
|
7442
7371
|
transform: translate3d(${0}px, 0, 0);
|
|
@@ -7491,7 +7420,7 @@ const Switch = /*#__PURE__*/forwardRef(function Switch(props, forwardedRef) {
|
|
|
7491
7420
|
})));
|
|
7492
7421
|
});
|
|
7493
7422
|
|
|
7494
|
-
const _excluded$i = ["border", "customValidity", "disabled", "fontSize", "padding", "radius"
|
|
7423
|
+
const _excluded$i = ["border", "customValidity", "disabled", "fontSize", "padding", "radius"];
|
|
7495
7424
|
|
|
7496
7425
|
let _$e = t => t,
|
|
7497
7426
|
_t$f;
|
|
@@ -7515,54 +7444,39 @@ const TextArea = /*#__PURE__*/forwardRef(function TextArea(props, forwardedRef)
|
|
|
7515
7444
|
disabled = false,
|
|
7516
7445
|
fontSize = 2,
|
|
7517
7446
|
padding = 3,
|
|
7518
|
-
radius = 1
|
|
7519
|
-
weight
|
|
7447
|
+
radius = 1
|
|
7520
7448
|
} = props,
|
|
7521
7449
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$i);
|
|
7522
7450
|
|
|
7523
7451
|
const ref = useForwardedRef(forwardedRef);
|
|
7524
|
-
const rootTheme = useRootTheme();
|
|
7525
7452
|
useCustomValidity(ref, customValidity);
|
|
7526
7453
|
return /*#__PURE__*/React.createElement(Root$d, {
|
|
7527
7454
|
"data-ui": "TextArea"
|
|
7528
7455
|
}, /*#__PURE__*/React.createElement(InputRoot$1, null, /*#__PURE__*/React.createElement(Input$1, _extends({
|
|
7529
|
-
"data-as": "textarea"
|
|
7530
|
-
"data-scheme": rootTheme.scheme,
|
|
7531
|
-
"data-tone": rootTheme.tone
|
|
7456
|
+
"data-as": "textarea"
|
|
7532
7457
|
}, restProps, {
|
|
7533
|
-
"$fontSize":
|
|
7534
|
-
"$padding":
|
|
7535
|
-
"$scheme": rootTheme.scheme,
|
|
7536
|
-
"$space": useArrayProp(0),
|
|
7537
|
-
"$tone": rootTheme.tone,
|
|
7538
|
-
"$weight": weight,
|
|
7458
|
+
"$fontSize": fontSize,
|
|
7459
|
+
"$padding": padding,
|
|
7539
7460
|
disabled: disabled,
|
|
7540
7461
|
ref: ref
|
|
7541
7462
|
})), /*#__PURE__*/React.createElement(Presentation$1, {
|
|
7542
7463
|
"$border": border,
|
|
7543
|
-
"$radius":
|
|
7544
|
-
"$scheme": rootTheme.scheme,
|
|
7545
|
-
"$tone": rootTheme.tone,
|
|
7546
|
-
"data-scheme": rootTheme.scheme,
|
|
7547
|
-
"data-tone": rootTheme.tone
|
|
7464
|
+
"$radius": radius
|
|
7548
7465
|
})));
|
|
7549
7466
|
});
|
|
7550
7467
|
|
|
7551
|
-
const _excluded$h = ["border", "clearButton", "disabled", "fontSize", "icon", "iconRight", "onClear", "padding", "prefix", "radius", "readOnly", "space", "suffix", "customValidity", "type"
|
|
7468
|
+
const _excluded$h = ["border", "clearButton", "disabled", "fontSize", "icon", "iconRight", "onClear", "padding", "prefix", "radius", "readOnly", "space", "suffix", "customValidity", "type"];
|
|
7552
7469
|
|
|
7553
7470
|
let _$d = t => t,
|
|
7554
7471
|
_t$e,
|
|
7555
7472
|
_t2$a,
|
|
7556
7473
|
_t3$5,
|
|
7557
7474
|
_t4$3,
|
|
7558
|
-
_t5$2
|
|
7559
|
-
_t6$1;
|
|
7475
|
+
_t5$2;
|
|
7560
7476
|
const CLEAR_BUTTON_BOX_STYLE = {
|
|
7561
7477
|
zIndex: 2
|
|
7562
7478
|
};
|
|
7563
|
-
const Root$c = styled(
|
|
7564
|
-
forwardedAs: 'span'
|
|
7565
|
-
})(textInputRootStyle);
|
|
7479
|
+
const Root$c = styled.span(textInputRootStyle);
|
|
7566
7480
|
const InputRoot = styled.span(_t$e || (_t$e = _$d`
|
|
7567
7481
|
flex: 1;
|
|
7568
7482
|
min-width: 0;
|
|
@@ -7598,12 +7512,7 @@ const LeftBox = styled(Box)(_t4$3 || (_t4$3 = _$d`
|
|
|
7598
7512
|
top: 0;
|
|
7599
7513
|
left: 0;
|
|
7600
7514
|
`));
|
|
7601
|
-
const
|
|
7602
|
-
position: absolute;
|
|
7603
|
-
top: 0;
|
|
7604
|
-
right: 0;
|
|
7605
|
-
`));
|
|
7606
|
-
const RightCard = styled(Card)(_t6$1 || (_t6$1 = _$d`
|
|
7515
|
+
const RightCard = styled(Card)(_t5$2 || (_t5$2 = _$d`
|
|
7607
7516
|
background-color: transparent;
|
|
7608
7517
|
position: absolute;
|
|
7609
7518
|
top: 0;
|
|
@@ -7618,7 +7527,7 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
|
|
|
7618
7527
|
border = true,
|
|
7619
7528
|
clearButton,
|
|
7620
7529
|
disabled = false,
|
|
7621
|
-
fontSize
|
|
7530
|
+
fontSize = 2,
|
|
7622
7531
|
icon,
|
|
7623
7532
|
iconRight,
|
|
7624
7533
|
onClear,
|
|
@@ -7626,20 +7535,16 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
|
|
|
7626
7535
|
prefix,
|
|
7627
7536
|
radius: radiusProp = 1,
|
|
7628
7537
|
readOnly,
|
|
7629
|
-
space
|
|
7538
|
+
space = 3,
|
|
7630
7539
|
suffix,
|
|
7631
7540
|
customValidity,
|
|
7632
|
-
type = 'text'
|
|
7633
|
-
weight
|
|
7541
|
+
type = 'text'
|
|
7634
7542
|
} = props,
|
|
7635
7543
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$h);
|
|
7636
7544
|
|
|
7637
7545
|
const ref = useForwardedRef(forwardedRef);
|
|
7638
|
-
const
|
|
7639
|
-
const
|
|
7640
|
-
const padding = useArrayProp(paddingProp);
|
|
7641
|
-
const radius = useArrayProp(radiusProp);
|
|
7642
|
-
const space = useArrayProp(spaceProp); // Transient properties
|
|
7546
|
+
const padding = useResponsiveProp(paddingProp);
|
|
7547
|
+
const radius = useResponsiveProp(radiusProp); // Transient properties
|
|
7643
7548
|
|
|
7644
7549
|
const $hasClearButton = Boolean(clearButton);
|
|
7645
7550
|
const $hasIcon = Boolean(icon);
|
|
@@ -7675,20 +7580,16 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
|
|
|
7675
7580
|
"$border": border,
|
|
7676
7581
|
"$hasPrefix": $hasPrefix,
|
|
7677
7582
|
"$hasSuffix": $hasSuffix,
|
|
7678
|
-
"$radius": radius
|
|
7679
|
-
"$scheme": rootTheme.scheme,
|
|
7680
|
-
"$tone": rootTheme.tone,
|
|
7681
|
-
"data-scheme": rootTheme.scheme,
|
|
7682
|
-
"data-tone": rootTheme.tone
|
|
7583
|
+
"$radius": radius
|
|
7683
7584
|
}, icon && /*#__PURE__*/React.createElement(LeftBox, {
|
|
7684
7585
|
padding: padding
|
|
7685
7586
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
7686
7587
|
size: fontSize
|
|
7687
|
-
}, /*#__PURE__*/isValidElement(icon) && icon, isValidElementType(icon) && /*#__PURE__*/createElement(icon))), !$hasClearButton && iconRight && /*#__PURE__*/React.createElement(
|
|
7588
|
+
}, /*#__PURE__*/isValidElement(icon) && icon, isValidElementType(icon) && /*#__PURE__*/createElement(icon))), !$hasClearButton && iconRight && /*#__PURE__*/React.createElement(RightCard, {
|
|
7688
7589
|
padding: padding
|
|
7689
7590
|
}, /*#__PURE__*/React.createElement(Text, {
|
|
7690
7591
|
size: fontSize
|
|
7691
|
-
}, /*#__PURE__*/isValidElement(iconRight) && iconRight, isValidElementType(iconRight) && /*#__PURE__*/createElement(iconRight)))), [border, fontSize, icon, iconRight, padding, radius,
|
|
7592
|
+
}, /*#__PURE__*/isValidElement(iconRight) && iconRight, isValidElementType(iconRight) && /*#__PURE__*/createElement(iconRight)))), [border, fontSize, icon, iconRight, padding, radius, $hasClearButton, $hasPrefix, $hasSuffix]); // Render clear button (memoized)
|
|
7692
7593
|
|
|
7693
7594
|
const clearButtonBoxPadding = useMemo(() => padding.map(v => {
|
|
7694
7595
|
if (v === 0) return 0;
|
|
@@ -7729,21 +7630,15 @@ const TextInput = /*#__PURE__*/forwardRef(function TextInput(props, forwardedRef
|
|
|
7729
7630
|
tone: "inherit"
|
|
7730
7631
|
}, /*#__PURE__*/React.createElement("span", null, suffix)), [radius, suffix]);
|
|
7731
7632
|
return /*#__PURE__*/React.createElement(Root$c, {
|
|
7732
|
-
"data-ui": "TextInput"
|
|
7733
|
-
tone: rootTheme.tone
|
|
7633
|
+
"data-ui": "TextInput"
|
|
7734
7634
|
}, prefixNode, /*#__PURE__*/React.createElement(InputRoot, null, /*#__PURE__*/React.createElement(Input, _extends({
|
|
7735
|
-
"data-as": "input"
|
|
7736
|
-
"data-scheme": rootTheme.scheme,
|
|
7737
|
-
"data-tone": rootTheme.tone
|
|
7635
|
+
"data-as": "input"
|
|
7738
7636
|
}, restProps, {
|
|
7739
|
-
"$fontSize": fontSize,
|
|
7740
7637
|
"$iconLeft": $hasIcon,
|
|
7741
7638
|
"$iconRight": $hasIconRight || $hasClearButton,
|
|
7742
7639
|
"$padding": padding,
|
|
7743
|
-
"$scheme": rootTheme.scheme,
|
|
7744
7640
|
"$space": space,
|
|
7745
|
-
"$
|
|
7746
|
-
"$weight": weight,
|
|
7641
|
+
"$fontSize": fontSize,
|
|
7747
7642
|
disabled: disabled,
|
|
7748
7643
|
readOnly: readOnly,
|
|
7749
7644
|
ref: ref,
|
|
@@ -7845,7 +7740,7 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
|
|
|
7845
7740
|
children,
|
|
7846
7741
|
content,
|
|
7847
7742
|
disabled,
|
|
7848
|
-
fallbackPlacements
|
|
7743
|
+
fallbackPlacements,
|
|
7849
7744
|
placement = 'bottom',
|
|
7850
7745
|
portal,
|
|
7851
7746
|
scheme,
|
|
@@ -7853,7 +7748,6 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
|
|
|
7853
7748
|
} = props,
|
|
7854
7749
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$g);
|
|
7855
7750
|
|
|
7856
|
-
const fallbackPlacements = useArrayProp(fallbackPlacementsProp);
|
|
7857
7751
|
const forwardedRef = useForwardedRef(ref);
|
|
7858
7752
|
const [referenceElement, setReferenceElement] = useState(null);
|
|
7859
7753
|
const [popperElement, setPopperElement] = useState(null);
|
|
@@ -7915,21 +7809,13 @@ const Tooltip = /*#__PURE__*/forwardRef(function Tooltip(props, ref) {
|
|
|
7915
7809
|
window.removeEventListener('mousemove', handleWindowMouseMove);
|
|
7916
7810
|
};
|
|
7917
7811
|
}, [isOpen, referenceElement]);
|
|
7918
|
-
const updateTimeoutRef = useRef(null);
|
|
7919
7812
|
useEffect(() => {
|
|
7920
|
-
if (
|
|
7921
|
-
|
|
7922
|
-
|
|
7923
|
-
|
|
7924
|
-
|
|
7925
|
-
updateTimeoutRef.current = setTimeout(() => {
|
|
7926
|
-
if (forceUpdate) {
|
|
7927
|
-
try {
|
|
7928
|
-
forceUpdate();
|
|
7929
|
-
} catch (_) {// ignore caught error
|
|
7930
|
-
}
|
|
7813
|
+
if (forceUpdate) {
|
|
7814
|
+
try {
|
|
7815
|
+
forceUpdate();
|
|
7816
|
+
} catch (_) {// ignore caught error
|
|
7931
7817
|
}
|
|
7932
|
-
}
|
|
7818
|
+
}
|
|
7933
7819
|
}, [forceUpdate, content]); // Close when `disabled` changes to `true`
|
|
7934
7820
|
|
|
7935
7821
|
useEffect(() => {
|
|
@@ -8227,7 +8113,7 @@ const InnerAutocomplete = /*#__PURE__*/forwardRef(function InnerAutocomplete(pro
|
|
|
8227
8113
|
const popoverMouseWithinRef = useRef(false);
|
|
8228
8114
|
const listBoxId = `${id}-listbox`;
|
|
8229
8115
|
const options = Array.isArray(optionsProp) ? optionsProp : EMPTY_ARRAY;
|
|
8230
|
-
const padding =
|
|
8116
|
+
const padding = useResponsiveProp(paddingProp);
|
|
8231
8117
|
const currentOption = useMemo(() => value !== null ? options.find(o => o.value === value) : undefined, [options, value]);
|
|
8232
8118
|
const filteredOptions = useMemo(() => options.filter(option => query ? filterOption(query, option) : true), [filterOption, options, query]);
|
|
8233
8119
|
const filteredOptionsLen = filteredOptions.length;
|
|
@@ -8645,11 +8531,10 @@ const Breadcrumbs = /*#__PURE__*/forwardRef(function Breadcrumbs(props, ref) {
|
|
|
8645
8531
|
children,
|
|
8646
8532
|
maxLength,
|
|
8647
8533
|
separator,
|
|
8648
|
-
space
|
|
8534
|
+
space = 2
|
|
8649
8535
|
} = props,
|
|
8650
8536
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$e);
|
|
8651
8537
|
|
|
8652
|
-
const space = useArrayProp(spaceRaw);
|
|
8653
8538
|
const [open, setOpen] = useState(false);
|
|
8654
8539
|
const [expandElement, setExpandElement] = useState(null);
|
|
8655
8540
|
const [popoverElement, setPopoverElement] = useState(null);
|
|
@@ -8723,7 +8608,7 @@ function dialogStyle({
|
|
|
8723
8608
|
alignItems: 'center',
|
|
8724
8609
|
justifyContent: 'center',
|
|
8725
8610
|
outline: 'none',
|
|
8726
|
-
background: color.shadow.
|
|
8611
|
+
background: color.shadow.penumbra
|
|
8727
8612
|
};
|
|
8728
8613
|
}
|
|
8729
8614
|
function responsiveDialogPositionStyle(props) {
|
|
@@ -8733,7 +8618,7 @@ function responsiveDialogPositionStyle(props) {
|
|
|
8733
8618
|
const {
|
|
8734
8619
|
media
|
|
8735
8620
|
} = theme.sanity;
|
|
8736
|
-
return
|
|
8621
|
+
return responsive(media, getResponsiveProp(props.$position), position => ({
|
|
8737
8622
|
'&&': {
|
|
8738
8623
|
position
|
|
8739
8624
|
}
|
|
@@ -8829,14 +8714,11 @@ const DialogCard = /*#__PURE__*/forwardRef(function DialogCard(props, ref) {
|
|
|
8829
8714
|
id,
|
|
8830
8715
|
onClickOutside,
|
|
8831
8716
|
onClose,
|
|
8832
|
-
radius
|
|
8717
|
+
radius,
|
|
8833
8718
|
scheme,
|
|
8834
|
-
shadow
|
|
8835
|
-
width
|
|
8719
|
+
shadow,
|
|
8720
|
+
width
|
|
8836
8721
|
} = props;
|
|
8837
|
-
const radius = useArrayProp(radiusProp);
|
|
8838
|
-
const shadow = useArrayProp(shadowProp);
|
|
8839
|
-
const width = useArrayProp(widthProp);
|
|
8840
8722
|
const forwardedRef = useForwardedRef(ref);
|
|
8841
8723
|
const [rootElement, setRootElement] = useState(null);
|
|
8842
8724
|
const localContentRef = useRef(null);
|
|
@@ -8919,7 +8801,7 @@ const Dialog = /*#__PURE__*/forwardRef(function Dialog(props, ref) {
|
|
|
8919
8801
|
const {
|
|
8920
8802
|
__unstable_autoFocus: autoFocus = true,
|
|
8921
8803
|
__unstable_hideCloseButton: hideCloseButton = false,
|
|
8922
|
-
cardRadius
|
|
8804
|
+
cardRadius = 3,
|
|
8923
8805
|
cardShadow = 4,
|
|
8924
8806
|
children,
|
|
8925
8807
|
contentRef,
|
|
@@ -8928,20 +8810,15 @@ const Dialog = /*#__PURE__*/forwardRef(function Dialog(props, ref) {
|
|
|
8928
8810
|
id,
|
|
8929
8811
|
onClickOutside,
|
|
8930
8812
|
onClose,
|
|
8931
|
-
padding
|
|
8813
|
+
padding = 4,
|
|
8932
8814
|
portal,
|
|
8933
|
-
position
|
|
8815
|
+
position = dialog.position || 'fixed',
|
|
8934
8816
|
scheme,
|
|
8935
|
-
width
|
|
8936
|
-
zOffset
|
|
8817
|
+
width = 0,
|
|
8818
|
+
zOffset = dialog.zOffset || ((_theme$sanity$layer = theme.sanity.layer) == null ? void 0 : _theme$sanity$layer.dialog.zOffset)
|
|
8937
8819
|
} = props,
|
|
8938
8820
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$d);
|
|
8939
8821
|
|
|
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);
|
|
8945
8822
|
const preDivRef = useRef(null);
|
|
8946
8823
|
const postDivRef = useRef(null);
|
|
8947
8824
|
const cardRef = useRef(null);
|
|
@@ -9047,12 +8924,10 @@ const Hotkeys = /*#__PURE__*/forwardRef(function Hotkeys(props, ref) {
|
|
|
9047
8924
|
keys,
|
|
9048
8925
|
padding,
|
|
9049
8926
|
radius,
|
|
9050
|
-
space
|
|
8927
|
+
space = 1
|
|
9051
8928
|
} = props,
|
|
9052
8929
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$c);
|
|
9053
8930
|
|
|
9054
|
-
const space = useArrayProp(spaceProp);
|
|
9055
|
-
|
|
9056
8931
|
if (!keys || keys.length === 0) {
|
|
9057
8932
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
9058
8933
|
}
|
|
@@ -9712,7 +9587,7 @@ function selectableColorStyle(props) {
|
|
|
9712
9587
|
* @internal
|
|
9713
9588
|
*/
|
|
9714
9589
|
|
|
9715
|
-
const Selectable = styled(Box)(responsiveRadiusStyle, selectableBaseStyle, selectableColorStyle);
|
|
9590
|
+
const Selectable = styled(Box)(responsiveBorderStyle, responsiveRadiusStyle, selectableBaseStyle, selectableColorStyle);
|
|
9716
9591
|
|
|
9717
9592
|
function useMenu() {
|
|
9718
9593
|
const value = useContext(MenuContext);
|
|
@@ -9744,7 +9619,7 @@ function MenuGroup(props) {
|
|
|
9744
9619
|
icon,
|
|
9745
9620
|
onClick,
|
|
9746
9621
|
padding = 3,
|
|
9747
|
-
popover,
|
|
9622
|
+
popover = {},
|
|
9748
9623
|
radius = 2,
|
|
9749
9624
|
space = 3,
|
|
9750
9625
|
text,
|
|
@@ -9842,7 +9717,7 @@ function MenuGroup(props) {
|
|
|
9842
9717
|
"aria-pressed": as === 'button' ? withinMenu : undefined,
|
|
9843
9718
|
"data-pressed": as !== 'button' ? withinMenu : undefined,
|
|
9844
9719
|
"data-selected": !withinMenu && active ? '' : undefined,
|
|
9845
|
-
"$radius":
|
|
9720
|
+
"$radius": radius,
|
|
9846
9721
|
"$tone": tone,
|
|
9847
9722
|
onClick: handleClick,
|
|
9848
9723
|
onKeyDown: handleKeyDown,
|
|
@@ -9936,13 +9811,13 @@ const MenuItem = /*#__PURE__*/forwardRef(function MenuItem(props, forwardedRef)
|
|
|
9936
9811
|
"data-selected": active ? '' : undefined,
|
|
9937
9812
|
"data-disabled": disabled ? '' : undefined,
|
|
9938
9813
|
forwardedAs: as,
|
|
9939
|
-
"$radius":
|
|
9940
|
-
"$padding": useArrayProp(0),
|
|
9814
|
+
"$radius": radius,
|
|
9941
9815
|
"$tone": tone,
|
|
9942
9816
|
disabled: disabled,
|
|
9943
9817
|
onClick: handleClick,
|
|
9944
9818
|
onMouseEnter: onItemMouseEnter,
|
|
9945
9819
|
onMouseLeave: onItemMouseLeave,
|
|
9820
|
+
padding: 0,
|
|
9946
9821
|
ref: setRef,
|
|
9947
9822
|
role: "menuitem",
|
|
9948
9823
|
tabIndex: -1,
|
|
@@ -10060,7 +9935,7 @@ const Skeleton = /*#__PURE__*/forwardRef(function Skeleton(props, ref) {
|
|
|
10060
9935
|
}, [delay]);
|
|
10061
9936
|
return /*#__PURE__*/React.createElement(Root$4, _extends({}, restProps, {
|
|
10062
9937
|
"$animated": animated,
|
|
10063
|
-
"$radius":
|
|
9938
|
+
"$radius": radius,
|
|
10064
9939
|
"$visible": visible,
|
|
10065
9940
|
ref: ref
|
|
10066
9941
|
}));
|
|
@@ -10079,15 +9954,13 @@ const Root$3 = styled(Skeleton)(({
|
|
|
10079
9954
|
media
|
|
10080
9955
|
} = theme.sanity;
|
|
10081
9956
|
const font = theme.sanity.fonts[$style];
|
|
10082
|
-
|
|
10083
|
-
const styles = _responsive(media, $size, sizeIndex => {
|
|
9957
|
+
const styles = responsive(media, $size, sizeIndex => {
|
|
10084
9958
|
const fontSize = font.sizes[sizeIndex];
|
|
10085
9959
|
const capHeight = fontSize.lineHeight - fontSize.ascenderHeight - fontSize.descenderHeight;
|
|
10086
9960
|
return {
|
|
10087
9961
|
height: capHeight
|
|
10088
9962
|
};
|
|
10089
9963
|
});
|
|
10090
|
-
|
|
10091
9964
|
return styles;
|
|
10092
9965
|
});
|
|
10093
9966
|
/**
|
|
@@ -10101,7 +9974,7 @@ const TextSkeleton = /*#__PURE__*/forwardRef(function TextSkeleton(props, ref) {
|
|
|
10101
9974
|
} = props,
|
|
10102
9975
|
restProps = _objectWithoutPropertiesLoose(props, _excluded$7);
|
|
10103
9976
|
|
|
10104
|
-
const $size =
|
|
9977
|
+
const $size = useResponsiveProp(size);
|
|
10105
9978
|
return /*#__PURE__*/React.createElement(Root$3, _extends({}, restProps, {
|
|
10106
9979
|
"$size": $size,
|
|
10107
9980
|
ref: ref,
|
|
@@ -10119,7 +9992,7 @@ const LabelSkeleton = /*#__PURE__*/forwardRef(function TextSkeleton(props, ref)
|
|
|
10119
9992
|
} = props,
|
|
10120
9993
|
restProps = _objectWithoutPropertiesLoose(props, _excluded2);
|
|
10121
9994
|
|
|
10122
|
-
const $size =
|
|
9995
|
+
const $size = useResponsiveProp(size);
|
|
10123
9996
|
return /*#__PURE__*/React.createElement(Root$3, _extends({}, restProps, {
|
|
10124
9997
|
"$size": $size,
|
|
10125
9998
|
ref: ref,
|
|
@@ -10137,7 +10010,7 @@ const HeadingSkeleton = /*#__PURE__*/forwardRef(function TextSkeleton(props, ref
|
|
|
10137
10010
|
} = props,
|
|
10138
10011
|
restProps = _objectWithoutPropertiesLoose(props, _excluded3);
|
|
10139
10012
|
|
|
10140
|
-
const $size =
|
|
10013
|
+
const $size = useResponsiveProp(size);
|
|
10141
10014
|
return /*#__PURE__*/React.createElement(Root$3, _extends({}, restProps, {
|
|
10142
10015
|
"$size": $size,
|
|
10143
10016
|
ref: ref,
|
|
@@ -10155,7 +10028,7 @@ const CodeSkeleton = /*#__PURE__*/forwardRef(function TextSkeleton(props, ref) {
|
|
|
10155
10028
|
} = props,
|
|
10156
10029
|
restProps = _objectWithoutPropertiesLoose(props, _excluded4);
|
|
10157
10030
|
|
|
10158
|
-
const $size =
|
|
10031
|
+
const $size = useResponsiveProp(size);
|
|
10159
10032
|
return /*#__PURE__*/React.createElement(Root$3, _extends({}, restProps, {
|
|
10160
10033
|
"$size": $size,
|
|
10161
10034
|
ref: ref,
|
|
@@ -11107,5 +10980,5 @@ const TreeItem = /*#__PURE__*/memo(function TreeItem(props) {
|
|
|
11107
10980
|
}, children)));
|
|
11108
10981
|
});
|
|
11109
10982
|
|
|
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,
|
|
10983
|
+
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, RO as ResizeObserver, Select, Skeleton, Spinner, SrOnly, Stack, Switch, Tab, TabList, TabPanel, Text, TextArea, TextInput, TextSkeleton, ThemeColorProvider, ThemeProvider, Toast, ToastProvider, Tooltip, Tree, TreeItem, VirtualList, _hasFocus, _isEnterToClickElement, _isScrollable, _raf, _raf2, attemptFocus, createColorTheme, fillCSSObject, focusFirstDescendant, focusLastDescendant, getResponsiveProp, getResponsiveSpace, hexToRgb, hslToRgb, isFocusable, isHTMLAnchorElement, isHTMLButtonElement, isHTMLElement, isHTMLInputElement, isHTMLSelectElement, isHTMLTextAreaElement, multiply$1 as multiply, parseColor, rem, responsive, responsiveCodeFontStyle, responsiveHeadingFont, responsiveLabelFont, responsiveTextAlignStyle, responsiveTextFont, rgbToHex, rgbToHsl, rgba, screen$1 as screen, studioTheme, useBoundaryElement, useClickOutside, useCustomValidity, useDialog, useElementRect, useForwardedRef, useGlobalKeyDown, useLayer, useMediaIndex, usePortal, usePrefersDark, useResponsiveProp, useRootTheme, useTheme, useToast, useTree };
|
|
11111
10984
|
//# sourceMappingURL=sanity-ui.modern.js.map
|