Skip to content

Commit 5052b6d

Browse files
committed
docs(Toast): the card's props say useToast()'s show function sets them, without restating values
The values stay where component:Toast's record puts them: useToast's doc describes the show function's defaults. Toast.doc.mjs no longer repeats them in prose, which read as a new default clause.
1 parent f8552e9 commit 5052b6d

1 file changed

Lines changed: 9 additions & 10 deletions

File tree

‎packages/core/src/Toast/Toast.doc.mjs‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,21 @@ export const docs = {
4242
name: 'type',
4343
type: "'info' | 'error'",
4444
description:
45-
"Toast type controlling background color. useToast()'s show function sets 'info' when it is not given.",
45+
"Toast type controlling background color. useToast()'s show function sets it when it is not given.",
4646
default: "'info'",
4747
},
4848
{
4949
name: 'isAutoHide',
5050
type: 'boolean',
5151
description:
52-
"Whether the toast auto-dismisses. useToast()'s show function sets true for info and false for error when it is not given, so an error toast it shows persists until dismissed.",
52+
"Whether the toast auto-dismisses. useToast()'s show function sets it by type when it is not given.",
5353
required: true,
5454
},
5555
{
5656
name: 'autoHideDuration',
5757
type: 'number',
5858
description:
59-
"Duration in ms before auto-dismiss. Timed content must satisfy WCAG 2.2.1. useToast()'s show function sets 5000 when it is not given.",
59+
"Duration in ms before auto-dismiss. Timed content must satisfy WCAG 2.2.1. useToast()'s show function sets it when it is not given.",
6060
required: true,
6161
},
6262
{
@@ -202,11 +202,11 @@ export const docs = {
202202
export const docsZh = {
203203
propDescriptions: {
204204
body: '主要消息内容。',
205-
type: 'Toast 类型,控制背景颜色。未传入时,useToast() 的 show 函数设为 info。',
205+
type: 'Toast 类型,控制背景颜色。未传入时,由 useToast() 的 show 函数设置。',
206206
isAutoHide:
207-
'是否自动关闭。未传入时,useToast() 的 show 函数对 info 设为 true、对 error 设为 false,因此它显示的 error toast 会持续显示直到关闭。',
207+
'是否自动关闭。未传入时,由 useToast() 的 show 函数按类型设置。',
208208
autoHideDuration:
209-
'自动关闭前的持续时间(毫秒)。定时内容必须符合 WCAG 2.2.1。未传入时,useToast() 的 show 函数设为 5000。',
209+
'自动关闭前的持续时间(毫秒)。定时内容必须符合 WCAG 2.2.1。未传入时,由 useToast() 的 show 函数设置。',
210210
endContent: '尾部渲染的内容(如撤销按钮、链接)。操作标签应保持简短。',
211211
renderContent:
212212
"用你自己的布局替换该 toast 卡片内部的内容。Astryx 保留卡片本身、astryx-toast 主题目标和自动关闭行为(在 ToastViewport 中由视口播报该 toast;当模态框承载视口时由卡片自行播报),并把消息、endContent、解析后的 toast 设置和 dismiss 回调交给渲染函数。自定义渲染函数完全拥有布局中的控件:请组合所需的控件并通过它调用 dismiss。Astryx 不会向自定义内容注入后备关闭按钮。按 toast 单独设置:应用可通过封装 useToast 并在每次调用时传入来共享同一套布局;而由库代码发起、从不传入该参数的 toast 会渲染为普通的 Astryx toast。传入参数为 {body, endContent, type, isAutoHide, autoHideDuration, dismiss},其中 type 为 'info' | 'error'。",
@@ -318,11 +318,10 @@ export const docsDense = {
318318
},
319319
propDescriptions: {
320320
body: 'primary message content',
321-
type: 'toast type; controls bg color; useToast() show sets info when omitted',
322-
isAutoHide:
323-
'auto-dismiss; useToast() show sets true for info, false for error when omitted (so its error toasts persist until dismissed)',
321+
type: 'toast type; controls bg color; set by useToast() show when omitted',
322+
isAutoHide: 'auto-dismiss; set by type by useToast() show when omitted',
324323
autoHideDuration:
325-
'ms before auto-dismiss; timed content must satisfy WCAG 2.2.1; useToast() show sets 5000 when omitted',
324+
'ms before auto-dismiss; timed content must satisfy WCAG 2.2.1; set by useToast() show when omitted',
326325
endContent:
327326
'trailing end content (undo btn, link); keep action labels short',
328327
renderContent:

0 commit comments

Comments
 (0)