@sanity/ui 2.0.0-beta.9 → 2.0.0
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 +53 -30
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +53 -30
- package/dist/index.js.map +1 -1
- package/dist/theme.d.ts +12 -1
- package/dist/theme.esm.js +99 -78
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +99 -78
- package/dist/theme.js.map +1 -1
- package/package.json +2 -2
- package/src/core/__workshop__/fontsPlugin.tsx +48 -8
- package/src/core/components/dialog/dialog.tsx +1 -1
- package/src/core/components/dialog/styles.ts +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/button/button.tsx +10 -12
- package/src/core/primitives/heading/styles.ts +4 -0
- package/src/core/primitives/popover/popoverCard.tsx +7 -2
- package/src/core/primitives/switch/styles.ts +5 -0
- package/src/core/primitives/textInput/__workshop__/plain.tsx +1 -1
- package/src/core/primitives/textInput/__workshop__/states.tsx +10 -2
- package/src/core/primitives/tooltip/tooltipCard.tsx +9 -3
- package/src/core/styles/input/textInputStyle.ts +33 -2
- package/src/core/theme/__workshop__/debug/story.tsx +65 -28
- package/src/theme/build/buildColorTheme.test.ts +2 -2
- package/src/theme/defaults/colorTokens.ts +90 -72
- package/src/theme/defaults/config.ts +1 -1
- package/src/theme/getScopedTheme.ts +1 -0
- package/src/theme/system/color/state.ts +6 -0
- package/src/theme/system/theme.ts +9 -1
- package/src/theme/system/v0/color/color.ts +0 -1
- package/src/theme/versioning/getTheme_v2.ts +2 -1
- package/src/theme/versioning/v2_v0.ts +1 -0
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: {
|
|
@@ -1556,7 +1562,7 @@ function textInputRepresentationStyle(props) {
|
|
|
1556
1562
|
color,
|
|
1557
1563
|
input
|
|
1558
1564
|
} = theme.getTheme_v2(props.theme);
|
|
1559
|
-
return styled.css(_c$c || (_c$c = __template$F(["\n --input-box-shadow: none;\n\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: block;\n pointer-events: none;\n z-index: 0;\n\n background-color: var(--card-bg-color);\n box-shadow: var(--input-box-shadow);\n\n border-top-left-radius: ", ";\n border-bottom-left-radius: ", ";\n border-top-right-radius: ", ";\n border-bottom-right-radius: ", ";\n\n &[data-scheme='", "'][data-tone='", "'] {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n\n /* enabled */\n *:not(:disabled) + &[data-border] {\n --input-box-shadow: ", ";\n }\n\n /* invalid */\n *:not(:disabled):invalid + & {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n\n &[data-border] {\n --input-box-shadow: ", ";\n }\n }\n\n /* focused */\n *:not(:disabled):focus + & {\n &[data-border] {\n --input-box-shadow: ", ";\n }\n\n &:not([data-border]) {\n --input-box-shadow: ", ";\n }\n }\n\n /* disabled */\n *:disabled + & {\n --card-bg-color: ", " !important;\n --card-fg-color: ", " !important;\n\n &[data-border] {\n --input-box-shadow: ", ";\n }\n }\n\n /* readOnly */\n *:read-only + & {\n --card-bg-color: ", " !important;\n --card-fg-color: ", " !important;\n }\n\n /* hovered */\n @media (hover: hover) {\n *:not(:disabled):not(:read-only):not(:invalid):hover + & {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n }\n\n *:not(:disabled):not(:read-only):not(:invalid):not(:focus):hover + &[data-border] {\n --input-box-shadow: ", ";\n }\n }\n }\n "])), $hasPrefix ? 0 : void 0, $hasPrefix ? 0 : void 0, $hasSuffix ? 0 : void 0, $hasSuffix ? 0 : void 0, $scheme, $tone, color.input.default.enabled.bg, color.input.default.enabled.fg, focusRingBorderStyle({
|
|
1565
|
+
return styled.css(_c$c || (_c$c = __template$F(["\n --input-box-shadow: none;\n\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n display: block;\n pointer-events: none;\n z-index: 0;\n\n background-color: var(--card-bg-color);\n box-shadow: var(--input-box-shadow);\n\n border-top-left-radius: ", ";\n border-bottom-left-radius: ", ";\n border-top-right-radius: ", ";\n border-bottom-right-radius: ", ";\n\n &[data-scheme='", "'][data-tone='", "'] {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n\n /* enabled */\n *:not(:disabled) + &[data-border] {\n --input-box-shadow: ", ";\n }\n\n /* invalid */\n *:not(:disabled):invalid + & {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n\n &[data-border] {\n --input-box-shadow: ", ";\n }\n }\n\n /* focused */\n *:not(:disabled):focus + & {\n &[data-border] {\n --input-box-shadow: ", ";\n }\n\n &:not([data-border]) {\n --input-box-shadow: ", ";\n }\n }\n\n /* disabled */\n *:not(:invalid):disabled + & {\n --card-bg-color: ", " !important;\n --card-fg-color: ", " !important;\n --card-icon-color: ", " !important;\n\n &[data-border] {\n --input-box-shadow: ", ";\n }\n }\n\n *:invalid:disabled + & {\n --card-bg-color: ", " !important;\n --card-fg-color: ", " !important;\n --card-icon-color: ", " !important;\n\n &[data-border] {\n --input-box-shadow: ", ";\n }\n }\n\n /* readOnly */\n *:not(:invalid):read-only + & {\n --card-bg-color: ", " !important;\n --card-fg-color: ", " !important;\n }\n\n *:invalid:read-only + & {\n --card-bg-color: ", " !important;\n --card-fg-color: ", " !important;\n }\n\n /* hovered */\n @media (hover: hover) {\n *:not(:disabled):not(:read-only):not(:invalid):hover + & {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n }\n\n *:invalid:not(:disabled):not(:read-only):hover + & {\n --card-bg-color: ", ";\n --card-fg-color: ", ";\n }\n\n *:not(:disabled):not(:read-only):not(:invalid):not(:focus):hover + &[data-border] {\n --input-box-shadow: ", ";\n }\n\n *:invalid:not(:disabled):not(:read-only):not(:focus):hover + &[data-border] {\n --input-box-shadow: ", ";\n }\n }\n }\n "])), $hasPrefix ? 0 : void 0, $hasPrefix ? 0 : void 0, $hasSuffix ? 0 : void 0, $hasSuffix ? 0 : void 0, $scheme, $tone, color.input.default.enabled.bg, color.input.default.enabled.fg, focusRingBorderStyle({
|
|
1560
1566
|
color: color.input.default.enabled.border,
|
|
1561
1567
|
width: input.border.width
|
|
1562
1568
|
}), color.input.invalid.enabled.bg, color.input.invalid.enabled.fg, focusRingBorderStyle({
|
|
@@ -1570,12 +1576,18 @@ function textInputRepresentationStyle(props) {
|
|
|
1570
1576
|
focusRing: input.text.focusRing
|
|
1571
1577
|
}), $unstableDisableFocusRing ? void 0 : focusRingStyle({
|
|
1572
1578
|
focusRing: input.text.focusRing
|
|
1573
|
-
}), color.input.default.disabled.bg, color.input.default.disabled.fg, focusRingBorderStyle({
|
|
1579
|
+
}), color.input.default.disabled.bg, color.input.default.disabled.fg, color.input.default.disabled.fg, focusRingBorderStyle({
|
|
1574
1580
|
color: color.input.default.disabled.border,
|
|
1575
1581
|
width: input.border.width
|
|
1576
|
-
}), color.input.
|
|
1582
|
+
}), color.input.invalid.disabled.bg, color.input.invalid.disabled.fg, color.input.invalid.disabled.fg, focusRingBorderStyle({
|
|
1583
|
+
color: color.input.invalid.disabled.border,
|
|
1584
|
+
width: input.border.width
|
|
1585
|
+
}), color.input.default.readOnly.bg, color.input.default.readOnly.fg, color.input.invalid.readOnly.bg, color.input.invalid.readOnly.fg, color.input.default.hovered.bg, color.input.default.hovered.fg, color.input.invalid.hovered.bg, color.input.invalid.hovered.fg, focusRingBorderStyle({
|
|
1577
1586
|
color: color.input.default.hovered.border,
|
|
1578
1587
|
width: input.border.width
|
|
1588
|
+
}), focusRingBorderStyle({
|
|
1589
|
+
color: color.input.invalid.hovered.border,
|
|
1590
|
+
width: input.border.width
|
|
1579
1591
|
}));
|
|
1580
1592
|
}
|
|
1581
1593
|
function responsiveMarginStyle(props) {
|
|
@@ -2433,7 +2445,7 @@ const Button = react.forwardRef(function Button2(props, ref) {
|
|
|
2433
2445
|
iconRight,
|
|
2434
2446
|
justify: justifyProp = "center",
|
|
2435
2447
|
loading,
|
|
2436
|
-
mode = "
|
|
2448
|
+
mode = "default",
|
|
2437
2449
|
padding: paddingProp = 3,
|
|
2438
2450
|
paddingX: paddingXProp,
|
|
2439
2451
|
paddingY: paddingYProp,
|
|
@@ -2499,16 +2511,13 @@ const Button = react.forwardRef(function Button2(props, ref) {
|
|
|
2499
2511
|
children: [icon && /* @__PURE__ */jsxRuntime.jsxs(Text, {
|
|
2500
2512
|
size: fontSize,
|
|
2501
2513
|
children: [react.isValidElement(icon) && icon, ReactIs.isValidElementType(icon) && react.createElement(icon)]
|
|
2502
|
-
}), text && /* @__PURE__ */jsxRuntime.jsx(
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
weight: button.textWeight,
|
|
2510
|
-
children: text
|
|
2511
|
-
})
|
|
2514
|
+
}), text && /* @__PURE__ */jsxRuntime.jsx(Text, {
|
|
2515
|
+
muted,
|
|
2516
|
+
align: textAlign,
|
|
2517
|
+
size: fontSize,
|
|
2518
|
+
textOverflow: "ellipsis",
|
|
2519
|
+
weight: button.textWeight,
|
|
2520
|
+
children: text
|
|
2512
2521
|
}), iconRight && /* @__PURE__ */jsxRuntime.jsxs(Text, {
|
|
2513
2522
|
size: fontSize,
|
|
2514
2523
|
children: [react.isValidElement(iconRight) && iconRight, ReactIs.isValidElementType(iconRight) && react.createElement(iconRight)]
|
|
@@ -2935,7 +2944,7 @@ function headingBaseStyle(props) {
|
|
|
2935
2944
|
const {
|
|
2936
2945
|
font
|
|
2937
2946
|
} = theme.getTheme_v2(props.theme);
|
|
2938
|
-
return styled.css(_c$8 || (_c$8 = __template$s(["\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n color: var(--card-link-color);\n outline: none;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n &:focus {\n box-shadow:\n 0 0 0 1px var(--card-bg-color),\n 0 0 0 3px var(--card-focus-ring-color);\n }\n\n &:focus:not(:focus-visible) {\n box-shadow: none;\n }\n }\n\n & svg {\n /* Certain popular CSS libraries changes the defaults for SVG display */\n /* Make sure SVGs are rendered as inline elements */\n display: inline;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])), $accent && styled.css(_a$s || (_a$s = __template$s(["\n color: var(--card-accent-fg-color);\n "]))), $muted && styled.css(_b$g || (_b$g = __template$s(["\n color: var(--card-muted-fg-color);\n "]))), font.code.family);
|
|
2947
|
+
return styled.css(_c$8 || (_c$8 = __template$s(["\n ", "\n\n ", "\n\n & code {\n font-family: ", ";\n border-radius: 1px;\n }\n\n & a {\n text-decoration: none;\n border-radius: 1px;\n color: var(--card-link-color);\n outline: none;\n\n @media (hover: hover) {\n &:hover {\n text-decoration: underline;\n }\n }\n\n &:focus {\n box-shadow:\n 0 0 0 1px var(--card-bg-color),\n 0 0 0 3px var(--card-focus-ring-color);\n }\n\n &:focus:not(:focus-visible) {\n box-shadow: none;\n }\n }\n\n & strong {\n font-weight: ", ";\n }\n\n & svg {\n /* Certain popular CSS libraries changes the defaults for SVG display */\n /* Make sure SVGs are rendered as inline elements */\n display: inline;\n }\n\n & [data-sanity-icon] {\n vertical-align: baseline;\n }\n "])), $accent && styled.css(_a$s || (_a$s = __template$s(["\n color: var(--card-accent-fg-color);\n "]))), $muted && styled.css(_b$g || (_b$g = __template$s(["\n color: var(--card-muted-fg-color);\n "]))), font.code.family, font.heading.weights.bold);
|
|
2939
2948
|
}
|
|
2940
2949
|
var __freeze$r = Object.freeze;
|
|
2941
2950
|
var __defProp$s = Object.defineProperty;
|
|
@@ -3952,7 +3961,7 @@ var __template$m = (cooked, raw) => __freeze$m(__defProp$m(cooked, "raw", {
|
|
|
3952
3961
|
value: __freeze$m(raw || cooked.slice())
|
|
3953
3962
|
}));
|
|
3954
3963
|
var _a$m;
|
|
3955
|
-
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);
|
|
3956
3965
|
const PopoverCard = react.memo(react.forwardRef(function PopoverCard2(props, ref) {
|
|
3957
3966
|
const {
|
|
3958
3967
|
__unstable_margins: marginsProp,
|
|
@@ -3992,8 +4001,9 @@ const PopoverCard = react.memo(react.forwardRef(function PopoverCard2(props, ref
|
|
|
3992
4001
|
top: y,
|
|
3993
4002
|
width,
|
|
3994
4003
|
zIndex,
|
|
4004
|
+
willChange: animate ? "transform" : void 0,
|
|
3995
4005
|
...style
|
|
3996
|
-
}), [originX, originY, strategy, style, width, x, y, zIndex]);
|
|
4006
|
+
}), [animate, originX, originY, strategy, style, width, x, y, zIndex]);
|
|
3997
4007
|
const arrowStyle = react.useMemo(() => ({
|
|
3998
4008
|
left: arrowX !== null ? arrowX : void 0,
|
|
3999
4009
|
top: arrowY !== null ? arrowY : void 0,
|
|
@@ -4505,9 +4515,9 @@ function switchRepresentationStyles(props) {
|
|
|
4505
4515
|
color,
|
|
4506
4516
|
input
|
|
4507
4517
|
} = theme.getTheme_v2(props.theme);
|
|
4508
|
-
return styled.css(_c$5 || (_c$5 = __template$j(["\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n --switch-box-shadow: none;\n\n &:not([hidden]) {\n display: block;\n }\n position: relative;\n width: ", ";\n height: ", ";\n border-radius: ", ";\n\n /* Make sure it\u2019s not possible to interact with the wrapper element */\n pointer-events: none;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 1;\n box-shadow: var(--switch-box-shadow);\n border-radius: inherit;\n }\n\n /* Focus styles */\n input:focus + && {\n --switch-box-shadow: ", ";\n }\n\n input:focus:not(:focus-visible) + && {\n --switch-box-shadow: none;\n }\n\n input:checked + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n @media (hover: hover) {\n input:not(:disabled):hover + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n input:not(:disabled):checked:hover + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n }\n\n input:not([data-read-only]):disabled + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n input[data-read-only]:disabled + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n "])), color.input.default.enabled.border, color.input.default.enabled.bg, rem(input.switch.width), rem(input.switch.height), rem(input.switch.height / 2), focusRingStyle({
|
|
4518
|
+
return styled.css(_c$5 || (_c$5 = __template$j(["\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n --switch-box-shadow: none;\n\n &:not([hidden]) {\n display: block;\n }\n position: relative;\n width: ", ";\n height: ", ";\n border-radius: ", ";\n\n /* Make sure it\u2019s not possible to interact with the wrapper element */\n pointer-events: none;\n\n &:after {\n content: '';\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n z-index: 1;\n box-shadow: var(--switch-box-shadow);\n border-radius: inherit;\n }\n\n /* Focus styles */\n input:focus + && {\n --switch-box-shadow: ", ";\n }\n\n input:focus:not(:focus-visible) + && {\n --switch-box-shadow: none;\n }\n\n input:checked + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n @media (hover: hover) {\n input:not(:disabled):hover + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n input:not(:disabled):checked:hover + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n }\n\n input:not([data-read-only]):disabled + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n input[data-read-only]:disabled + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n\n input:checked[data-read-only]:disabled + && {\n --switch-bg-color: ", ";\n --switch-fg-color: ", ";\n }\n "])), color.input.default.enabled.border, color.input.default.enabled.bg, rem(input.switch.width), rem(input.switch.height), rem(input.switch.height / 2), focusRingStyle({
|
|
4509
4519
|
focusRing: input.switch.focusRing
|
|
4510
|
-
}), color.input.default.enabled.fg, color.input.default.enabled.bg, color.input.default.hovered.border, color.input.default.hovered.bg, color.input.default.enabled.fg, color.input.default.enabled.bg, color.input.default.disabled.border, color.input.default.disabled.bg, color.input.default.readOnly.border, color.input.default.readOnly.bg);
|
|
4520
|
+
}), color.input.default.enabled.fg, color.input.default.enabled.bg, color.input.default.hovered.border, color.input.default.hovered.bg, color.input.default.enabled.fg, color.input.default.enabled.bg, color.input.default.disabled.border, color.input.default.disabled.bg, color.input.default.readOnly.border, color.input.default.readOnly.bg, color.input.default.readOnly.fg, color.input.default.readOnly.bg);
|
|
4511
4521
|
}
|
|
4512
4522
|
function switchTrackStyles(props) {
|
|
4513
4523
|
const {
|
|
@@ -4840,7 +4850,7 @@ var __template$g = (cooked, raw) => __freeze$g(__defProp$g(cooked, "raw", {
|
|
|
4840
4850
|
value: __freeze$g(raw || cooked.slice())
|
|
4841
4851
|
}));
|
|
4842
4852
|
var _a$g;
|
|
4843
|
-
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);
|
|
4844
4854
|
const TooltipCard = react.memo(react.forwardRef(function TooltipCard2(props, ref) {
|
|
4845
4855
|
const {
|
|
4846
4856
|
animate,
|
|
@@ -4862,8 +4872,9 @@ const TooltipCard = react.memo(react.forwardRef(function TooltipCard2(props, ref
|
|
|
4862
4872
|
const rootStyle = react.useMemo(() => ({
|
|
4863
4873
|
originX,
|
|
4864
4874
|
originY,
|
|
4875
|
+
willChange: animate ? "transform" : void 0,
|
|
4865
4876
|
...style
|
|
4866
|
-
}), [originX, originY, style]);
|
|
4877
|
+
}), [animate, originX, originY, style]);
|
|
4867
4878
|
const arrowStyle = react.useMemo(() => ({
|
|
4868
4879
|
left: arrowX !== null ? arrowX : void 0,
|
|
4869
4880
|
top: arrowY !== null ? arrowY : void 0,
|
|
@@ -5821,7 +5832,7 @@ function responsiveDialogPositionStyle(props) {
|
|
|
5821
5832
|
}));
|
|
5822
5833
|
}
|
|
5823
5834
|
function animationDialogStyle(props) {
|
|
5824
|
-
if (!props
|
|
5835
|
+
if (!props.$animate) return styled.css(_a$c || (_a$c = __template$c([""])));
|
|
5825
5836
|
return styled.css(_b$7 || (_b$7 = __template$c(["\n @keyframes zoomIn {\n from {\n opacity: 0;\n transform: scale(0.95);\n }\n to {\n opacity: 1;\n transform: scale(1);\n }\n }\n @keyframes fadeIn {\n from {\n opacity: 0;\n }\n to {\n opacity: 1;\n }\n }\n\n animation: fadeIn 200ms ease-out;\n // Animates the dialog card.\n & > [data-ui='DialogCard'] {\n animation: zoomIn 200ms ease-out;\n }\n "])));
|
|
5826
5837
|
}
|
|
5827
5838
|
const key$3 = Symbol.for("@sanity/ui/context/dialog");
|
|
@@ -6044,6 +6055,7 @@ const Dialog = react.forwardRef(function Dialog2(props, ref) {
|
|
|
6044
6055
|
__unstable_name: portalProp,
|
|
6045
6056
|
children: /* @__PURE__ */jsxRuntime.jsxs(Root$7, {
|
|
6046
6057
|
...restProps,
|
|
6058
|
+
$animate: animate,
|
|
6047
6059
|
$padding: padding,
|
|
6048
6060
|
$position: position,
|
|
6049
6061
|
"aria-labelledby": labelId,
|
|
@@ -6056,7 +6068,6 @@ const Dialog = react.forwardRef(function Dialog2(props, ref) {
|
|
|
6056
6068
|
ref,
|
|
6057
6069
|
role: "dialog",
|
|
6058
6070
|
zOffset,
|
|
6059
|
-
animate,
|
|
6060
6071
|
children: [/* @__PURE__ */jsxRuntime.jsx("div", {
|
|
6061
6072
|
ref: preDivRef,
|
|
6062
6073
|
tabIndex: 0
|
|
@@ -7106,13 +7117,19 @@ const STATUS_CARD_TONE = {
|
|
|
7106
7117
|
success: "positive",
|
|
7107
7118
|
info: "primary"
|
|
7108
7119
|
};
|
|
7120
|
+
const BUTTON_TONE = {
|
|
7121
|
+
error: "critical",
|
|
7122
|
+
warning: "caution",
|
|
7123
|
+
success: "positive",
|
|
7124
|
+
info: "primary"
|
|
7125
|
+
};
|
|
7109
7126
|
const ROLES = {
|
|
7110
7127
|
error: "alert",
|
|
7111
7128
|
warning: "alert",
|
|
7112
7129
|
success: "alert",
|
|
7113
7130
|
info: "alert"
|
|
7114
7131
|
};
|
|
7115
|
-
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);
|
|
7116
7133
|
const TextBox = styled__default.default(Flex)(_b$2 || (_b$2 = __template$3(["\n overflow-x: auto;\n"])));
|
|
7117
7134
|
function Toast(props) {
|
|
7118
7135
|
const {
|
|
@@ -7125,6 +7142,7 @@ function Toast(props) {
|
|
|
7125
7142
|
...restProps
|
|
7126
7143
|
} = props;
|
|
7127
7144
|
const cardTone = status ? STATUS_CARD_TONE[status] : "default";
|
|
7145
|
+
const buttonTone = status ? BUTTON_TONE[status] : "default";
|
|
7128
7146
|
const role = status ? ROLES[status] : "status";
|
|
7129
7147
|
return /* @__PURE__ */jsxRuntime.jsx(Root$2, {
|
|
7130
7148
|
"data-ui": "Toast",
|
|
@@ -7158,6 +7176,7 @@ function Toast(props) {
|
|
|
7158
7176
|
icon: icons.CloseIcon,
|
|
7159
7177
|
mode: "bleed",
|
|
7160
7178
|
padding: 2,
|
|
7179
|
+
tone: buttonTone,
|
|
7161
7180
|
onClick: onClose,
|
|
7162
7181
|
style: {
|
|
7163
7182
|
verticalAlign: "top"
|
|
@@ -7267,12 +7286,14 @@ function ToastProvider(props) {
|
|
|
7267
7286
|
} = _ref12;
|
|
7268
7287
|
return /* @__PURE__ */jsxRuntime.jsx(framerMotion.motion.div, {
|
|
7269
7288
|
animate: {
|
|
7270
|
-
opacity: 1,
|
|
7289
|
+
opacity: [0, 1, 1],
|
|
7290
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [0, 0, 1],
|
|
7271
7291
|
y: 0,
|
|
7272
7292
|
scale: 1
|
|
7273
7293
|
},
|
|
7274
7294
|
exit: {
|
|
7275
|
-
opacity: 0,
|
|
7295
|
+
opacity: [1, 1, 0],
|
|
7296
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [1, 0, 0],
|
|
7276
7297
|
scale: 0.5,
|
|
7277
7298
|
transition: {
|
|
7278
7299
|
duration: 0.2
|
|
@@ -7280,8 +7301,10 @@ function ToastProvider(props) {
|
|
|
7280
7301
|
},
|
|
7281
7302
|
initial: {
|
|
7282
7303
|
opacity: 0,
|
|
7304
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: 0,
|
|
7283
7305
|
y: 32,
|
|
7284
|
-
scale: 0.25
|
|
7306
|
+
scale: 0.25,
|
|
7307
|
+
willChange: "transform"
|
|
7285
7308
|
},
|
|
7286
7309
|
layout: "position",
|
|
7287
7310
|
transition: {
|