@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/LICENSE
CHANGED
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: {
|
|
@@ -1543,7 +1549,7 @@ function textInputRepresentationStyle(props) {
|
|
|
1543
1549
|
color,
|
|
1544
1550
|
input
|
|
1545
1551
|
} = getTheme_v2(props.theme);
|
|
1546
|
-
return 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({
|
|
1552
|
+
return 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({
|
|
1547
1553
|
color: color.input.default.enabled.border,
|
|
1548
1554
|
width: input.border.width
|
|
1549
1555
|
}), color.input.invalid.enabled.bg, color.input.invalid.enabled.fg, focusRingBorderStyle({
|
|
@@ -1557,12 +1563,18 @@ function textInputRepresentationStyle(props) {
|
|
|
1557
1563
|
focusRing: input.text.focusRing
|
|
1558
1564
|
}), $unstableDisableFocusRing ? void 0 : focusRingStyle({
|
|
1559
1565
|
focusRing: input.text.focusRing
|
|
1560
|
-
}), color.input.default.disabled.bg, color.input.default.disabled.fg, focusRingBorderStyle({
|
|
1566
|
+
}), color.input.default.disabled.bg, color.input.default.disabled.fg, color.input.default.disabled.fg, focusRingBorderStyle({
|
|
1561
1567
|
color: color.input.default.disabled.border,
|
|
1562
1568
|
width: input.border.width
|
|
1563
|
-
}), color.input.
|
|
1569
|
+
}), color.input.invalid.disabled.bg, color.input.invalid.disabled.fg, color.input.invalid.disabled.fg, focusRingBorderStyle({
|
|
1570
|
+
color: color.input.invalid.disabled.border,
|
|
1571
|
+
width: input.border.width
|
|
1572
|
+
}), 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({
|
|
1564
1573
|
color: color.input.default.hovered.border,
|
|
1565
1574
|
width: input.border.width
|
|
1575
|
+
}), focusRingBorderStyle({
|
|
1576
|
+
color: color.input.invalid.hovered.border,
|
|
1577
|
+
width: input.border.width
|
|
1566
1578
|
}));
|
|
1567
1579
|
}
|
|
1568
1580
|
function responsiveMarginStyle(props) {
|
|
@@ -2420,7 +2432,7 @@ const Button = forwardRef(function Button2(props, ref) {
|
|
|
2420
2432
|
iconRight,
|
|
2421
2433
|
justify: justifyProp = "center",
|
|
2422
2434
|
loading,
|
|
2423
|
-
mode = "
|
|
2435
|
+
mode = "default",
|
|
2424
2436
|
padding: paddingProp = 3,
|
|
2425
2437
|
paddingX: paddingXProp,
|
|
2426
2438
|
paddingY: paddingYProp,
|
|
@@ -2486,16 +2498,13 @@ const Button = forwardRef(function Button2(props, ref) {
|
|
|
2486
2498
|
children: [icon && /* @__PURE__ */jsxs(Text, {
|
|
2487
2499
|
size: fontSize,
|
|
2488
2500
|
children: [isValidElement(icon) && icon, isValidElementType(icon) && createElement(icon)]
|
|
2489
|
-
}), text && /* @__PURE__ */jsx(
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
weight: button.textWeight,
|
|
2497
|
-
children: text
|
|
2498
|
-
})
|
|
2501
|
+
}), text && /* @__PURE__ */jsx(Text, {
|
|
2502
|
+
muted,
|
|
2503
|
+
align: textAlign,
|
|
2504
|
+
size: fontSize,
|
|
2505
|
+
textOverflow: "ellipsis",
|
|
2506
|
+
weight: button.textWeight,
|
|
2507
|
+
children: text
|
|
2499
2508
|
}), iconRight && /* @__PURE__ */jsxs(Text, {
|
|
2500
2509
|
size: fontSize,
|
|
2501
2510
|
children: [isValidElement(iconRight) && iconRight, isValidElementType(iconRight) && createElement(iconRight)]
|
|
@@ -2922,7 +2931,7 @@ function headingBaseStyle(props) {
|
|
|
2922
2931
|
const {
|
|
2923
2932
|
font
|
|
2924
2933
|
} = getTheme_v2(props.theme);
|
|
2925
|
-
return 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 && css(_a$s || (_a$s = __template$s(["\n color: var(--card-accent-fg-color);\n "]))), $muted && css(_b$g || (_b$g = __template$s(["\n color: var(--card-muted-fg-color);\n "]))), font.code.family);
|
|
2934
|
+
return 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 && css(_a$s || (_a$s = __template$s(["\n color: var(--card-accent-fg-color);\n "]))), $muted && css(_b$g || (_b$g = __template$s(["\n color: var(--card-muted-fg-color);\n "]))), font.code.family, font.heading.weights.bold);
|
|
2926
2935
|
}
|
|
2927
2936
|
var __freeze$r = Object.freeze;
|
|
2928
2937
|
var __defProp$s = Object.defineProperty;
|
|
@@ -3939,7 +3948,7 @@ var __template$m = (cooked, raw) => __freeze$m(__defProp$m(cooked, "raw", {
|
|
|
3939
3948
|
value: __freeze$m(raw || cooked.slice())
|
|
3940
3949
|
}));
|
|
3941
3950
|
var _a$m;
|
|
3942
|
-
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);
|
|
3943
3952
|
const PopoverCard = memo(forwardRef(function PopoverCard2(props, ref) {
|
|
3944
3953
|
const {
|
|
3945
3954
|
__unstable_margins: marginsProp,
|
|
@@ -3979,8 +3988,9 @@ const PopoverCard = memo(forwardRef(function PopoverCard2(props, ref) {
|
|
|
3979
3988
|
top: y,
|
|
3980
3989
|
width,
|
|
3981
3990
|
zIndex,
|
|
3991
|
+
willChange: animate ? "transform" : void 0,
|
|
3982
3992
|
...style
|
|
3983
|
-
}), [originX, originY, strategy, style, width, x, y, zIndex]);
|
|
3993
|
+
}), [animate, originX, originY, strategy, style, width, x, y, zIndex]);
|
|
3984
3994
|
const arrowStyle = useMemo(() => ({
|
|
3985
3995
|
left: arrowX !== null ? arrowX : void 0,
|
|
3986
3996
|
top: arrowY !== null ? arrowY : void 0,
|
|
@@ -4492,9 +4502,9 @@ function switchRepresentationStyles(props) {
|
|
|
4492
4502
|
color,
|
|
4493
4503
|
input
|
|
4494
4504
|
} = getTheme_v2(props.theme);
|
|
4495
|
-
return 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({
|
|
4505
|
+
return 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({
|
|
4496
4506
|
focusRing: input.switch.focusRing
|
|
4497
|
-
}), 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);
|
|
4507
|
+
}), 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);
|
|
4498
4508
|
}
|
|
4499
4509
|
function switchTrackStyles(props) {
|
|
4500
4510
|
const {
|
|
@@ -4827,7 +4837,7 @@ var __template$g = (cooked, raw) => __freeze$g(__defProp$g(cooked, "raw", {
|
|
|
4827
4837
|
value: __freeze$g(raw || cooked.slice())
|
|
4828
4838
|
}));
|
|
4829
4839
|
var _a$g;
|
|
4830
|
-
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);
|
|
4831
4841
|
const TooltipCard = memo(forwardRef(function TooltipCard2(props, ref) {
|
|
4832
4842
|
const {
|
|
4833
4843
|
animate,
|
|
@@ -4849,8 +4859,9 @@ const TooltipCard = memo(forwardRef(function TooltipCard2(props, ref) {
|
|
|
4849
4859
|
const rootStyle = useMemo(() => ({
|
|
4850
4860
|
originX,
|
|
4851
4861
|
originY,
|
|
4862
|
+
willChange: animate ? "transform" : void 0,
|
|
4852
4863
|
...style
|
|
4853
|
-
}), [originX, originY, style]);
|
|
4864
|
+
}), [animate, originX, originY, style]);
|
|
4854
4865
|
const arrowStyle = useMemo(() => ({
|
|
4855
4866
|
left: arrowX !== null ? arrowX : void 0,
|
|
4856
4867
|
top: arrowY !== null ? arrowY : void 0,
|
|
@@ -5808,7 +5819,7 @@ function responsiveDialogPositionStyle(props) {
|
|
|
5808
5819
|
}));
|
|
5809
5820
|
}
|
|
5810
5821
|
function animationDialogStyle(props) {
|
|
5811
|
-
if (!props
|
|
5822
|
+
if (!props.$animate) return css(_a$c || (_a$c = __template$c([""])));
|
|
5812
5823
|
return 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 "])));
|
|
5813
5824
|
}
|
|
5814
5825
|
const key$3 = Symbol.for("@sanity/ui/context/dialog");
|
|
@@ -6031,6 +6042,7 @@ const Dialog = forwardRef(function Dialog2(props, ref) {
|
|
|
6031
6042
|
__unstable_name: portalProp,
|
|
6032
6043
|
children: /* @__PURE__ */jsxs(Root$7, {
|
|
6033
6044
|
...restProps,
|
|
6045
|
+
$animate: animate,
|
|
6034
6046
|
$padding: padding,
|
|
6035
6047
|
$position: position,
|
|
6036
6048
|
"aria-labelledby": labelId,
|
|
@@ -6043,7 +6055,6 @@ const Dialog = forwardRef(function Dialog2(props, ref) {
|
|
|
6043
6055
|
ref,
|
|
6044
6056
|
role: "dialog",
|
|
6045
6057
|
zOffset,
|
|
6046
|
-
animate,
|
|
6047
6058
|
children: [/* @__PURE__ */jsx("div", {
|
|
6048
6059
|
ref: preDivRef,
|
|
6049
6060
|
tabIndex: 0
|
|
@@ -7093,13 +7104,19 @@ const STATUS_CARD_TONE = {
|
|
|
7093
7104
|
success: "positive",
|
|
7094
7105
|
info: "primary"
|
|
7095
7106
|
};
|
|
7107
|
+
const BUTTON_TONE = {
|
|
7108
|
+
error: "critical",
|
|
7109
|
+
warning: "caution",
|
|
7110
|
+
success: "positive",
|
|
7111
|
+
info: "primary"
|
|
7112
|
+
};
|
|
7096
7113
|
const ROLES = {
|
|
7097
7114
|
error: "alert",
|
|
7098
7115
|
warning: "alert",
|
|
7099
7116
|
success: "alert",
|
|
7100
7117
|
info: "alert"
|
|
7101
7118
|
};
|
|
7102
|
-
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);
|
|
7103
7120
|
const TextBox = styled(Flex)(_b$2 || (_b$2 = __template$3(["\n overflow-x: auto;\n"])));
|
|
7104
7121
|
function Toast(props) {
|
|
7105
7122
|
const {
|
|
@@ -7112,6 +7129,7 @@ function Toast(props) {
|
|
|
7112
7129
|
...restProps
|
|
7113
7130
|
} = props;
|
|
7114
7131
|
const cardTone = status ? STATUS_CARD_TONE[status] : "default";
|
|
7132
|
+
const buttonTone = status ? BUTTON_TONE[status] : "default";
|
|
7115
7133
|
const role = status ? ROLES[status] : "status";
|
|
7116
7134
|
return /* @__PURE__ */jsx(Root$2, {
|
|
7117
7135
|
"data-ui": "Toast",
|
|
@@ -7145,6 +7163,7 @@ function Toast(props) {
|
|
|
7145
7163
|
icon: CloseIcon,
|
|
7146
7164
|
mode: "bleed",
|
|
7147
7165
|
padding: 2,
|
|
7166
|
+
tone: buttonTone,
|
|
7148
7167
|
onClick: onClose,
|
|
7149
7168
|
style: {
|
|
7150
7169
|
verticalAlign: "top"
|
|
@@ -7254,12 +7273,14 @@ function ToastProvider(props) {
|
|
|
7254
7273
|
} = _ref12;
|
|
7255
7274
|
return /* @__PURE__ */jsx(motion.div, {
|
|
7256
7275
|
animate: {
|
|
7257
|
-
opacity: 1,
|
|
7276
|
+
opacity: [0, 1, 1],
|
|
7277
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [0, 0, 1],
|
|
7258
7278
|
y: 0,
|
|
7259
7279
|
scale: 1
|
|
7260
7280
|
},
|
|
7261
7281
|
exit: {
|
|
7262
|
-
opacity: 0,
|
|
7282
|
+
opacity: [1, 1, 0],
|
|
7283
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: [1, 0, 0],
|
|
7263
7284
|
scale: 0.5,
|
|
7264
7285
|
transition: {
|
|
7265
7286
|
duration: 0.2
|
|
@@ -7267,8 +7288,10 @@ function ToastProvider(props) {
|
|
|
7267
7288
|
},
|
|
7268
7289
|
initial: {
|
|
7269
7290
|
opacity: 0,
|
|
7291
|
+
[POPOVER_MOTION_CONTENT_OPACITY_PROPERTY]: 0,
|
|
7270
7292
|
y: 32,
|
|
7271
|
-
scale: 0.25
|
|
7293
|
+
scale: 0.25,
|
|
7294
|
+
willChange: "transform"
|
|
7272
7295
|
},
|
|
7273
7296
|
layout: "position",
|
|
7274
7297
|
transition: {
|