@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.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,
|
|
@@ -4844,7 +4850,7 @@ var __template$g = (cooked, raw) => __freeze$g(__defProp$g(cooked, "raw", {
|
|
|
4844
4850
|
value: __freeze$g(raw || cooked.slice())
|
|
4845
4851
|
}));
|
|
4846
4852
|
var _a$g;
|
|
4847
|
-
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);
|
|
4848
4854
|
const TooltipCard = react.memo(react.forwardRef(function TooltipCard2(props, ref) {
|
|
4849
4855
|
const {
|
|
4850
4856
|
animate,
|
|
@@ -7111,13 +7117,19 @@ const STATUS_CARD_TONE = {
|
|
|
7111
7117
|
success: "positive",
|
|
7112
7118
|
info: "primary"
|
|
7113
7119
|
};
|
|
7120
|
+
const BUTTON_TONE = {
|
|
7121
|
+
error: "critical",
|
|
7122
|
+
warning: "caution",
|
|
7123
|
+
success: "positive",
|
|
7124
|
+
info: "primary"
|
|
7125
|
+
};
|
|
7114
7126
|
const ROLES = {
|
|
7115
7127
|
error: "alert",
|
|
7116
7128
|
warning: "alert",
|
|
7117
7129
|
success: "alert",
|
|
7118
7130
|
info: "alert"
|
|
7119
7131
|
};
|
|
7120
|
-
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);
|
|
7121
7133
|
const TextBox = styled__default.default(Flex)(_b$2 || (_b$2 = __template$3(["\n overflow-x: auto;\n"])));
|
|
7122
7134
|
function Toast(props) {
|
|
7123
7135
|
const {
|
|
@@ -7130,6 +7142,7 @@ function Toast(props) {
|
|
|
7130
7142
|
...restProps
|
|
7131
7143
|
} = props;
|
|
7132
7144
|
const cardTone = status ? STATUS_CARD_TONE[status] : "default";
|
|
7145
|
+
const buttonTone = status ? BUTTON_TONE[status] : "default";
|
|
7133
7146
|
const role = status ? ROLES[status] : "status";
|
|
7134
7147
|
return /* @__PURE__ */jsxRuntime.jsx(Root$2, {
|
|
7135
7148
|
"data-ui": "Toast",
|
|
@@ -7163,6 +7176,7 @@ function Toast(props) {
|
|
|
7163
7176
|
icon: icons.CloseIcon,
|
|
7164
7177
|
mode: "bleed",
|
|
7165
7178
|
padding: 2,
|
|
7179
|
+
tone: buttonTone,
|
|
7166
7180
|
onClick: onClose,
|
|
7167
7181
|
style: {
|
|
7168
7182
|
verticalAlign: "top"
|
|
@@ -7272,12 +7286,14 @@ function ToastProvider(props) {
|
|
|
7272
7286
|
} = _ref12;
|
|
7273
7287
|
return /* @__PURE__ */jsxRuntime.jsx(framerMotion.motion.div, {
|
|
7274
7288
|
animate: {
|
|
7275
|
-
opacity: 1,
|
|
7289
|
+
opacity: [0, 1, 1],
|
|
7290
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [0, 0, 1],
|
|
7276
7291
|
y: 0,
|
|
7277
7292
|
scale: 1
|
|
7278
7293
|
},
|
|
7279
7294
|
exit: {
|
|
7280
|
-
opacity: 0,
|
|
7295
|
+
opacity: [1, 1, 0],
|
|
7296
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [1, 0, 0],
|
|
7281
7297
|
scale: 0.5,
|
|
7282
7298
|
transition: {
|
|
7283
7299
|
duration: 0.2
|
|
@@ -7285,6 +7301,7 @@ function ToastProvider(props) {
|
|
|
7285
7301
|
},
|
|
7286
7302
|
initial: {
|
|
7287
7303
|
opacity: 0,
|
|
7304
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: 0,
|
|
7288
7305
|
y: 32,
|
|
7289
7306
|
scale: 0.25,
|
|
7290
7307
|
willChange: "transform"
|