@robert-stackflow/oneui 0.6.40 → 0.6.42

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +9 -1
  3. package/components/AccountItem.module.css +103 -103
  4. package/components/AppShell.module.css +223 -223
  5. package/components/Badge.module.css +30 -30
  6. package/components/BarChart.module.css +35 -35
  7. package/components/Breadcrumb.module.css +97 -97
  8. package/components/Button.module.css +120 -120
  9. package/components/Checkbox.module.css +95 -95
  10. package/components/Control.module.css +86 -86
  11. package/components/DataTable.module.css +75 -75
  12. package/components/Form.d.ts +5 -1
  13. package/components/Form.js +5 -1
  14. package/components/FormField.js +1 -0
  15. package/components/HierarchyPicker.module.css +185 -185
  16. package/components/Indicator.module.css +83 -83
  17. package/components/Layout.module.css +82 -82
  18. package/components/Markdown.module.css +227 -227
  19. package/components/NativeForm.d.ts +10 -0
  20. package/components/NativeForm.js +155 -0
  21. package/components/NavBar.module.css +130 -130
  22. package/components/Progress.module.css +33 -33
  23. package/components/RadioGroup.module.css +87 -87
  24. package/components/RangeSlider.module.css +141 -141
  25. package/components/ResizablePanel.module.css +101 -101
  26. package/components/ResourceCard.module.css +98 -98
  27. package/components/Slider.module.css +19 -19
  28. package/components/Steps.module.css +176 -176
  29. package/components/Tab.module.css +148 -148
  30. package/components/ThemePicker.module.css +178 -178
  31. package/components/TimeColumns.module.css +47 -47
  32. package/components/Timeline.module.css +202 -202
  33. package/components/Toast.d.ts +7 -2
  34. package/components/Toast.js +146 -98
  35. package/components/Toast.module.css +182 -85
  36. package/components/ToastProvider.js +19 -62
  37. package/components/ToastStack.d.ts +8 -0
  38. package/components/ToastStack.js +190 -0
  39. package/components/TreeTable.module.css +57 -57
  40. package/components/UptimeChart.module.css +15 -15
  41. package/components/field.d.ts +1 -1
  42. package/components/field.js +2 -1
  43. package/components/form-validation.d.ts +4 -0
  44. package/components/form-validation.js +22 -0
  45. package/components/index.d.ts +4 -2
  46. package/components/index.js +9 -3
  47. package/package.json +1 -1
  48. package/styles/blue.css +270 -270
@@ -13,7 +13,9 @@ import {
13
13
  Info,
14
14
  TriangleAlert,
15
15
  CircleX,
16
- LoaderCircle
16
+ LoaderCircle,
17
+ ChevronDown,
18
+ ChevronUp
17
19
  } from "lucide-react";
18
20
  import { toastMotion, cancelMotion } from "./motion.js";
19
21
  import s from "./Toast.module.css";
@@ -35,37 +37,51 @@ function Toast({
35
37
  stackHidden = false,
36
38
  paused = false,
37
39
  onHoverChange,
38
- onHeightChange
40
+ onHeightChange,
41
+ embedded = false,
42
+ stackHeight,
43
+ stackCount = 1,
44
+ onStackToggle
39
45
  }) {
40
46
  const { text } = useUIText();
41
- const ref = useRef(null), current = useRef(toast), timer = useRef(void 0), pendingId = useRef(null);
47
+ const ref = useRef(null), content = useRef(null), current = useRef(toast), timer = useRef(void 0), pendingId = useRef(null);
48
+ const remaining = useRef(5e3), deadline = useRef(0);
49
+ const pausedState = useRef(paused);
50
+ pausedState.current = paused;
42
51
  const [pending, setPending] = useState(false), [error, setError] = useState("");
43
52
  current.current = toast;
44
- const dismiss = () => {
53
+ const pauseClock = () => {
45
54
  clearTimeout(timer.current);
55
+ if (deadline.current)
56
+ remaining.current = Math.max(0, deadline.current - performance.now());
57
+ deadline.current = 0;
58
+ };
59
+ const dismiss = () => {
60
+ pauseClock();
46
61
  const message = current.current, node = ref.current;
47
62
  if (!message) return;
48
63
  void toastMotion(node, "exit", position).then((done) => {
49
- if (done && current.current?.id === message.id) {
64
+ if (done && current.current === message) {
50
65
  if (node.matches(":popover-open")) node.hidePopover();
51
66
  onDismiss(message.id);
52
67
  }
53
68
  });
54
69
  };
55
70
  const arm = () => {
56
- clearTimeout(timer.current);
71
+ pauseClock();
57
72
  const message = current.current, node = ref.current;
58
- if (message && !paused && !message.closing && !message.options?.persistent && pendingId.current !== message.id && !node?.matches(":hover") && !node?.contains(document.activeElement))
59
- timer.current = setTimeout(
60
- dismiss,
61
- Math.max(0, message.options?.duration ?? 5e3)
62
- );
73
+ if (message && !pausedState.current && !message.closing && !message.options?.persistent && pendingId.current !== message.id && !node?.matches(":hover") && !node?.contains(document.activeElement)) {
74
+ deadline.current = performance.now() + remaining.current;
75
+ timer.current = setTimeout(dismiss, remaining.current);
76
+ }
63
77
  };
64
78
  useLayoutEffect(() => {
65
79
  const node = ref.current;
66
80
  setPending(false);
67
81
  setError("");
68
82
  pendingId.current = null;
83
+ pauseClock();
84
+ remaining.current = Math.max(0, toast?.options?.duration ?? 5e3);
69
85
  if (!toast) {
70
86
  if (node.matches(":popover-open")) node.hidePopover();
71
87
  return;
@@ -75,10 +91,11 @@ function Toast({
75
91
  return;
76
92
  }
77
93
  const already = node.matches(":popover-open");
78
- if (!already) node.showPopover();
79
- void toastMotion(node, already ? "update" : "enter", position);
94
+ if (!embedded && !already) node.showPopover();
95
+ void toastMotion(node, node.dataset.entered ? "update" : "enter", position);
96
+ node.dataset.entered = "true";
80
97
  arm();
81
- return () => clearTimeout(timer.current);
98
+ return pauseClock;
82
99
  }, [toast, position]);
83
100
  useEffect(() => {
84
101
  const node = ref.current;
@@ -90,32 +107,39 @@ function Toast({
90
107
  const heightChange = useRef(onHeightChange);
91
108
  heightChange.current = onHeightChange;
92
109
  useLayoutEffect(() => {
93
- const node = ref.current;
110
+ const node = content.current;
94
111
  const observer = new ResizeObserver(
95
- () => heightChange.current?.(node.offsetHeight)
112
+ () => heightChange.current?.(node.offsetHeight + 2)
96
113
  );
97
114
  observer.observe(node);
98
115
  return () => observer.disconnect();
99
116
  }, []);
100
117
  useEffect(() => {
101
- if (paused) clearTimeout(timer.current);
118
+ if (paused) pauseClock();
102
119
  else arm();
103
120
  }, [paused]);
104
121
  const execute = async () => {
105
122
  const message = current.current, action2 = message?.options?.action;
106
123
  if (!message || !action2 || pendingId.current === message.id) return;
107
- clearTimeout(timer.current);
124
+ pauseClock();
108
125
  pendingId.current = message.id;
109
126
  setPending(true);
110
127
  setError("");
111
128
  try {
112
129
  await action2.onClick();
113
- if (current.current?.id === message.id && action2.closeOnClick !== false)
130
+ if (current.current === message && action2.closeOnClick !== false)
114
131
  dismiss();
115
132
  } catch {
116
- if (current.current?.id === message.id) setError("\u64CD\u4F5C\u672A\u5B8C\u6210\uFF0C\u8BF7\u91CD\u8BD5");
133
+ if (current.current === message)
134
+ setError(
135
+ text(
136
+ "\u64CD\u4F5C\u672A\u5B8C\u6210\uFF0C\u8BF7\u91CD\u8BD5",
137
+ "Action failed. Please retry.",
138
+ "\u64CD\u4F5C\u672A\u5B8C\u6210\uFF0C\u8ACB\u91CD\u8A66"
139
+ )
140
+ );
117
141
  } finally {
118
- if (current.current?.id === message.id) {
142
+ if (current.current === message) {
119
143
  pendingId.current = null;
120
144
  setPending(false);
121
145
  arm();
@@ -126,90 +150,114 @@ function Toast({
126
150
  const icon = options.icon === false ? null : options.icon === true || options.icon === void 0 ? tone !== "neutral" || options.icon === true ? /* @__PURE__ */ jsx(Icon, {}) : null : options.icon;
127
151
  const style = {
128
152
  "--toast-stack-offset": `${stackOffset}px`,
129
- "--toast-stack-scale": stackExpanded ? 1 : Math.max(0.85, 1 - stackIndex * 0.045),
153
+ "--toast-stack-scale": stackExpanded ? 1 : Math.max(0.85, 1 - stackIndex * 0.035),
154
+ "--toast-stack-height": stackHeight === void 0 ? void 0 : `${stackHeight}px`,
155
+ zIndex: 1e3 - stackIndex,
130
156
  "--toast-icon-color": options.iconColor,
131
157
  "--toast-text-color": options.textColor
132
158
  };
133
- return createPortal(
134
- /* @__PURE__ */ jsxs(
135
- "div",
136
- {
137
- ref,
138
- popover: "manual",
139
- className: s.toast,
140
- "data-position": position,
141
- "data-stack-index": stackIndex,
142
- "data-stack-expanded": stackExpanded,
143
- "data-stack-hidden": stackHidden,
144
- inert: stackHidden,
145
- "aria-hidden": stackHidden || void 0,
146
- "data-tone": tone,
147
- "data-variant": options.variant || "solid",
148
- role: "status",
149
- "aria-live": "polite",
150
- "aria-atomic": "true",
151
- style,
152
- onPointerEnter: () => {
153
- clearTimeout(timer.current);
154
- onHoverChange?.(true);
155
- },
156
- onPointerLeave: () => {
159
+ const element = /* @__PURE__ */ jsx(
160
+ "div",
161
+ {
162
+ ref,
163
+ popover: embedded ? void 0 : "manual",
164
+ className: s.toast,
165
+ "data-position": position,
166
+ "data-toast": true,
167
+ "data-embedded": embedded,
168
+ "data-stack-index": stackIndex,
169
+ "data-stack-expanded": stackExpanded,
170
+ "data-stack-hidden": stackHidden,
171
+ inert: stackHidden || embedded && !stackExpanded && stackIndex > 0,
172
+ "aria-hidden": stackHidden || embedded && !stackExpanded && stackIndex > 0 || void 0,
173
+ "data-tone": tone,
174
+ "data-variant": options.variant || "solid",
175
+ role: "status",
176
+ "aria-live": "polite",
177
+ "aria-atomic": "true",
178
+ style,
179
+ onPointerEnter: () => {
180
+ pauseClock();
181
+ onHoverChange?.(true);
182
+ },
183
+ onPointerLeave: () => {
184
+ onHoverChange?.(false);
185
+ arm();
186
+ },
187
+ onFocus: () => {
188
+ pauseClock();
189
+ onHoverChange?.(true);
190
+ },
191
+ onBlur: (e) => {
192
+ if (!e.currentTarget.contains(e.relatedTarget)) {
157
193
  onHoverChange?.(false);
158
- arm();
159
- },
160
- onFocus: () => {
161
- clearTimeout(timer.current);
162
- onHoverChange?.(true);
163
- },
164
- onBlur: (e) => {
165
- if (!e.currentTarget.contains(e.relatedTarget)) {
166
- onHoverChange?.(false);
167
- queueMicrotask(arm);
194
+ queueMicrotask(arm);
195
+ }
196
+ },
197
+ onKeyDown: (e) => {
198
+ if (e.key === "Escape" && !(embedded && stackExpanded)) {
199
+ e.stopPropagation();
200
+ dismiss();
201
+ }
202
+ },
203
+ children: /* @__PURE__ */ jsxs("div", { ref: content, className: s.content, children: [
204
+ icon && /* @__PURE__ */ jsx("span", { className: s.icon, "aria-hidden": "true", "data-toast-icon": true, children: icon }),
205
+ /* @__PURE__ */ jsxs("div", { className: s.copy, "data-toast-copy": true, children: [
206
+ options.title && /* @__PURE__ */ jsx("strong", { children: options.title }),
207
+ /* @__PURE__ */ jsx("span", { children: toast?.message }),
208
+ error && /* @__PURE__ */ jsx("small", { role: "alert", children: error })
209
+ ] }),
210
+ action && /* @__PURE__ */ jsxs(
211
+ "button",
212
+ {
213
+ className: s.action,
214
+ type: "button",
215
+ "aria-label": action.label,
216
+ disabled: pending,
217
+ "data-icon-only": action.display === "icon",
218
+ onClick: () => void execute(),
219
+ children: [
220
+ pending ? /* @__PURE__ */ jsx(LoaderCircle, { className: s.spin }) : action.display !== "text" && action.icon,
221
+ action.display !== "icon" && /* @__PURE__ */ jsx("span", { children: action.label })
222
+ ]
168
223
  }
169
- },
170
- onKeyDown: (e) => {
171
- if (e.key === "Escape") {
172
- e.stopPropagation();
173
- dismiss();
224
+ ),
225
+ stackCount > 1 && onStackToggle && /* @__PURE__ */ jsxs(
226
+ "button",
227
+ {
228
+ className: s.expand,
229
+ type: "button",
230
+ "data-toast-expand": true,
231
+ "aria-label": stackExpanded ? text("\u6536\u8D77\u901A\u77E5", "Collapse notifications", "\u6536\u8D77\u901A\u77E5") : text(
232
+ `\u5C55\u5F00 ${stackCount} \u6761\u901A\u77E5`,
233
+ `Expand ${stackCount} notifications`,
234
+ `\u5C55\u958B ${stackCount} \u689D\u901A\u77E5`
235
+ ),
236
+ "aria-expanded": stackExpanded,
237
+ onClick: onStackToggle,
238
+ children: [
239
+ /* @__PURE__ */ jsxs("span", { children: [
240
+ "+",
241
+ stackCount - 1
242
+ ] }),
243
+ stackExpanded ? /* @__PURE__ */ jsx(ChevronUp, {}) : /* @__PURE__ */ jsx(ChevronDown, {})
244
+ ]
174
245
  }
175
- },
176
- children: [
177
- icon && /* @__PURE__ */ jsx("span", { className: s.icon, "aria-hidden": "true", "data-toast-icon": true, children: icon }),
178
- /* @__PURE__ */ jsxs("div", { className: s.copy, "data-toast-copy": true, children: [
179
- options.title && /* @__PURE__ */ jsx("strong", { children: options.title }),
180
- /* @__PURE__ */ jsx("span", { children: toast?.message }),
181
- error && /* @__PURE__ */ jsx("small", { role: "alert", children: error })
182
- ] }),
183
- action && /* @__PURE__ */ jsxs(
184
- "button",
185
- {
186
- className: s.action,
187
- type: "button",
188
- "aria-label": action.label,
189
- disabled: pending,
190
- "data-icon-only": action.display === "icon",
191
- onClick: () => void execute(),
192
- children: [
193
- pending ? /* @__PURE__ */ jsx(LoaderCircle, { className: s.spin }) : action.display !== "text" && action.icon,
194
- action.display !== "icon" && /* @__PURE__ */ jsx("span", { children: action.label })
195
- ]
196
- }
197
- ),
198
- options.closable !== false && /* @__PURE__ */ jsx(
199
- "button",
200
- {
201
- className: s.close,
202
- type: "button",
203
- "aria-label": text("\u5173\u95ED\u63D0\u793A", "Dismiss notification", "\u95DC\u9589\u63D0\u793A"),
204
- onClick: dismiss,
205
- children: /* @__PURE__ */ jsx(X, {})
206
- }
207
- )
208
- ]
209
- }
210
- ),
211
- document.body
246
+ ),
247
+ options.closable !== false && /* @__PURE__ */ jsx(
248
+ "button",
249
+ {
250
+ className: s.close,
251
+ type: "button",
252
+ "aria-label": text("\u5173\u95ED\u63D0\u793A", "Dismiss notification", "\u95DC\u9589\u63D0\u793A"),
253
+ onClick: dismiss,
254
+ children: /* @__PURE__ */ jsx(X, {})
255
+ }
256
+ )
257
+ ] })
258
+ }
212
259
  );
260
+ return embedded ? element : createPortal(element, document.body);
213
261
  }
214
262
  export {
215
263
  Toast
@@ -1,110 +1,203 @@
1
+ .viewport {
2
+ position: fixed;
3
+ inset: 0;
4
+ margin: 0;
5
+ padding: 0;
6
+ border: 0;
7
+ width: 100%;
8
+ height: 100%;
9
+ max-width: none;
10
+ max-height: none;
11
+ background: transparent;
12
+ overflow: clip;
13
+ contain: strict;
14
+ pointer-events: none;
15
+ }
16
+ .viewport::backdrop {
17
+ background: transparent;
18
+ pointer-events: none;
19
+ }
20
+ .region {
21
+ position: absolute;
22
+ width: min(436px, 100%);
23
+ max-height: 100%;
24
+ box-sizing: border-box;
25
+ padding: 20px 16px 30px;
26
+ overflow-x: clip;
27
+ overflow-y: auto;
28
+ overscroll-behavior: contain;
29
+ scrollbar-width: thin;
30
+ scrollbar-gutter: stable both-edges;
31
+ pointer-events: none;
32
+ }
33
+ .region[data-expanded="true"] {
34
+ pointer-events: auto;
35
+ }
36
+ .region[data-position^="top"] {
37
+ top: 0;
38
+ }
39
+ .region[data-position^="bottom"] {
40
+ bottom: 0;
41
+ padding-top: 30px;
42
+ padding-bottom: 20px;
43
+ }
44
+ .region[data-position$="left"] {
45
+ left: 4px;
46
+ }
47
+ .region[data-position$="right"] {
48
+ right: 4px;
49
+ }
50
+ .region[data-position$="center"] {
51
+ left: 50%;
52
+ transform: translateX(-50%);
53
+ }
54
+ .stack {
55
+ position: relative;
56
+ width: 100%;
57
+ }
1
58
  .toast {
59
+ --tone: #c4c4c4;
60
+ --soft-tone: #555;
61
+ --toast-control: #ffffff12;
62
+ --toast-control-hover: #ffffff24;
63
+ --toast-control-active: #ffffff32;
64
+ --toast-stack-sign: 1;
2
65
  position: fixed;
3
66
  inset: auto;
4
67
  margin: 0;
5
- padding: 10px 14px;
6
- border: 0;
7
- border-radius: 10px;
8
- background: #303030;
9
- color: var(--toast-text-color, #fff);
68
+ padding: 0;
69
+ border: 1px solid #ffffff0c;
70
+ border-radius: 13px;
71
+ box-sizing: border-box;
72
+ width: min(384px, calc(100vw - 32px));
73
+ max-width: none;
74
+ background: #303234;
75
+ color: var(--toast-text-color, #f7f7f7);
10
76
  box-shadow:
11
- 0 8px 28px #0000001c,
12
- 0 2px 6px #0000000d;
13
- max-width: min(460px, calc(100vw - 40px));
14
- max-height: min(160px, calc(100vh - 40px));
15
- overflow: auto;
77
+ 0 8px 24px #00000016,
78
+ 0 2px 6px #0000000c;
79
+ overflow: clip;
16
80
  font-size: 13px;
17
81
  line-height: 20px;
18
- scrollbar-width: thin;
19
- --tone: #c4c4c4;
20
- --soft-tone: #555;
82
+ pointer-events: auto;
83
+ transform-origin: top center;
84
+ transform: translateY(
85
+ calc(var(--toast-stack-offset, 0px) * var(--toast-stack-sign))
86
+ )
87
+ scale(var(--toast-stack-scale, 1));
88
+ transition:
89
+ transform 340ms cubic-bezier(0.16, 1, 0.3, 1),
90
+ height 340ms cubic-bezier(0.16, 1, 0.3, 1);
91
+ will-change: transform, opacity;
92
+ }
93
+ .toast:popover-open,
94
+ .toast[data-embedded="true"] {
95
+ display: block;
21
96
  }
22
- .toast:popover-open {
97
+ .content {
23
98
  display: flex;
24
99
  align-items: center;
25
- gap: 11px;
100
+ gap: 10px;
101
+ padding: 14px 16px;
102
+ box-sizing: border-box;
103
+ max-height: min(320px, calc(100dvh - 80px));
104
+ overflow: auto;
105
+ scrollbar-width: thin;
26
106
  }
27
107
  .copy {
108
+ flex: 1;
28
109
  min-width: 0;
29
110
  display: grid;
30
- gap: 2px;
111
+ gap: 3px;
31
112
  white-space: pre-wrap;
32
113
  overflow-wrap: anywhere;
33
114
  }
34
115
  .copy strong {
35
- font-size: 12px;
116
+ font-size: 13px;
36
117
  font-weight: 600;
37
118
  }
119
+ .copy:has(strong) > span {
120
+ opacity: 0.75;
121
+ }
38
122
  .copy small {
39
123
  color: inherit;
40
- opacity: 0.8;
41
- font-size: 11px;
124
+ opacity: 0.85;
125
+ font-size: 12px;
42
126
  }
43
127
  .icon {
44
128
  display: grid;
45
129
  place-items: center;
46
130
  flex-shrink: 0;
47
- align-self: center;
48
131
  width: 20px;
49
132
  height: 20px;
50
133
  color: var(--toast-icon-color, var(--tone));
51
134
  }
52
135
  .icon svg {
53
136
  display: block;
54
- width: 18px;
55
- height: 18px;
137
+ width: 19px;
138
+ height: 19px;
56
139
  }
57
140
  .toast button {
141
+ appearance: none;
58
142
  display: inline-flex;
59
143
  align-items: center;
60
144
  justify-content: center;
61
- gap: 5px;
145
+ gap: 4px;
62
146
  flex-shrink: 0;
63
147
  border: 0;
64
- border-radius: 5px;
148
+ border-radius: 7px;
65
149
  color: inherit;
150
+ font: inherit;
66
151
  font-size: 12px;
67
152
  line-height: 20px;
68
- min-height: 26px;
153
+ min-height: 28px;
154
+ background: var(--toast-control);
155
+ cursor: pointer;
69
156
  transition:
70
157
  background-color var(--motion-hover),
71
158
  opacity var(--motion-hover);
72
159
  }
160
+ .toast button:hover:not(:disabled) {
161
+ background: var(--toast-control-hover);
162
+ }
163
+ .toast button:active:not(:disabled) {
164
+ background: var(--toast-control-active);
165
+ }
166
+ .toast button:focus-visible {
167
+ outline: 2px solid currentColor;
168
+ outline-offset: 2px;
169
+ }
170
+ .toast button:disabled {
171
+ opacity: 0.6;
172
+ cursor: wait;
173
+ }
73
174
  .action {
74
- min-height: 26px;
75
- padding: 3px 8px;
76
- background: #ffffff18;
175
+ padding: 4px 8px;
77
176
  white-space: nowrap;
78
177
  }
79
- .action:hover:not(:disabled) {
80
- background: #ffffff2a;
81
- }
82
178
  .action[data-icon-only="true"] {
83
- width: 26px;
179
+ width: 28px;
84
180
  padding: 4px;
85
181
  }
86
- .action svg {
87
- width: 15px;
88
- height: 15px;
182
+ .action svg,
183
+ .expand svg {
184
+ width: 14px;
185
+ height: 14px;
89
186
  }
90
- .close {
91
- width: 26px;
92
- height: 26px;
93
- padding: 3px;
94
- background: transparent;
95
- opacity: 0.65;
187
+ .expand {
188
+ padding: 3px 7px;
189
+ font-variant-numeric: tabular-nums;
96
190
  }
97
- .close:hover {
98
- opacity: 1;
99
- background: #ffffff20;
191
+ .toast .close {
192
+ width: 28px;
193
+ height: 28px;
194
+ padding: 4px;
195
+ background: transparent;
100
196
  }
101
197
  .close svg {
102
- width: 14px;
103
- height: 14px;
104
- }
105
- .toast button:focus-visible {
106
- outline: 1px solid currentColor;
107
- outline-offset: 2px;
198
+ width: 15px;
199
+ height: 15px;
200
+ opacity: 0.8;
108
201
  }
109
202
  .toast[data-tone="success"] {
110
203
  --tone: #91d5a4;
@@ -123,25 +216,23 @@
123
216
  --soft-tone: #b13d3d;
124
217
  }
125
218
  .toast[data-variant="soft"] {
219
+ --toast-control: color-mix(in srgb, var(--soft-tone) 9%, transparent);
220
+ --toast-control-hover: color-mix(in srgb, var(--soft-tone) 16%, transparent);
221
+ --toast-control-active: color-mix(in srgb, var(--soft-tone) 22%, transparent);
126
222
  background: color-mix(in srgb, var(--soft-tone) 8%, var(--surface));
127
223
  color: var(--toast-text-color, var(--fg));
128
- box-shadow: var(--shadow);
129
- border: 1px solid color-mix(in srgb, var(--soft-tone) 18%, var(--surface));
224
+ border-color: color-mix(in srgb, var(--soft-tone) 18%, var(--surface));
130
225
  }
131
226
  .toast[data-variant="soft"] .icon {
132
227
  color: var(--toast-icon-color, var(--soft-tone));
133
228
  }
134
- .toast[data-variant="soft"] .action {
135
- background: color-mix(in srgb, var(--soft-tone) 10%, transparent);
136
- }
137
- .toast[data-variant="soft"] button:hover:not(:disabled) {
138
- background: color-mix(in srgb, var(--soft-tone) 18%, transparent);
139
- }
140
229
  .toast[data-position^="top"] {
141
230
  top: 20px;
142
231
  }
143
232
  .toast[data-position^="bottom"] {
144
233
  bottom: 20px;
234
+ --toast-stack-sign: -1;
235
+ transform-origin: bottom center;
145
236
  }
146
237
  .toast[data-position$="left"] {
147
238
  left: 20px;
@@ -151,16 +242,39 @@
151
242
  }
152
243
  .toast[data-position$="center"] {
153
244
  left: 50%;
154
- transform: translateX(-50%);
245
+ transform: translateX(-50%)
246
+ translateY(calc(var(--toast-stack-offset, 0px) * var(--toast-stack-sign)))
247
+ scale(var(--toast-stack-scale, 1));
248
+ }
249
+ .toast[data-embedded="true"] {
250
+ position: absolute;
251
+ width: 100%;
252
+ inset: 0 0 auto;
253
+ height: var(--toast-stack-height, auto);
254
+ }
255
+ .toast[data-embedded="true"][data-position^="bottom"] {
256
+ inset: auto 0 0;
257
+ }
258
+ .toast[data-embedded="true"][data-position$="center"] {
259
+ transform: translateY(
260
+ calc(var(--toast-stack-offset, 0px) * var(--toast-stack-sign))
261
+ )
262
+ scale(var(--toast-stack-scale, 1));
263
+ }
264
+ .toast[data-embedded="true"][data-stack-expanded="false"]:not(
265
+ [data-stack-index="0"]
266
+ )
267
+ .content {
268
+ visibility: hidden;
269
+ }
270
+ .toast[data-stack-hidden="true"] {
271
+ visibility: hidden;
272
+ pointer-events: none;
155
273
  }
156
274
  :global([data-theme="dark"]) .toast {
157
275
  box-shadow:
158
- 0 8px 28px #0000003d,
159
- 0 2px 6px #00000024;
160
- }
161
- :global([data-theme="dark"]) .toast[data-variant="solid"] {
162
- background: #333;
163
- color: var(--toast-text-color, #f4f4f4);
276
+ 0 8px 24px #00000038,
277
+ 0 2px 6px #00000020;
164
278
  }
165
279
  :global([data-theme="dark"]) .toast[data-variant="soft"] {
166
280
  --soft-tone: var(--tone);
@@ -173,28 +287,11 @@
173
287
  transform: rotate(360deg);
174
288
  }
175
289
  }
176
-
177
- .toast {
178
- --toast-stack-sign: 1;
179
- transform: translateY(
180
- calc(var(--toast-stack-offset, 0px) * var(--toast-stack-sign))
181
- );
182
- transition: transform 320ms cubic-bezier(0.16, 1, 0.3, 1);
183
- will-change: transform, opacity;
184
- }
185
- .toast[data-position^="bottom"] {
186
- --toast-stack-sign: -1;
187
- }
188
- .toast[data-position$="center"] {
189
- transform: translateX(-50%)
190
- translateY(calc(var(--toast-stack-offset, 0px) * var(--toast-stack-sign)));
191
- }
192
- .toast[data-stack-hidden="true"] {
193
- visibility: hidden;
194
- pointer-events: none;
195
- }
196
290
  @media (prefers-reduced-motion: reduce) {
197
291
  .toast {
198
292
  transition: none;
199
293
  }
294
+ .spin {
295
+ animation: none;
296
+ }
200
297
  }