@sanity/ui 2.0.0-beta.13 → 2.0.0-beta.15
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/LICENSE +1 -1
- package/dist/index.esm.js +31 -11
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +31 -11
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/core/__workshop__/fontsPlugin.tsx +2 -2
- package/src/core/components/toast/toast.tsx +17 -2
- package/src/core/components/toast/toastProvider.tsx +20 -3
- package/src/core/constants.ts +22 -3
- package/src/core/primitives/popover/popoverCard.tsx +7 -2
- package/src/core/primitives/tooltip/tooltipCard.tsx +9 -3
package/dist/index.js
CHANGED
|
@@ -33,17 +33,23 @@ const screen = theme.screen;
|
|
|
33
33
|
const studioTheme = theme.buildTheme();
|
|
34
34
|
const EMPTY_ARRAY = [];
|
|
35
35
|
const EMPTY_RECORD = {};
|
|
36
|
+
const POPOVER_MOTION_CONTENT_OPACITY_PROPERTY = "--motion-content-opacity";
|
|
36
37
|
const POPOVER_MOTION_PROPS = {
|
|
37
38
|
initial: {
|
|
38
39
|
opacity: 0.5,
|
|
39
|
-
|
|
40
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: 0,
|
|
41
|
+
scale: 0.97,
|
|
42
|
+
willChange: "transform"
|
|
40
43
|
},
|
|
41
44
|
animate: {
|
|
42
|
-
opacity: 1,
|
|
45
|
+
opacity: [null, 1, 1],
|
|
46
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [null, null, 1],
|
|
43
47
|
scale: 1
|
|
44
48
|
},
|
|
45
49
|
exit: {
|
|
46
|
-
|
|
50
|
+
// @ts-expect-error -- passing null a second time is valid: https://github.com/framer/motion/blob/b9ce4c42914c3916ea523609c5b032dfc72718bb/packages/framer-motion/src/animation/utils/keyframes.ts#L34C22-L34C22
|
|
51
|
+
opacity: [null, null, 0],
|
|
52
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [null, 0, 0],
|
|
47
53
|
scale: 0.97
|
|
48
54
|
},
|
|
49
55
|
transition: {
|
|
@@ -3955,7 +3961,7 @@ var __template$m = (cooked, raw) => __freeze$m(__defProp$m(cooked, "raw", {
|
|
|
3955
3961
|
value: __freeze$m(raw || cooked.slice())
|
|
3956
3962
|
}));
|
|
3957
3963
|
var _a$m;
|
|
3958
|
-
const MotionCard$1 = styled__default.default(framerMotion.motion(Card))(_a$m || (_a$m = __template$m(["\n &:not([hidden]) {\n display: flex;\n }\n flex-direction: column;\n width: max-content;\n min-width: min-content;\n"])));
|
|
3964
|
+
const MotionCard$1 = styled__default.default(framerMotion.motion(Card))(_a$m || (_a$m = __template$m(["\n &:not([hidden]) {\n display: flex;\n }\n flex-direction: column;\n width: max-content;\n min-width: min-content;\n & > * {\n opacity: var(", ", 1);\n will-change: opacity;\n }\n"])), POPOVER_MOTION_CONTENT_OPACITY_PROPERTY);
|
|
3959
3965
|
const PopoverCard = react.memo(react.forwardRef(function PopoverCard2(props, ref) {
|
|
3960
3966
|
const {
|
|
3961
3967
|
__unstable_margins: marginsProp,
|
|
@@ -3995,8 +4001,9 @@ const PopoverCard = react.memo(react.forwardRef(function PopoverCard2(props, ref
|
|
|
3995
4001
|
top: y,
|
|
3996
4002
|
width,
|
|
3997
4003
|
zIndex,
|
|
4004
|
+
willChange: animate ? "transform" : void 0,
|
|
3998
4005
|
...style
|
|
3999
|
-
}), [originX, originY, strategy, style, width, x, y, zIndex]);
|
|
4006
|
+
}), [animate, originX, originY, strategy, style, width, x, y, zIndex]);
|
|
4000
4007
|
const arrowStyle = react.useMemo(() => ({
|
|
4001
4008
|
left: arrowX !== null ? arrowX : void 0,
|
|
4002
4009
|
top: arrowY !== null ? arrowY : void 0,
|
|
@@ -4843,7 +4850,7 @@ var __template$g = (cooked, raw) => __freeze$g(__defProp$g(cooked, "raw", {
|
|
|
4843
4850
|
value: __freeze$g(raw || cooked.slice())
|
|
4844
4851
|
}));
|
|
4845
4852
|
var _a$g;
|
|
4846
|
-
const MotionCard = styled__default.default(framerMotion.motion(Card))(_a$g || (_a$g = __template$g([""])));
|
|
4853
|
+
const MotionCard = styled__default.default(framerMotion.motion(Card))(_a$g || (_a$g = __template$g(["\n & > * {\n opacity: var(", ", 1);\n will-change: opacity;\n }\n"])), POPOVER_MOTION_CONTENT_OPACITY_PROPERTY);
|
|
4847
4854
|
const TooltipCard = react.memo(react.forwardRef(function TooltipCard2(props, ref) {
|
|
4848
4855
|
const {
|
|
4849
4856
|
animate,
|
|
@@ -4865,8 +4872,9 @@ const TooltipCard = react.memo(react.forwardRef(function TooltipCard2(props, ref
|
|
|
4865
4872
|
const rootStyle = react.useMemo(() => ({
|
|
4866
4873
|
originX,
|
|
4867
4874
|
originY,
|
|
4875
|
+
willChange: animate ? "transform" : void 0,
|
|
4868
4876
|
...style
|
|
4869
|
-
}), [originX, originY, style]);
|
|
4877
|
+
}), [animate, originX, originY, style]);
|
|
4870
4878
|
const arrowStyle = react.useMemo(() => ({
|
|
4871
4879
|
left: arrowX !== null ? arrowX : void 0,
|
|
4872
4880
|
top: arrowY !== null ? arrowY : void 0,
|
|
@@ -7109,13 +7117,19 @@ const STATUS_CARD_TONE = {
|
|
|
7109
7117
|
success: "positive",
|
|
7110
7118
|
info: "primary"
|
|
7111
7119
|
};
|
|
7120
|
+
const BUTTON_TONE = {
|
|
7121
|
+
error: "critical",
|
|
7122
|
+
warning: "caution",
|
|
7123
|
+
success: "positive",
|
|
7124
|
+
info: "primary"
|
|
7125
|
+
};
|
|
7112
7126
|
const ROLES = {
|
|
7113
7127
|
error: "alert",
|
|
7114
7128
|
warning: "alert",
|
|
7115
7129
|
success: "alert",
|
|
7116
7130
|
info: "alert"
|
|
7117
7131
|
};
|
|
7118
|
-
const Root$2 = styled__default.default(Card)(_a$3 || (_a$3 = __template$3(["\n pointer-events: all;\n"])));
|
|
7132
|
+
const Root$2 = styled__default.default(Card)(_a$3 || (_a$3 = __template$3(["\n pointer-events: all;\n & > * {\n opacity: var(", ", 1);\n will-change: opacity;\n }\n"])), POPOVER_MOTION_CONTENT_OPACITY_PROPERTY);
|
|
7119
7133
|
const TextBox = styled__default.default(Flex)(_b$2 || (_b$2 = __template$3(["\n overflow-x: auto;\n"])));
|
|
7120
7134
|
function Toast(props) {
|
|
7121
7135
|
const {
|
|
@@ -7128,6 +7142,7 @@ function Toast(props) {
|
|
|
7128
7142
|
...restProps
|
|
7129
7143
|
} = props;
|
|
7130
7144
|
const cardTone = status ? STATUS_CARD_TONE[status] : "default";
|
|
7145
|
+
const buttonTone = status ? BUTTON_TONE[status] : "default";
|
|
7131
7146
|
const role = status ? ROLES[status] : "status";
|
|
7132
7147
|
return /* @__PURE__ */jsxRuntime.jsx(Root$2, {
|
|
7133
7148
|
"data-ui": "Toast",
|
|
@@ -7161,6 +7176,7 @@ function Toast(props) {
|
|
|
7161
7176
|
icon: icons.CloseIcon,
|
|
7162
7177
|
mode: "bleed",
|
|
7163
7178
|
padding: 2,
|
|
7179
|
+
tone: buttonTone,
|
|
7164
7180
|
onClick: onClose,
|
|
7165
7181
|
style: {
|
|
7166
7182
|
verticalAlign: "top"
|
|
@@ -7270,12 +7286,14 @@ function ToastProvider(props) {
|
|
|
7270
7286
|
} = _ref12;
|
|
7271
7287
|
return /* @__PURE__ */jsxRuntime.jsx(framerMotion.motion.div, {
|
|
7272
7288
|
animate: {
|
|
7273
|
-
opacity: 1,
|
|
7289
|
+
opacity: [0, 1, 1],
|
|
7290
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [0, 0, 1],
|
|
7274
7291
|
y: 0,
|
|
7275
7292
|
scale: 1
|
|
7276
7293
|
},
|
|
7277
7294
|
exit: {
|
|
7278
|
-
opacity: 0,
|
|
7295
|
+
opacity: [1, 1, 0],
|
|
7296
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [1, 0, 0],
|
|
7279
7297
|
scale: 0.5,
|
|
7280
7298
|
transition: {
|
|
7281
7299
|
duration: 0.2
|
|
@@ -7283,8 +7301,10 @@ function ToastProvider(props) {
|
|
|
7283
7301
|
},
|
|
7284
7302
|
initial: {
|
|
7285
7303
|
opacity: 0,
|
|
7304
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: 0,
|
|
7286
7305
|
y: 32,
|
|
7287
|
-
scale: 0.25
|
|
7306
|
+
scale: 0.25,
|
|
7307
|
+
willChange: "transform"
|
|
7288
7308
|
},
|
|
7289
7309
|
layout: "position",
|
|
7290
7310
|
transition: {
|