@sanity/ui 2.0.0-alpha.21 → 2.0.0-alpha.23
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/index.d.ts +2 -0
- package/dist/index.esm.js +30 -16
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +30 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/autocomplete/autocomplete.tsx +1 -1
- package/src/components/toast/toast.tsx +8 -3
- package/src/primitives/avatar/avatar.tsx +4 -2
- package/src/primitives/avatar/styles.ts +7 -0
- package/src/primitives/badge/styles.ts +3 -1
- package/src/primitives/tooltip/constants.ts +1 -0
- package/src/primitives/tooltip/tooltip.tsx +13 -5
- package/src/theme/studioTheme/theme.ts +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -3426,6 +3426,7 @@ export declare interface ToastProps {
|
|
|
3426
3426
|
closable?: boolean
|
|
3427
3427
|
description?: React.ReactNode
|
|
3428
3428
|
onClose?: () => void
|
|
3429
|
+
radius?: number | number[]
|
|
3429
3430
|
title?: React.ReactNode
|
|
3430
3431
|
status?: 'error' | 'warning' | 'success' | 'info'
|
|
3431
3432
|
}
|
|
@@ -3541,6 +3542,7 @@ export declare interface TooltipDelayGroupProviderProps {
|
|
|
3541
3542
|
export declare interface TooltipProps extends Omit<LayerProps, 'as'> {
|
|
3542
3543
|
/** @deprecated Use `fallbackPlacements` instead. */
|
|
3543
3544
|
allowedAutoPlacements?: Placement[]
|
|
3545
|
+
arrow?: boolean
|
|
3544
3546
|
boundaryElement?: HTMLElement | null
|
|
3545
3547
|
children?: React.ReactElement
|
|
3546
3548
|
content?: React.ReactNode
|
package/dist/index.esm.js
CHANGED
|
@@ -3823,13 +3823,13 @@ const studioTheme = {
|
|
|
3823
3823
|
avatar: {
|
|
3824
3824
|
sizes: [{
|
|
3825
3825
|
distance: -3,
|
|
3826
|
-
size:
|
|
3826
|
+
size: 19
|
|
3827
3827
|
}, {
|
|
3828
3828
|
distance: -6,
|
|
3829
|
-
size:
|
|
3829
|
+
size: 31
|
|
3830
3830
|
}, {
|
|
3831
3831
|
distance: -9,
|
|
3832
|
-
size:
|
|
3832
|
+
size: 51
|
|
3833
3833
|
}],
|
|
3834
3834
|
focusRing: {
|
|
3835
3835
|
offset: 0,
|
|
@@ -4869,7 +4869,8 @@ const avatarStyle = {
|
|
|
4869
4869
|
arrow: avatarArrowStyle,
|
|
4870
4870
|
bgStroke: avatarBgStrokeStyle,
|
|
4871
4871
|
stroke: avatarStrokeStyle,
|
|
4872
|
-
initials: avatarInitialsStyle
|
|
4872
|
+
initials: avatarInitialsStyle,
|
|
4873
|
+
image: avatarImageStyle
|
|
4873
4874
|
};
|
|
4874
4875
|
function avatarArrowStyle() {
|
|
4875
4876
|
return {
|
|
@@ -4976,6 +4977,11 @@ function responsiveAvatarSizeStyle(props) {
|
|
|
4976
4977
|
};
|
|
4977
4978
|
});
|
|
4978
4979
|
}
|
|
4980
|
+
function avatarImageStyle() {
|
|
4981
|
+
return {
|
|
4982
|
+
position: "relative"
|
|
4983
|
+
};
|
|
4984
|
+
}
|
|
4979
4985
|
function avatarInitialsStyle(props) {
|
|
4980
4986
|
const {
|
|
4981
4987
|
theme
|
|
@@ -5017,6 +5023,7 @@ const Arrow = styled.div(avatarStyle.arrow);
|
|
|
5017
5023
|
const BgStroke = styled.ellipse(avatarStyle.bgStroke);
|
|
5018
5024
|
const Stroke = styled.ellipse(avatarStyle.stroke);
|
|
5019
5025
|
const Initials = styled.div(avatarStyle.initials);
|
|
5026
|
+
const Image = styled.svg(avatarStyle.image);
|
|
5020
5027
|
const Avatar = forwardRef(function Avatar2(props, ref) {
|
|
5021
5028
|
const {
|
|
5022
5029
|
__unstable_hideInnerStroke,
|
|
@@ -5081,7 +5088,7 @@ const Avatar = forwardRef(function Avatar2(props, ref) {
|
|
|
5081
5088
|
fill: color
|
|
5082
5089
|
})
|
|
5083
5090
|
})
|
|
5084
|
-
}), !imageFailed && src && /* @__PURE__ */jsxs(
|
|
5091
|
+
}), !imageFailed && src && /* @__PURE__ */jsxs(Image, {
|
|
5085
5092
|
viewBox: "0 0 ".concat(_sizeRem, " ").concat(_sizeRem),
|
|
5086
5093
|
fill: "none",
|
|
5087
5094
|
children: [/* @__PURE__ */jsx("defs", {
|
|
@@ -5320,7 +5327,8 @@ function badgeStyle(props) {
|
|
|
5320
5327
|
const palette = theme.sanity.color[$mode === "outline" ? "muted" : "solid"];
|
|
5321
5328
|
const color = palette[$tone] || palette.default;
|
|
5322
5329
|
return {
|
|
5323
|
-
|
|
5330
|
+
"--card-fg-color": color.enabled.fg,
|
|
5331
|
+
backgroundColor: color.enabled.bg2,
|
|
5324
5332
|
color: color.enabled.fg,
|
|
5325
5333
|
boxShadow: "inset 0 0 0 1px ".concat(color.enabled.border),
|
|
5326
5334
|
cursor: "default",
|
|
@@ -7803,6 +7811,7 @@ function useDelayedState(initialState) {
|
|
|
7803
7811
|
}, []);
|
|
7804
7812
|
return [state, onStateChange];
|
|
7805
7813
|
}
|
|
7814
|
+
const DEFAULT_TOOLTIP_DISTANCE = 4;
|
|
7806
7815
|
const DEFAULT_TOOLTIP_PADDING = 4;
|
|
7807
7816
|
const DEFAULT_FALLBACK_PLACEMENTS = {
|
|
7808
7817
|
top: ["bottom", "left", "right"],
|
|
@@ -7898,6 +7907,7 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
|
|
|
7898
7907
|
const boundaryElementContext = useBoundaryElement();
|
|
7899
7908
|
const theme = useTheme();
|
|
7900
7909
|
const {
|
|
7910
|
+
arrow: arrowProp = true,
|
|
7901
7911
|
boundaryElement = boundaryElementContext == null ? void 0 : boundaryElementContext.element,
|
|
7902
7912
|
children: childProp,
|
|
7903
7913
|
content,
|
|
@@ -7932,19 +7942,21 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
|
|
|
7932
7942
|
rootBoundary
|
|
7933
7943
|
}));
|
|
7934
7944
|
ret.push(offset({
|
|
7935
|
-
mainAxis:
|
|
7945
|
+
mainAxis: DEFAULT_TOOLTIP_DISTANCE
|
|
7936
7946
|
}));
|
|
7937
7947
|
ret.push(shift({
|
|
7938
7948
|
boundary: boundaryElement || void 0,
|
|
7939
7949
|
rootBoundary,
|
|
7940
7950
|
padding: DEFAULT_TOOLTIP_PADDING
|
|
7941
7951
|
}));
|
|
7942
|
-
|
|
7943
|
-
|
|
7944
|
-
|
|
7945
|
-
|
|
7952
|
+
if (arrowProp) {
|
|
7953
|
+
ret.push(arrow({
|
|
7954
|
+
element: arrowRef,
|
|
7955
|
+
padding: 2
|
|
7956
|
+
}));
|
|
7957
|
+
}
|
|
7946
7958
|
return ret;
|
|
7947
|
-
}, [boundaryElement, fallbackPlacements]);
|
|
7959
|
+
}, [arrowProp, boundaryElement, fallbackPlacements]);
|
|
7948
7960
|
const {
|
|
7949
7961
|
floatingStyles,
|
|
7950
7962
|
placement,
|
|
@@ -8104,7 +8116,7 @@ const Tooltip = forwardRef(function Tooltip2(props, ref) {
|
|
|
8104
8116
|
radius: 3,
|
|
8105
8117
|
scheme,
|
|
8106
8118
|
shadow,
|
|
8107
|
-
children: [content, /* @__PURE__ */jsx(TooltipArrow, {
|
|
8119
|
+
children: [content, arrowProp && /* @__PURE__ */jsx(TooltipArrow, {
|
|
8108
8120
|
ref: setArrow,
|
|
8109
8121
|
style: arrowStyle
|
|
8110
8122
|
})]
|
|
@@ -8249,7 +8261,7 @@ const InnerAutocomplete = forwardRef(function InnerAutocomplete2(props, ref) {
|
|
|
8249
8261
|
padding: paddingProp = 3,
|
|
8250
8262
|
popover = EMPTY_RECORD,
|
|
8251
8263
|
prefix,
|
|
8252
|
-
radius =
|
|
8264
|
+
radius = 2,
|
|
8253
8265
|
readOnly,
|
|
8254
8266
|
relatedElements,
|
|
8255
8267
|
renderOption: renderOptionProp,
|
|
@@ -10074,6 +10086,7 @@ function Toast(props) {
|
|
|
10074
10086
|
closable,
|
|
10075
10087
|
description,
|
|
10076
10088
|
onClose,
|
|
10089
|
+
radius = 3,
|
|
10077
10090
|
title,
|
|
10078
10091
|
status,
|
|
10079
10092
|
...restProps
|
|
@@ -10085,7 +10098,7 @@ function Toast(props) {
|
|
|
10085
10098
|
role,
|
|
10086
10099
|
...restProps,
|
|
10087
10100
|
marginTop: 3,
|
|
10088
|
-
radius
|
|
10101
|
+
radius,
|
|
10089
10102
|
shadow: 2,
|
|
10090
10103
|
tone: cardTone,
|
|
10091
10104
|
children: /* @__PURE__ */jsxs(Flex, {
|
|
@@ -10096,7 +10109,8 @@ function Toast(props) {
|
|
|
10096
10109
|
children: /* @__PURE__ */jsxs(Stack, {
|
|
10097
10110
|
space: 3,
|
|
10098
10111
|
children: [title && /* @__PURE__ */jsx(Text, {
|
|
10099
|
-
|
|
10112
|
+
size: 1,
|
|
10113
|
+
weight: "medium",
|
|
10100
10114
|
children: title
|
|
10101
10115
|
}), description && /* @__PURE__ */jsx(Text, {
|
|
10102
10116
|
muted: true,
|