@sanity/ui 2.0.0-beta.14 → 2.0.0-beta.16
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.esm.js +25 -8
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +25 -8
- package/dist/index.js.map +1 -1
- package/dist/theme.d.ts +6 -0
- package/dist/theme.esm.js +5 -3
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +5 -3
- package/dist/theme.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 +5 -1
- package/src/core/primitives/tooltip/tooltipCard.tsx +7 -2
- package/src/theme/getScopedTheme.ts +1 -0
- package/src/theme/system/theme.ts +9 -1
- package/src/theme/versioning/getTheme_v2.ts +2 -1
package/dist/index.esm.js
CHANGED
|
@@ -20,17 +20,23 @@ const screen = screen$1;
|
|
|
20
20
|
const studioTheme = buildTheme();
|
|
21
21
|
const EMPTY_ARRAY = [];
|
|
22
22
|
const EMPTY_RECORD = {};
|
|
23
|
+
const POPOVER_MOTION_CONTENT_OPACITY_PROPERTY = "--motion-content-opacity";
|
|
23
24
|
const POPOVER_MOTION_PROPS = {
|
|
24
25
|
initial: {
|
|
25
26
|
opacity: 0.5,
|
|
26
|
-
|
|
27
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: 0,
|
|
28
|
+
scale: 0.97,
|
|
29
|
+
willChange: "transform"
|
|
27
30
|
},
|
|
28
31
|
animate: {
|
|
29
|
-
opacity: 1,
|
|
32
|
+
opacity: [null, 1, 1],
|
|
33
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [null, null, 1],
|
|
30
34
|
scale: 1
|
|
31
35
|
},
|
|
32
36
|
exit: {
|
|
33
|
-
|
|
37
|
+
// @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
|
|
38
|
+
opacity: [null, null, 0],
|
|
39
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [null, 0, 0],
|
|
34
40
|
scale: 0.97
|
|
35
41
|
},
|
|
36
42
|
transition: {
|
|
@@ -3942,7 +3948,7 @@ var __template$m = (cooked, raw) => __freeze$m(__defProp$m(cooked, "raw", {
|
|
|
3942
3948
|
value: __freeze$m(raw || cooked.slice())
|
|
3943
3949
|
}));
|
|
3944
3950
|
var _a$m;
|
|
3945
|
-
const MotionCard$1 = styled(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"])));
|
|
3951
|
+
const MotionCard$1 = styled(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);
|
|
3946
3952
|
const PopoverCard = memo(forwardRef(function PopoverCard2(props, ref) {
|
|
3947
3953
|
const {
|
|
3948
3954
|
__unstable_margins: marginsProp,
|
|
@@ -4831,7 +4837,7 @@ var __template$g = (cooked, raw) => __freeze$g(__defProp$g(cooked, "raw", {
|
|
|
4831
4837
|
value: __freeze$g(raw || cooked.slice())
|
|
4832
4838
|
}));
|
|
4833
4839
|
var _a$g;
|
|
4834
|
-
const MotionCard = styled(motion(Card))(_a$g || (_a$g = __template$g([""])));
|
|
4840
|
+
const MotionCard = styled(motion(Card))(_a$g || (_a$g = __template$g(["\n & > * {\n opacity: var(", ", 1);\n will-change: opacity;\n }\n"])), POPOVER_MOTION_CONTENT_OPACITY_PROPERTY);
|
|
4835
4841
|
const TooltipCard = memo(forwardRef(function TooltipCard2(props, ref) {
|
|
4836
4842
|
const {
|
|
4837
4843
|
animate,
|
|
@@ -7098,13 +7104,19 @@ const STATUS_CARD_TONE = {
|
|
|
7098
7104
|
success: "positive",
|
|
7099
7105
|
info: "primary"
|
|
7100
7106
|
};
|
|
7107
|
+
const BUTTON_TONE = {
|
|
7108
|
+
error: "critical",
|
|
7109
|
+
warning: "caution",
|
|
7110
|
+
success: "positive",
|
|
7111
|
+
info: "primary"
|
|
7112
|
+
};
|
|
7101
7113
|
const ROLES = {
|
|
7102
7114
|
error: "alert",
|
|
7103
7115
|
warning: "alert",
|
|
7104
7116
|
success: "alert",
|
|
7105
7117
|
info: "alert"
|
|
7106
7118
|
};
|
|
7107
|
-
const Root$2 = styled(Card)(_a$3 || (_a$3 = __template$3(["\n pointer-events: all;\n"])));
|
|
7119
|
+
const Root$2 = styled(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);
|
|
7108
7120
|
const TextBox = styled(Flex)(_b$2 || (_b$2 = __template$3(["\n overflow-x: auto;\n"])));
|
|
7109
7121
|
function Toast(props) {
|
|
7110
7122
|
const {
|
|
@@ -7117,6 +7129,7 @@ function Toast(props) {
|
|
|
7117
7129
|
...restProps
|
|
7118
7130
|
} = props;
|
|
7119
7131
|
const cardTone = status ? STATUS_CARD_TONE[status] : "default";
|
|
7132
|
+
const buttonTone = status ? BUTTON_TONE[status] : "default";
|
|
7120
7133
|
const role = status ? ROLES[status] : "status";
|
|
7121
7134
|
return /* @__PURE__ */jsx(Root$2, {
|
|
7122
7135
|
"data-ui": "Toast",
|
|
@@ -7150,6 +7163,7 @@ function Toast(props) {
|
|
|
7150
7163
|
icon: CloseIcon,
|
|
7151
7164
|
mode: "bleed",
|
|
7152
7165
|
padding: 2,
|
|
7166
|
+
tone: buttonTone,
|
|
7153
7167
|
onClick: onClose,
|
|
7154
7168
|
style: {
|
|
7155
7169
|
verticalAlign: "top"
|
|
@@ -7259,12 +7273,14 @@ function ToastProvider(props) {
|
|
|
7259
7273
|
} = _ref12;
|
|
7260
7274
|
return /* @__PURE__ */jsx(motion.div, {
|
|
7261
7275
|
animate: {
|
|
7262
|
-
opacity: 1,
|
|
7276
|
+
opacity: [0, 1, 1],
|
|
7277
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [0, 0, 1],
|
|
7263
7278
|
y: 0,
|
|
7264
7279
|
scale: 1
|
|
7265
7280
|
},
|
|
7266
7281
|
exit: {
|
|
7267
|
-
opacity: 0,
|
|
7282
|
+
opacity: [1, 1, 0],
|
|
7283
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [1, 0, 0],
|
|
7268
7284
|
scale: 0.5,
|
|
7269
7285
|
transition: {
|
|
7270
7286
|
duration: 0.2
|
|
@@ -7272,6 +7288,7 @@ function ToastProvider(props) {
|
|
|
7272
7288
|
},
|
|
7273
7289
|
initial: {
|
|
7274
7290
|
opacity: 0,
|
|
7291
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: 0,
|
|
7275
7292
|
y: 32,
|
|
7276
7293
|
scale: 0.25,
|
|
7277
7294
|
willChange: "transform"
|