@sanity/ui 3.0.0-static.10 → 3.0.0-static.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks-cjs/_visual-editing.js +105 -143
- package/dist/_chunks-cjs/_visual-editing.js.map +1 -1
- package/dist/_chunks-cjs/buildCommand.js +1 -1
- package/dist/_chunks-cjs/buildCommand.js.map +1 -1
- package/dist/_chunks-cjs/v3_v2.js +251 -0
- package/dist/_chunks-cjs/v3_v2.js.map +1 -0
- package/dist/_chunks-es/_visual-editing.mjs +106 -144
- package/dist/_chunks-es/_visual-editing.mjs.map +1 -1
- package/dist/_chunks-es/v3_v2.mjs +252 -0
- package/dist/_chunks-es/v3_v2.mjs.map +1 -0
- package/dist/_visual-editing.d.mts +11 -14
- package/dist/_visual-editing.d.ts +11 -14
- package/dist/cli.js +1 -1
- package/dist/css.d.mts +1006 -282
- package/dist/css.d.ts +1006 -282
- package/dist/css.js +743 -852
- package/dist/css.js.map +1 -1
- package/dist/css.mjs +743 -852
- package/dist/css.mjs.map +1 -1
- package/dist/index.d.mts +11 -14
- package/dist/index.d.ts +11 -14
- package/dist/index.js +31 -17
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -19
- package/dist/index.mjs.map +1 -1
- package/dist/sanity-palette.css +9 -1
- package/dist/sanity-theme.css +1 -1
- package/dist/system.css +1023 -1448
- package/dist/theme.d.mts +119 -85
- package/dist/theme.d.ts +119 -85
- package/dist/theme.js +219 -432
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +202 -413
- package/dist/theme.mjs.map +1 -1
- package/package.json +2 -2
- package/src/cli/buildCommand.ts +2 -2
- package/src/css/_comp.ts +0 -1
- package/src/css/aspects/flex/flexJustify.style.ts +3 -3
- package/src/css/aspects/grid/types.ts +2 -2
- package/src/css/aspects/index.ts +0 -1
- package/src/css/aspects/textOverflow/textOverflow.ts +2 -2
- package/src/css/compile/compilePalette.ts +41 -8
- package/src/css/compile/compileRule.ts +0 -1
- package/src/css/compile/compileStyle.ts +1 -1
- package/src/css/compile/compileTheme_v3.ts +55 -46
- package/src/css/index.ts +2 -2
- package/src/css/primitives/_input/__workshop__/index.ts +1 -1
- package/src/css/primitives/_selectable/_contants.ts +1 -1
- package/src/css/primitives/badge/badge.style.ts +1 -1
- package/src/css/primitives/box/box.style.ts +1 -1
- package/src/css/primitives/box/box.ts +0 -2
- package/src/css/primitives/box/types.ts +0 -2
- package/src/css/primitives/button/_constants.ts +1 -1
- package/src/css/primitives/button/button.style.ts +13 -32
- package/src/css/primitives/card/_constants.ts +2 -2
- package/src/css/primitives/card/card.style.ts +44 -116
- package/src/css/primitives/card/card.ts +1 -1
- package/src/css/primitives/card/rules.ts +473 -0
- package/src/css/primitives/card/types.ts +1 -0
- package/src/css/primitives/kbd/kbd.style.ts +1 -1
- package/src/css/primitives/popover/popover.ts +0 -4
- package/src/css/primitives/switch/switch.style.ts +83 -8
- package/src/css/primitives/text/text.style.ts +3 -11
- package/src/css/system.style.ts +0 -4
- package/src/css/types.ts +188 -202
- package/src/css/varNames.ts +76 -110
- package/src/css/vars.ts +76 -109
- package/src/theme/defaults/config.ts +2 -2
- package/src/theme/defaults/fonts.ts +4 -4
- package/src/theme/palette/constants.ts +3 -1
- package/src/theme/palette/types.ts +12 -0
- package/src/theme/v3/buildTheme_v3.ts +2 -1
- package/src/theme/v3/color/buildColor_v3.ts +38 -43
- package/src/theme/v3/color/card.ts +38 -43
- package/src/theme/v3/color/color.ts +38 -42
- package/src/theme/v3/defaults.ts +72 -69
- package/src/theme/v3/resolveTokens.ts +38 -43
- package/src/theme/v3/types.ts +3 -0
- package/src/theme/versioning/themeColor_v3_v2.ts +1 -1
- package/src/ui/StyleTags.tsx +1 -1
- package/src/ui/components/autocomplete/__workshop__/async.tsx +1 -0
- package/src/ui/components/autocomplete/__workshop__/index.ts +1 -1
- package/src/ui/components/autocomplete/autocomplete.tsx +11 -2
- package/src/ui/components/dialog/dialog.tsx +4 -3
- package/src/ui/constants.ts +0 -6
- package/src/ui/hooks/useMediaIndex/useMediaIndex.ts +2 -0
- package/src/ui/primitives/box/box.tsx +2 -9
- package/src/ui/primitives/button/button.tsx +11 -12
- package/src/ui/primitives/card/card.tsx +5 -4
- package/src/ui/primitives/code/code.tsx +1 -1
- package/src/ui/primitives/heading/heading.tsx +1 -1
- package/src/ui/primitives/kbd/kbd.tsx +2 -2
- package/src/ui/primitives/popover/popover.tsx +75 -5
- package/src/ui/primitives/popover/popoverCard.tsx +39 -45
- package/src/ui/primitives/select/select.tsx +3 -3
- package/src/ui/primitives/stack/stack.tsx +5 -10
- package/src/ui/primitives/text/text.tsx +1 -1
- package/src/ui/primitives/textInput/textInput.tsx +1 -1
- package/src/ui/primitives/tooltip/tooltip.tsx +3 -2
- package/src/css/aspects/minWidth/index.ts +0 -2
- package/src/css/aspects/minWidth/minWidth.style.ts +0 -13
- package/src/css/aspects/minWidth/minWidth.ts +0 -6
- package/src/css/aspects/minWidth/types.ts +0 -7
- package/src/css/primitives/stack/index.ts +0 -1
- package/src/css/primitives/stack/stack.style.ts +0 -9
- package/src/css/primitives/stack/stack.ts +0 -6
package/dist/index.d.mts
CHANGED
|
@@ -1558,16 +1558,16 @@ export declare interface PopoverProps extends CardProps, LayerProps {
|
|
|
1558
1558
|
ref: ForwardedRef<HTMLElement>
|
|
1559
1559
|
}>
|
|
1560
1560
|
/**
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1561
|
+
* When `true`, prevent overflow within the current boundary:
|
|
1562
|
+
* - by flipping on its side axis
|
|
1563
|
+
* - by resizing
|
|
1564
|
+
/*
|
|
1565
|
+
* Note that:
|
|
1566
|
+
* - setting `preventOverflow` to `true` also prevents overflow on its side axis
|
|
1567
|
+
* - setting `matchReferenceWidth` to `true` also causes the popover to resize
|
|
1568
|
+
*
|
|
1569
|
+
* @defaultValue false
|
|
1570
|
+
*/
|
|
1571
1571
|
constrainSize?: boolean
|
|
1572
1572
|
content?: ReactNode
|
|
1573
1573
|
disabled?: boolean
|
|
@@ -1992,10 +1992,7 @@ export declare const Stack: ForwardRefExoticComponent<
|
|
|
1992
1992
|
* @public
|
|
1993
1993
|
*/
|
|
1994
1994
|
export declare interface StackProps
|
|
1995
|
-
extends Omit<
|
|
1996
|
-
BoxProps,
|
|
1997
|
-
'align' | 'columns' | 'direction' | 'display' | 'gapX' | 'gapY' | 'justify'
|
|
1998
|
-
> {
|
|
1995
|
+
extends Omit<BoxProps, 'direction' | 'display' | 'gapX' | 'gapY'> {
|
|
1999
1996
|
/** @deprecated Use `gap` instead. */
|
|
2000
1997
|
space?: ResponsiveProp<Space>
|
|
2001
1998
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1558,16 +1558,16 @@ export declare interface PopoverProps extends CardProps, LayerProps {
|
|
|
1558
1558
|
ref: ForwardedRef<HTMLElement>
|
|
1559
1559
|
}>
|
|
1560
1560
|
/**
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1561
|
+
* When `true`, prevent overflow within the current boundary:
|
|
1562
|
+
* - by flipping on its side axis
|
|
1563
|
+
* - by resizing
|
|
1564
|
+
/*
|
|
1565
|
+
* Note that:
|
|
1566
|
+
* - setting `preventOverflow` to `true` also prevents overflow on its side axis
|
|
1567
|
+
* - setting `matchReferenceWidth` to `true` also causes the popover to resize
|
|
1568
|
+
*
|
|
1569
|
+
* @defaultValue false
|
|
1570
|
+
*/
|
|
1571
1571
|
constrainSize?: boolean
|
|
1572
1572
|
content?: ReactNode
|
|
1573
1573
|
disabled?: boolean
|
|
@@ -1992,10 +1992,7 @@ export declare const Stack: ForwardRefExoticComponent<
|
|
|
1992
1992
|
* @public
|
|
1993
1993
|
*/
|
|
1994
1994
|
export declare interface StackProps
|
|
1995
|
-
extends Omit<
|
|
1996
|
-
BoxProps,
|
|
1997
|
-
'align' | 'columns' | 'direction' | 'display' | 'gapX' | 'gapY' | 'justify'
|
|
1998
|
-
> {
|
|
1995
|
+
extends Omit<BoxProps, 'direction' | 'display' | 'gapX' | 'gapY'> {
|
|
1999
1996
|
/** @deprecated Use `gap` instead. */
|
|
2000
1997
|
space?: ResponsiveProp<Space>
|
|
2001
1998
|
}
|
package/dist/index.js
CHANGED
|
@@ -201,7 +201,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
|
|
|
201
201
|
customValidity,
|
|
202
202
|
disabled,
|
|
203
203
|
filterOption: filterOptionProp,
|
|
204
|
-
fontSize =
|
|
204
|
+
fontSize = 1,
|
|
205
205
|
icon,
|
|
206
206
|
id,
|
|
207
207
|
listBox = _visualEditing.EMPTY_RECORD,
|
|
@@ -240,7 +240,16 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
|
|
|
240
240
|
value
|
|
241
241
|
} = state, defaultRenderOption = react.useCallback(({
|
|
242
242
|
value: value_0
|
|
243
|
-
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
243
|
+
}) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
244
|
+
_visualEditing.Card,
|
|
245
|
+
{
|
|
246
|
+
as: "button",
|
|
247
|
+
padding: paddingProp,
|
|
248
|
+
radius: 2,
|
|
249
|
+
selectable: !0,
|
|
250
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Text, { size: fontSize, textOverflow: "ellipsis", children: value_0 })
|
|
251
|
+
}
|
|
252
|
+
), [fontSize, paddingProp]), renderOption = typeof renderOptionProp == "function" ? renderOptionProp : defaultRenderOption, filterOption = typeof filterOptionProp == "function" ? filterOptionProp : DEFAULT_FILTER_OPTION, rootElementRef = react.useRef(null), resultsPopoverElementRef = react.useRef(null), inputElementRef = react.useRef(null), listBoxElementRef = react.useRef(null), listFocusedRef = react.useRef(!1), valueRef = react.useRef(value), valuePropRef = react.useRef(valueProp), popoverMouseWithinRef = react.useRef(!1);
|
|
244
253
|
react.useImperativeHandle(forwardedRef, () => inputElementRef.current);
|
|
245
254
|
const listBoxId = `${id}-listbox`, options = Array.isArray(optionsProp) ? optionsProp : _visualEditing.EMPTY_ARRAY, padding = _visualEditing.useArrayProp(paddingProp), currentOption = react.useMemo(() => value !== null ? options.find((o) => o.value === value) : void 0, [options, value]), filteredOptions = react.useMemo(() => options.filter((option) => query ? filterOption(query, option) : !0), [filterOption, options, query]), filteredOptionsLen = filteredOptions.length, activeItemId = activeValue ? `${id}-option-${activeValue}` : void 0, expanded = query !== null && loading || focused && query !== null, handleRootBlur = react.useCallback((event) => {
|
|
246
255
|
setTimeout(() => {
|
|
@@ -375,6 +384,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
|
|
|
375
384
|
return /* @__PURE__ */ jsxRuntime.jsx(AutocompleteOption, { id: `${id}-option-${option_0.value}`, onSelect: handleOptionSelect, selected: active, value: option_0.value, children: react.cloneElement(renderOption(option_0), {
|
|
376
385
|
disabled: loading,
|
|
377
386
|
selected: active,
|
|
387
|
+
selectable: !0,
|
|
378
388
|
tabIndex: listFocused && active ? 0 : -1
|
|
379
389
|
}) }, option_0.value);
|
|
380
390
|
}) }) }), [activeValue, currentOption, filteredOptions, handleOptionSelect, handleListBoxKeyDown, id, listBox, listBoxId, listFocused, loading, renderOption]), results = react.useMemo(() => renderPopover ? renderPopover({
|
|
@@ -383,7 +393,7 @@ const AUTOCOMPLETE_LISTBOX_IGNORE_KEYS = ["Control", "Shift", "Alt", "Enter", "H
|
|
|
383
393
|
inputElement: inputElementRef.current,
|
|
384
394
|
onMouseEnter: handlePopoverMouseEnter,
|
|
385
395
|
onMouseLeave: handlePopoverMouseLeave
|
|
386
|
-
}, resultsPopoverElementRef) : filteredOptionsLen === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Popover, { arrow: !1, constrainSize: !0, content: content2, fallbackPlacements: AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS, matchReferenceWidth: !0, onMouseEnter: handlePopoverMouseEnter, onMouseLeave: handlePopoverMouseLeave, open: expanded, overflow: "auto", placement: AUTOCOMPLETE_POPOVER_PLACEMENT, portal: !0, radius: 3, ref: resultsPopoverElementRef, referenceElement: inputElementRef.current, ...popover }), [content2, expanded, filteredOptionsLen, handlePopoverMouseEnter, handlePopoverMouseLeave, popover, renderPopover]);
|
|
396
|
+
}, resultsPopoverElementRef) : filteredOptionsLen === 0 ? null : /* @__PURE__ */ jsxRuntime.jsx(_visualEditing.Popover, { arrow: !1, constrainSize: !0, content: content2, fallbackPlacements: AUTOCOMPLETE_POPOVER_FALLBACK_PLACEMENTS, matchReferenceWidth: !0, onMouseEnter: handlePopoverMouseEnter, onMouseLeave: handlePopoverMouseLeave, open: expanded, overflow: "auto", placement: AUTOCOMPLETE_POPOVER_PLACEMENT, portal: !0, radius: 3, ref: resultsPopoverElementRef, referenceElement: inputElementRef.current, ...popover }), [content2, expanded, filteredOptionsLen, handlePopoverMouseEnter, handlePopoverMouseLeave, popover, radius, renderPopover]);
|
|
387
397
|
return (
|
|
388
398
|
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
|
|
389
399
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { "data-ui": "Autocomplete", onBlur: handleRootBlur, onFocus: handleRootFocus, onKeyDown: handleRootKeyDown, ref: rootElementRef, children: [
|
|
@@ -504,7 +514,9 @@ const DialogCard = react.forwardRef(function(props, forwardedRef) {
|
|
|
504
514
|
});
|
|
505
515
|
DialogCard.displayName = "ForwardRef(DialogCard)";
|
|
506
516
|
const Dialog = react.forwardRef(function(props, ref) {
|
|
507
|
-
const $ = reactCompilerRuntime.c(66), context = useDialog()
|
|
517
|
+
const $ = reactCompilerRuntime.c(66), context = useDialog(), {
|
|
518
|
+
layer
|
|
519
|
+
} = _visualEditing.useTheme_v2();
|
|
508
520
|
let _positionProp, _zOffsetProp, cardShadow, children, className, contentRef, footer, header, id, onActivate, onClickOutside, onClose, onFocus, portalProp, restProps, scheme, t0, t1, t2, t3, t4, t5, tone;
|
|
509
521
|
$[0] !== props ? ({
|
|
510
522
|
__unstable_autoFocus: t0,
|
|
@@ -531,7 +543,7 @@ const Dialog = react.forwardRef(function(props, ref) {
|
|
|
531
543
|
tone,
|
|
532
544
|
...restProps
|
|
533
545
|
} = props, $[0] = props, $[1] = _positionProp, $[2] = _zOffsetProp, $[3] = cardShadow, $[4] = children, $[5] = className, $[6] = contentRef, $[7] = footer, $[8] = header, $[9] = id, $[10] = onActivate, $[11] = onClickOutside, $[12] = onClose, $[13] = onFocus, $[14] = portalProp, $[15] = restProps, $[16] = scheme, $[17] = t0, $[18] = t1, $[19] = t2, $[20] = t3, $[21] = t4, $[22] = t5, $[23] = tone) : (_positionProp = $[1], _zOffsetProp = $[2], cardShadow = $[3], children = $[4], className = $[5], contentRef = $[6], footer = $[7], header = $[8], id = $[9], onActivate = $[10], onClickOutside = $[11], onClose = $[12], onFocus = $[13], portalProp = $[14], restProps = $[15], scheme = $[16], t0 = $[17], t1 = $[18], t2 = $[19], t3 = $[20], t4 = $[21], t5 = $[22], tone = $[23]);
|
|
534
|
-
const autoFocus = t0 === void 0 ? !0 : t0, hideCloseButton = t1 === void 0 ? !1 : t1, _animate = t2 === void 0 ? !1 : t2, cardRadiusProp = t3 === void 0 ? 4 : t3, padding = t4 === void 0 ? 3 : t4, widthProp = t5 === void 0 ? 0 : t5, positionProp = _positionProp ?? context.position
|
|
546
|
+
const autoFocus = t0 === void 0 ? !0 : t0, hideCloseButton = t1 === void 0 ? !1 : t1, _animate = t2 === void 0 ? !1 : t2, cardRadiusProp = t3 === void 0 ? 4 : t3, padding = t4 === void 0 ? 3 : t4, widthProp = t5 === void 0 ? 0 : t5, positionProp = _positionProp ?? (context.position || "fixed"), zOffsetProp = _zOffsetProp ?? (context.zOffset || layer.dialog.zOffset), animate = _visualEditing.usePrefersReducedMotion() ? !1 : _animate, portal = _visualEditing.usePortal(), portalElement = portalProp ? portal.elements?.[portalProp] || null : portal.element, boundaryElement = _visualEditing.useBoundaryElement().element, cardRadius = _visualEditing.useArrayProp(cardRadiusProp), position = _visualEditing.useArrayProp(positionProp), width = _visualEditing.useArrayProp(widthProp), zOffset = _visualEditing.useArrayProp(zOffsetProp), preDivRef = react.useRef(null), postDivRef = react.useRef(null), cardRef = react.useRef(null), focusedElementRef = react.useRef(null);
|
|
535
547
|
let t6;
|
|
536
548
|
$[24] !== onFocus ? (t6 = (event) => {
|
|
537
549
|
onFocus?.(event);
|
|
@@ -1375,28 +1387,30 @@ const TreeGroup = react.memo(function(props) {
|
|
|
1375
1387
|
});
|
|
1376
1388
|
TreeItem.displayName = "Memo(TreeItem)";
|
|
1377
1389
|
function StyleTags(props) {
|
|
1378
|
-
const $ = reactCompilerRuntime.c(
|
|
1390
|
+
const $ = reactCompilerRuntime.c(14), {
|
|
1379
1391
|
theme: themeProp
|
|
1380
1392
|
} = props;
|
|
1381
1393
|
let t0;
|
|
1382
1394
|
$[0] !== themeProp ? (t0 = themeProp ?? theme.buildTheme_v3(), $[0] = themeProp, $[1] = t0) : t0 = $[1];
|
|
1383
1395
|
const theme$1 = t0;
|
|
1384
1396
|
let t1;
|
|
1385
|
-
$[2]
|
|
1397
|
+
$[2] !== theme$1._palette ? (t1 = css.compilePalette(theme$1._palette), $[2] = theme$1._palette, $[3] = t1) : t1 = $[3];
|
|
1386
1398
|
let t2;
|
|
1387
|
-
$[
|
|
1388
|
-
v3: theme$1
|
|
1389
|
-
}), $[3] = theme$1, $[4] = t2) : t2 = $[4];
|
|
1399
|
+
$[4] !== t1 ? (t2 = /* @__PURE__ */ jsxRuntime.jsx("style", { href: "sanity-palette", precedence: "palette", children: t1 }), $[4] = t1, $[5] = t2) : t2 = $[5];
|
|
1390
1400
|
let t3;
|
|
1391
|
-
$[
|
|
1401
|
+
$[6] !== theme$1 ? (t3 = css.compileTheme({
|
|
1402
|
+
v3: theme$1
|
|
1403
|
+
}), $[6] = theme$1, $[7] = t3) : t3 = $[7];
|
|
1392
1404
|
let t4;
|
|
1393
|
-
$[
|
|
1405
|
+
$[8] !== t3 ? (t4 = /* @__PURE__ */ jsxRuntime.jsx("style", { href: "sanity-theme", precedence: "theme", children: t3 }), $[8] = t3, $[9] = t4) : t4 = $[9];
|
|
1394
1406
|
let t5;
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1407
|
+
$[10] === Symbol.for("react.memo_cache_sentinel") ? (t5 = /* @__PURE__ */ jsxRuntime.jsx("style", { href: "sanity-system", precedence: "system", children: css.compileSystem() }), $[10] = t5) : t5 = $[10];
|
|
1408
|
+
let t6;
|
|
1409
|
+
return $[11] !== t2 || $[12] !== t4 ? (t6 = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1410
|
+
t2,
|
|
1411
|
+
t4,
|
|
1412
|
+
t5
|
|
1413
|
+
] }), $[11] = t2, $[12] = t4, $[13] = t6) : t6 = $[13], t6;
|
|
1400
1414
|
}
|
|
1401
1415
|
exports.Arrow = _visualEditing.Arrow;
|
|
1402
1416
|
exports.Avatar = _visualEditing.Avatar;
|