@sanity/ui 2.3.6 → 2.4.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/dist/_chunks-cjs/getTheme_v2.js +319 -0
- package/dist/_chunks-cjs/getTheme_v2.js.map +1 -0
- package/dist/_chunks-es/getTheme_v2.mjs +320 -0
- package/dist/_chunks-es/getTheme_v2.mjs.map +1 -0
- package/dist/_legacy/getTheme_v2.esm.js +320 -0
- package/dist/_legacy/getTheme_v2.esm.js.map +1 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +51 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +51 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +51 -12
- package/dist/index.mjs.map +1 -1
- package/dist/theme.esm.js +4 -315
- package/dist/theme.esm.js.map +1 -1
- package/dist/theme.js +36 -349
- package/dist/theme.js.map +1 -1
- package/dist/theme.mjs +4 -315
- package/dist/theme.mjs.map +1 -1
- package/package.json +1 -1
- package/src/core/components/toast/styles.ts +61 -0
- package/src/core/components/toast/toast.tsx +11 -16
- package/src/core/components/toast/toastProvider.tsx +1 -0
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
3
|
-
var theme = require("@sanity/ui/theme"), jsxRuntime = require("react/jsx-runtime"), react = require("react"), ReactIs = require("react-is"), styledComponents = require("styled-components"), icons = require("@sanity/icons"), Refractor = require("react-refractor"), reactDom$1 = require("@floating-ui/react-dom"), framerMotion = require("framer-motion"), reactDom = require("react-dom");
|
|
3
|
+
var theme = require("@sanity/ui/theme"), jsxRuntime = require("react/jsx-runtime"), react = require("react"), ReactIs = require("react-is"), styledComponents = require("styled-components"), icons = require("@sanity/icons"), Refractor = require("react-refractor"), reactDom$1 = require("@floating-ui/react-dom"), framerMotion = require("framer-motion"), reactDom = require("react-dom"), getTheme_v2 = require("./_chunks-cjs/getTheme_v2.js");
|
|
4
4
|
function _interopDefaultCompat(e) {
|
|
5
5
|
return e && typeof e == "object" && "default" in e ? e : { default: e };
|
|
6
6
|
}
|
|
@@ -6139,7 +6139,49 @@ const CustomInline = styledComponents.styled(Inline)`
|
|
|
6139
6139
|
children: props.children
|
|
6140
6140
|
}
|
|
6141
6141
|
);
|
|
6142
|
-
}),
|
|
6142
|
+
}), TextBox = styledComponents.styled(Flex)`
|
|
6143
|
+
overflow-x: auto;
|
|
6144
|
+
`, loadingAnimation = styledComponents.keyframes`
|
|
6145
|
+
0% {
|
|
6146
|
+
width: 0;
|
|
6147
|
+
}
|
|
6148
|
+
100% {
|
|
6149
|
+
width: 100%;
|
|
6150
|
+
}
|
|
6151
|
+
`, LOADING_BAR_HEIGHT = 2;
|
|
6152
|
+
function rootStyles(props) {
|
|
6153
|
+
const { color } = getTheme_v2.getTheme_v2(props.theme), loadingBarColor = color.button.default[props.tone].enabled.bg;
|
|
6154
|
+
return props.$duration ? styledComponents.css`
|
|
6155
|
+
pointer-events: all;
|
|
6156
|
+
width: 100%;
|
|
6157
|
+
position: relative;
|
|
6158
|
+
overflow: hidden;
|
|
6159
|
+
overflow: clip;
|
|
6160
|
+
padding-bottom: ${LOADING_BAR_HEIGHT}px;
|
|
6161
|
+
&::before {
|
|
6162
|
+
content: '';
|
|
6163
|
+
position: absolute;
|
|
6164
|
+
bottom: 0px;
|
|
6165
|
+
height: ${LOADING_BAR_HEIGHT}px;
|
|
6166
|
+
background: ${loadingBarColor};
|
|
6167
|
+
animation-name: ${loadingAnimation};
|
|
6168
|
+
animation-duration: ${props.$duration}ms;
|
|
6169
|
+
animation-fill-mode: both;
|
|
6170
|
+
}
|
|
6171
|
+
|
|
6172
|
+
& > * {
|
|
6173
|
+
opacity: var(${POPOVER_MOTION_CONTENT_OPACITY_PROPERTY}, 1);
|
|
6174
|
+
will-change: opacity;
|
|
6175
|
+
}
|
|
6176
|
+
` : styledComponents.css`
|
|
6177
|
+
pointer-events: all;
|
|
6178
|
+
& > * {
|
|
6179
|
+
opacity: var(${POPOVER_MOTION_CONTENT_OPACITY_PROPERTY}, 1);
|
|
6180
|
+
will-change: opacity;
|
|
6181
|
+
}
|
|
6182
|
+
`;
|
|
6183
|
+
}
|
|
6184
|
+
const STATUS_CARD_TONE = {
|
|
6143
6185
|
error: "critical",
|
|
6144
6186
|
warning: "caution",
|
|
6145
6187
|
success: "positive",
|
|
@@ -6154,17 +6196,11 @@ const CustomInline = styledComponents.styled(Inline)`
|
|
|
6154
6196
|
warning: "alert",
|
|
6155
6197
|
success: "alert",
|
|
6156
6198
|
info: "alert"
|
|
6157
|
-
}, Root$2 = styledComponents.styled(Card)
|
|
6158
|
-
|
|
6159
|
-
|
|
6160
|
-
opacity: var(${POPOVER_MOTION_CONTENT_OPACITY_PROPERTY}, 1);
|
|
6161
|
-
will-change: opacity;
|
|
6162
|
-
}
|
|
6163
|
-
`, TextBox = styledComponents.styled(Flex)`
|
|
6164
|
-
overflow-x: auto;
|
|
6165
|
-
`;
|
|
6199
|
+
}, Root$2 = styledComponents.styled(Card)(
|
|
6200
|
+
rootStyles
|
|
6201
|
+
);
|
|
6166
6202
|
function Toast(props) {
|
|
6167
|
-
const { closable, description, onClose, radius = 3, title, status, ...restProps } = props, cardTone = status ? STATUS_CARD_TONE[status] : "default", buttonTone = status ? BUTTON_TONE[status] : "default", role = status ? ROLES[status] : "status";
|
|
6203
|
+
const { closable, description, duration, onClose, radius = 3, title, status, ...restProps } = props, cardTone = status ? STATUS_CARD_TONE[status] : "default", buttonTone = status ? BUTTON_TONE[status] : "default", role = status ? ROLES[status] : "status";
|
|
6168
6204
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
6169
6205
|
Root$2,
|
|
6170
6206
|
{
|
|
@@ -6175,6 +6211,7 @@ function Toast(props) {
|
|
|
6175
6211
|
radius,
|
|
6176
6212
|
shadow: 2,
|
|
6177
6213
|
tone: cardTone,
|
|
6214
|
+
$duration: duration,
|
|
6178
6215
|
children: /* @__PURE__ */ jsxRuntime.jsxs(Flex, { align: "flex-start", children: [
|
|
6179
6216
|
/* @__PURE__ */ jsxRuntime.jsx(TextBox, { flex: 1, padding: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(Stack, { space: 3, children: [
|
|
6180
6217
|
title && /* @__PURE__ */ jsxRuntime.jsx(Text, { size: 1, weight: "medium", children: title }),
|
|
@@ -6290,7 +6327,8 @@ function ToastProvider(props) {
|
|
|
6290
6327
|
description: params.description,
|
|
6291
6328
|
onClose: dismiss,
|
|
6292
6329
|
status: params.status,
|
|
6293
|
-
title: params.title
|
|
6330
|
+
title: params.title,
|
|
6331
|
+
duration: params.duration
|
|
6294
6332
|
}
|
|
6295
6333
|
)
|
|
6296
6334
|
},
|