dsh-plugin-core-demo 0.22.0 → 0.23.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.
Files changed (2) hide show
  1. package/dist/client.js +436 -30
  2. package/package.json +1 -1
package/dist/client.js CHANGED
@@ -3900,8 +3900,12 @@ function isThenable(value) {
3900
3900
  return false;
3901
3901
  return typeof value.then === "function";
3902
3902
  }
3903
+ function isSuccess(value) {
3904
+ return value !== false;
3905
+ }
3903
3906
 
3904
3907
  // dist/ui/Button.js
3908
+ var useIsoLayoutEffect = typeof document === "undefined" ? import_react9.useEffect : import_react9.useLayoutEffect;
3905
3909
  var SOLID_VARIANTS = [
3906
3910
  "primary",
3907
3911
  "secondary",
@@ -3940,7 +3944,7 @@ function colorVars(variant, color) {
3940
3944
  function buttonClass(variant, size4, block2, hasIcon, extra) {
3941
3945
  return `dshpc-btn dshpc-btn--${variant} dshpc-btn--${size4}${block2 ? " dshpc-btn--block" : ""}${hasIcon ? " dshpc-btn--icon-start" : ""}${extra !== void 0 && extra !== "" ? ` ${extra}` : ""}`;
3942
3946
  }
3943
- function useAsyncClick(onClick, onBusyChange) {
3947
+ function useAsyncClick(onClick, onBusyChange, onBusyStart) {
3944
3948
  const [busy, setBusy] = (0, import_react9.useState)(false);
3945
3949
  const click = (event) => {
3946
3950
  if (onClick === void 0)
@@ -3948,6 +3952,7 @@ function useAsyncClick(onClick, onBusyChange) {
3948
3952
  const out = onClick(event);
3949
3953
  if (!isThenable(out))
3950
3954
  return;
3955
+ onBusyStart?.(event.currentTarget);
3951
3956
  setBusy(true);
3952
3957
  onBusyChange?.(true);
3953
3958
  const done = () => {
@@ -3963,23 +3968,64 @@ function useAsyncClick(onClick, onBusyChange) {
3963
3968
  }
3964
3969
  function Button(props) {
3965
3970
  ensureComponentStyles("button", BUTTON_CSS);
3966
- const { variant = "outline", size: size4 = "lg", icon: icon2, iconRight, color, loading: loadingProp = false, block: block2 = false, width, minWidth, maxWidth, className: className2, style: style2, children, onClick, onBusyChange, ...rest } = props;
3967
- const asyncClick = useAsyncClick(onClick, onBusyChange);
3971
+ const { variant = "outline", size: size4 = "lg", icon: icon2, iconRight, color, loading: loadingProp = false, loadingText = true, block: block2 = false, width, minWidth, maxWidth, className: className2, style: style2, children, onClick, onBusyChange, ...rest } = props;
3972
+ const btnRef = (0, import_react9.useRef)(null);
3973
+ const idleWidth = (0, import_react9.useRef)(null);
3974
+ const [lockWidth, setLockWidth] = (0, import_react9.useState)(null);
3975
+ const hasOwnWidth = width !== void 0 || style2 !== void 0 && style2.width !== void 0;
3976
+ const lockable = !loadingText && !hasOwnWidth && !block2;
3977
+ const asyncClick = useAsyncClick(onClick, onBusyChange, (el) => {
3978
+ if (!lockable)
3979
+ return;
3980
+ const w = el.getBoundingClientRect().width;
3981
+ if (w > 0) {
3982
+ idleWidth.current = w;
3983
+ setLockWidth(w);
3984
+ }
3985
+ });
3968
3986
  const loading = loadingProp || asyncClick.busy;
3987
+ useIsoLayoutEffect(() => {
3988
+ const el = btnRef.current;
3989
+ if (el === null)
3990
+ return;
3991
+ if (!loading) {
3992
+ const w = el.getBoundingClientRect().width;
3993
+ if (w > 0)
3994
+ idleWidth.current = w;
3995
+ if (lockWidth !== null)
3996
+ setLockWidth(null);
3997
+ return;
3998
+ }
3999
+ if (!lockable) {
4000
+ if (lockWidth !== null)
4001
+ setLockWidth(null);
4002
+ return;
4003
+ }
4004
+ if (lockWidth === null && idleWidth.current !== null)
4005
+ setLockWidth(idleWidth.current);
4006
+ }, [loading, lockable, lockWidth]);
3969
4007
  const widthStyle = {};
3970
4008
  if (width !== void 0) {
3971
4009
  widthStyle.width = width;
4010
+ } else if (loading && lockWidth !== null) {
4011
+ widthStyle.width = lockWidth;
3972
4012
  } else {
3973
4013
  if (minWidth !== void 0)
3974
4014
  widthStyle.minWidth = minWidth;
3975
4015
  if (maxWidth !== void 0)
3976
4016
  widthStyle.maxWidth = maxWidth;
3977
4017
  }
3978
- const marqueeLabel = maxWidth !== void 0 && width === void 0 && typeof children === "string";
4018
+ const hideText = loading && !loadingText;
4019
+ const marqueeLabel = !hideText && maxWidth !== void 0 && width === void 0 && typeof children === "string";
4020
+ const autoLabel = hideText && typeof children === "string" ? children : void 0;
3979
4021
  const attrs2 = {
3980
4022
  ...rest,
4023
+ ref: btnRef,
3981
4024
  type: rest.type ?? "button",
3982
4025
  disabled: rest.disabled === true || loading,
4026
+ // 与 IconButton 同一口径:文字还在,但让读屏知道它正在忙、不是单纯不可点
4027
+ "aria-busy": loading || void 0,
4028
+ ...autoLabel !== void 0 && rest["aria-label"] === void 0 ? { "aria-label": autoLabel } : {},
3983
4029
  onClick: asyncClick.click,
3984
4030
  className: buttonClass(variant, size4, block2, icon2 !== void 0 && icon2 !== null && !loading, className2),
3985
4031
  style: { ...colorVars(variant, color), ...widthStyle, ...style2 }
@@ -3987,8 +4033,8 @@ function Button(props) {
3987
4033
  return (0, import_react9.createElement)(
3988
4034
  "button",
3989
4035
  attrs2,
3990
- loading ? (0, import_react9.createElement)(Loader, { size: "xs" }) : icon2 !== void 0 && icon2 !== null ? (0, import_react9.createElement)("span", { className: "dshpc-btn__icon" }, icon2) : null,
3991
- marqueeLabel ? (0, import_react9.createElement)(MarqueeText, { text: children, className: "dshpc-btn__label" }) : children,
4036
+ loading ? (0, import_react9.createElement)("span", { className: "dshpc-btn__icon" }, (0, import_react9.createElement)(Loader, { size: "xs" })) : icon2 !== void 0 && icon2 !== null ? (0, import_react9.createElement)("span", { className: "dshpc-btn__icon" }, icon2) : null,
4037
+ hideText ? null : marqueeLabel ? (0, import_react9.createElement)(MarqueeText, { text: children, className: "dshpc-btn__label" }) : children,
3992
4038
  // 转圈期间所有图标位都让位:前置位被 Loader 顶替,后置位(展开 / 外链)留在禁用态里只会挤版面
3993
4039
  iconRight !== void 0 && iconRight !== null && !loading ? (0, import_react9.createElement)("span", { className: "dshpc-btn__icon-end" }, iconRight) : null
3994
4040
  );
@@ -5165,7 +5211,14 @@ function AlertModal(props) {
5165
5211
  closeOnMask: props.closeOnMask,
5166
5212
  busy,
5167
5213
  onClose: props.onConfirm,
5168
- footer: (0, import_react19.createElement)(Button, { variant: "primary", loading: props.confirmLoading === true, onBusyChange: setRunning, onClick: () => props.onConfirm?.() }, props.confirmText ?? tt("dialogOk"))
5214
+ footer: (0, import_react19.createElement)(Button, {
5215
+ variant: "primary",
5216
+ width: props.confirmWidth,
5217
+ loadingText: props.loadingText,
5218
+ loading: props.confirmLoading === true,
5219
+ onBusyChange: setRunning,
5220
+ onClick: () => props.onConfirm?.()
5221
+ }, props.confirmText ?? tt("dialogOk"))
5169
5222
  }, props.message ?? null);
5170
5223
  }
5171
5224
 
@@ -5186,7 +5239,21 @@ function ConfirmModal(props) {
5186
5239
  closeOnMask: props.closeOnMask,
5187
5240
  busy,
5188
5241
  onClose: props.onCancel,
5189
- footer: (0, import_react20.createElement)("div", { style: { display: "flex", gap: "8px", justifyContent: "flex-end" } }, (0, import_react20.createElement)(Button, { variant: "outline", loading: props.cancelLoading === true, onBusyChange: setCancelBusy, onClick: () => props.onCancel?.() }, props.cancelText ?? tt("cancel")), (0, import_react20.createElement)(Button, { variant: confirmVariant, loading: props.confirmLoading === true, onBusyChange: setConfirmBusy, onClick: () => props.onConfirm?.() }, props.confirmText ?? tt("confirm")))
5242
+ footer: (0, import_react20.createElement)("div", { style: { display: "flex", gap: "8px", justifyContent: "flex-end" } }, (0, import_react20.createElement)(Button, {
5243
+ variant: "outline",
5244
+ width: props.cancelWidth,
5245
+ loadingText: props.loadingText,
5246
+ loading: props.cancelLoading === true,
5247
+ onBusyChange: setCancelBusy,
5248
+ onClick: () => props.onCancel?.()
5249
+ }, props.cancelText ?? tt("cancel")), (0, import_react20.createElement)(Button, {
5250
+ variant: confirmVariant,
5251
+ width: props.confirmWidth,
5252
+ loadingText: props.loadingText,
5253
+ loading: props.confirmLoading === true,
5254
+ onBusyChange: setConfirmBusy,
5255
+ onClick: () => props.onConfirm?.()
5256
+ }, props.confirmText ?? tt("confirm")))
5190
5257
  }, props.message ?? null);
5191
5258
  }
5192
5259
 
@@ -5259,11 +5326,15 @@ function confirmModal(opts) {
5259
5326
  if (closed)
5260
5327
  return void 0;
5261
5328
  const out = (which === "confirm" ? onConfirm : onCancel)?.();
5329
+ const settle = (value) => {
5330
+ if (isSuccess(value))
5331
+ close(which === "confirm");
5332
+ };
5262
5333
  if (!isThenable(out)) {
5263
- close(which === "confirm");
5334
+ settle(out);
5264
5335
  return void 0;
5265
5336
  }
5266
- void out.then(() => close(which === "confirm"), () => {
5337
+ void out.then(settle, () => {
5267
5338
  });
5268
5339
  return out;
5269
5340
  };
@@ -5301,11 +5372,15 @@ function alertModal(opts) {
5301
5372
  if (closed)
5302
5373
  return void 0;
5303
5374
  const out = onConfirm?.();
5375
+ const settle = (value) => {
5376
+ if (isSuccess(value))
5377
+ close();
5378
+ };
5304
5379
  if (!isThenable(out)) {
5305
- close();
5380
+ settle(out);
5306
5381
  return void 0;
5307
5382
  }
5308
- void out.then(close, () => {
5383
+ void out.then(settle, () => {
5309
5384
  });
5310
5385
  return out;
5311
5386
  };
@@ -7542,7 +7617,7 @@ function InputGroup(props) {
7542
7617
  return;
7543
7618
  const run = () => {
7544
7619
  commit();
7545
- action.onClick();
7620
+ return action.onClick();
7546
7621
  };
7547
7622
  const off = disabled === true || action.disabled === true;
7548
7623
  const onlyIcon = action.label === void 0;
@@ -7559,6 +7634,8 @@ function InputGroup(props) {
7559
7634
  variant: action.variant ?? "info",
7560
7635
  size: size4,
7561
7636
  icon: action.icon,
7637
+ width: action.width,
7638
+ loadingText: action.loadingText,
7562
7639
  disabled: off,
7563
7640
  onClick: run
7564
7641
  }, action.label));
@@ -58444,7 +58521,7 @@ var DICT2 = {
58444
58521
  demoInputFamily: "Input \u5BB6\u65CF",
58445
58522
  inputHint: "Input / PrefixedInput / NumberInput / Textarea\uFF0C\u90FD\u652F\u6301 error \u63CF\u7EA2\uFF1B\u4F20 hint \u53C2\u6570\u5373\u81EA\u52A8\u5728\u884C\u5C3E\u6302\u6807\u51C6\u95EE\u53F7\u63D0\u793A\uFF08FieldHint \u672C\u4F53\u4ECD\u53EF\u5355\u72EC\u7528\uFF09\uFF1BInput \u4F20 icon \u5373\u5728\u5DE6\u4FA7\u52A0\u56FE\u6807\u69FD",
58446
58523
  inputGroupTitle: "InputGroup\uFF08\u7EC4\u5408\u8F93\u5165\u6846\uFF09",
58447
- inputGroupHint: "\u8F93\u5165\u6846 + \u540E\u7F6E\u6309\u94AE\u7EC4\u710A\u6210\u4E00\u4F53\uFF0C\u548C SplitGroup \u540C\u4E00\u5957\u76AE\u80A4\u53E3\u5F84\uFF08\u5916\u6846 / \u5706\u89D2 / 1px \u5206\u9694 / \u6574\u4F53\u805A\u7126\u5708\u90FD\u7531\u5916\u58F3\u753B\uFF09\uFF1Blabel \u662F\u524D\u7F6E\u6807\u9898\uFF08\u540C\u683C\u7070\u5E95\uFF09\uFF1Bactions \u5199\u591A\u5C11\u679A\u5C31\u6392\u591A\u5C11\uFF08\u8FD4\u56DE + \u786E\u5B9A\u3001\u56FE\u6807 / \u56FE\u6587 / \u7EAF\u6587\u5B57\u90FD\u884C\uFF09\uFF0C\u9ED8\u8BA4\u662F\u4E1A\u52A1\u8272\u5B9E\u5FC3\u6309\u94AE\u3001variant \u53EF\u6362\u4EFB\u610F\u6863\uFF1Bundoable \u5728\u6700\u524D\u9762\u52A0\u64A4\u9500\u94AE\uFF0C\u56DE\u9000\u5230\u4E0A\u4E00\u6B21\u63D0\u4EA4\u524D\u7684\u503C\uFF1Bsize \u4E09\u6863\uFF0Cheight \u76F4\u63A5\u7ED9 px \u81EA\u5B9A\u4E49\u9AD8\u5EA6",
58524
+ inputGroupHint: "\u8F93\u5165\u6846 + \u540E\u7F6E\u6309\u94AE\u7EC4\u710A\u6210\u4E00\u4F53\uFF0C\u548C SplitGroup \u540C\u4E00\u5957\u76AE\u80A4\u53E3\u5F84\uFF08\u5916\u6846 / \u5706\u89D2 / 1px \u5206\u9694 / \u6574\u4F53\u805A\u7126\u5708\u90FD\u7531\u5916\u58F3\u753B\uFF09\uFF1Blabel \u662F\u524D\u7F6E\u6807\u9898\uFF08\u540C\u683C\u7070\u5E95\uFF09\uFF1Bactions \u5199\u591A\u5C11\u679A\u5C31\u6392\u591A\u5C11\uFF08\u8FD4\u56DE + \u786E\u5B9A\u3001\u56FE\u6807 / \u56FE\u6587 / \u7EAF\u6587\u5B57\u90FD\u884C\uFF09\uFF0C\u9ED8\u8BA4\u662F\u4E1A\u52A1\u8272\u5B9E\u5FC3\u6309\u94AE\u3001variant \u53EF\u6362\u4EFB\u610F\u6863\uFF1Bundoable \u5728\u6700\u524D\u9762\u52A0\u64A4\u9500\u94AE\uFF0C\u56DE\u9000\u5230\u4E0A\u4E00\u6B21\u63D0\u4EA4\u524D\u7684\u503C\uFF1Bsize \u4E09\u6863\uFF0Cheight \u76F4\u63A5\u7ED9 px \u81EA\u5B9A\u4E49\u9AD8\u5EA6\uFF1Baction \u7684 onClick \u8FD4\u56DE Promise \u65F6\u90A3\u679A\u6309\u94AE\u81EA\u52A8\u8F6C\u5708\u7981\u7528\uFF08\u540C Button\uFF09\uFF0C\u4E0D\u7528\u81EA\u5DF1\u7BA1 loading",
58448
58525
  switchTip: "\u5B98\u65B9 Switch\uFF08\u542F\u7528\u8BED\u4E49\uFF0C\u4E0D\u662F\u52FE\u9009\uFF09+ Checkbox + Segmented",
58449
58526
  checkboxHint: "\u5916\u89C2\u5BF9\u9F50\u771F\u5B9E\u63D2\u4EF6\uFF1A\u7070\u5E95\u8F68\u9053 + \u767D\u8272\u9009\u4E2D\u7247\uFF1Bbordered \u662F\u5916\u6846\u6B3E\uFF08\u6700\u53F3\uFF0C\u53EF\u70B9\u7740\u73A9\uFF09\uFF1B\u661F\u671F\u65B9\u5757\u662F\u591A\u9009\u3002icon \u5728\u524D\u3001\u53EA\u6709\u56FE\u6807\u65F6\u81EA\u52A8\u6B63\u65B9\u5F62\u3002\u6587\u6848\u968F\u8BED\u8A00\u5207\u6362",
58450
58527
  segToneTitle: "Segmented \u9009\u4E2D\u7247\u914D\u8272\uFF08tone\uFF09",
@@ -58699,7 +58776,7 @@ var DICT2 = {
58699
58776
  demoInputFamily: "Input family",
58700
58777
  inputHint: "Input / PrefixedInput / NumberInput / Textarea, all support error highlighting; pass a hint string and the standard FieldHint is attached automatically (FieldHint still works standalone); pass icon to Input to get a leading icon slot",
58701
58778
  inputGroupTitle: "InputGroup (input with actions)",
58702
- inputGroupHint: "Input and trailing buttons welded into one shell with the same skin rules as SplitGroup (frame, radius, 1px dividers and focus ring all come from the shell); label is a leading title sharing the cell; actions lays out as many buttons as you pass (back + confirm, icon / icon+text / text), coloured with Button\u2019s own semantic variants \u2014 info by default, pass success / warning / danger for those, no custom colours; undoable prepends an undo button that returns to the value before the last commit; three sizes, plus height in px for a custom height",
58779
+ inputGroupHint: "Input and trailing buttons welded into one shell with the same skin rules as SplitGroup (frame, radius, 1px dividers and focus ring all come from the shell); label is a leading title sharing the cell; actions lays out as many buttons as you pass (back + confirm, icon / icon+text / text), coloured with Button\u2019s own semantic variants \u2014 info by default, pass success / warning / danger for those, no custom colours; undoable prepends an undo button that returns to the value before the last commit; three sizes, plus height in px for a custom height; an action whose `onClick` returns a Promise spins and disables itself (same as Button) \u2014 no loading state to manage",
58703
58780
  switchTip: "Official Switch (enable semantics, not a tick) + Checkbox + Segmented",
58704
58781
  checkboxHint: "Looks match the real plugin: grey track with a white selected pill; bordered adds an outer frame (rightmost, clickable); the weekday squares are multi-select; icons lead the label and icon-only segments square themselves. Labels follow the locale",
58705
58782
  segToneTitle: "Segmented selected-pill colors (tone)",
@@ -60127,6 +60204,10 @@ var docData = {
60127
60204
  "zh": "\u4E24\u8005\u7684 loading \u8BED\u4E49\u4E00\u81F4\uFF1A`onClick` \u8FD4\u56DE Promise \u5C31\u8F6C\u5708\uFF08\u7EAF\u56FE\u6807\u94AE\u628A\u56FE\u6807\u4F4D\u6362\u6210\u5C0F\u5708\uFF0C`aria-label` \u4E0D\u53D8\u3001\u8865 `aria-busy`\uFF09\uFF0C`onBusyChange` \u628A\u300C\u5728\u8DD1\u300D\u62A5\u51FA\u53BB\uFF1B\u53D7\u63A7 `loading` \u4E0E\u5B83\u53D6\u6216 \u2014\u2014 \u522B\u5904\u5237\u65B0\u4E5F\u80FD\u70B9\u4EAE\u540C\u4E00\u9897\u6309\u94AE\u3002\u8F6C\u5708\u671F\u95F4\u6309\u94AE\u81EA\u5DF1\u7684\u56FE\u6807\u4F4D\uFF08`icon` / `iconRight`\uFF09\u5168\u90E8\u8BA9\u4F4D\uFF0C\u53EA\u7559\u8F6C\u5708 + \u6587\u5B57\u3002",
60128
60205
  "en": 'Both share one loading semantics: a Promise-returning `onClick` spins (an icon button swaps its icon for the spinner, keeps `aria-label` and adds `aria-busy`), `onBusyChange` reports "running", and the controlled `loading` prop is OR-ed in \u2014 an external refresh lights the same button too. While spinning, the button\u2019s own icon slots (`icon` / `iconRight`) all step aside: spinner plus label only.'
60129
60206
  },
60207
+ {
60208
+ "zh": "loading \u4F1A\u628A\u524D\u7F6E\u5708\u63D2\u8FDB\u6309\u94AE\uFF1A\u65E0 icon \u7684\u6309\u94AE\u56E0\u6B64\u5BBD\u51FA 18px\uFF08\u5708 12 + \u95F4\u8DDD 6\uFF09\uFF0C\u628A\u65C1\u8FB9\u7684\u6309\u94AE\u6324\u5F00\u3002\u8981\u5B8C\u5168\u4E0D\u8DF3\u6709\u4E24\u6761\u8DEF\uFF1A\u7ED9 `width` \u5B9A\u5BBD\uFF08\u6309\u6700\u957F\u6587\u6848 + 18px \u7559\uFF09\uFF0C\u6216\u4F20 `loadingText={false}` \u8BA9 loading \u65F6\u53EA\u5269\u4E00\u5708\u3002",
60209
+ "en": "Loading inserts the spinner into the button, so a button without an icon grows 18px (12px spinner + 6px gap) and shoves its neighbours. To keep it rock-steady, either set `width` (longest label + 18px) or pass `loadingText={false}` so only the spinner remains while loading."
60210
+ },
60130
60211
  {
60131
60212
  "zh": "Segmented\uFF1A`items`\uFF08\u5FC5\u586B\uFF09\u652F\u6301\u5355\u9009 / \u591A\u9009\uFF0C`size`\uFF08\u9ED8\u8BA4 lg\uFF1B\u4E09\u6863\u603B\u9AD8 24 / 28 / 32\uFF09\u3001`bordered`\uFF081px \u5916\u6846\uFF0C\u603B\u9AD8\u4E0D\u53D8\uFF09\u3001`multiple`\uFF08\u591A\u9009\uFF09\u3002\u5916\u89C2\u53EA\u6709\u4E00\u5957\uFF1A\u7070\u5E95\u8F68\u9053 + \u767D\u8272\u9009\u4E2D\u7247\uFF0C\u9009\u4E2D\u7247\u7684\u63CF\u8FB9\u73AF\u4E0E\u9634\u5F71\u7531\u5BBF\u4E3B elevation token \u63D0\u4F9B\uFF08\u79BB\u7EBF\u515C\u5E95\u503C\u6CA1\u6709\u90A3\u5708\u73AF\uFF09\u3002\u9009\u4E2D\u7247\u914D\u8272\u53EA\u7ECF `tone`\uFF1A\u4F20\u5185\u7F6E\u8272\u540D\uFF08\u4E0E Chip \u540C\u540D\u7684 business / success / warning / danger / purple / pink / cyan / teal / orange / indigo / rose / slate\uFF09\u65F6\u5E95\u4E0E\u5B57\u7531\u6838\u5FC3\u5B9A\u3001\u6DF1\u6D45\u4E24\u4E3B\u9898\u5404\u81EA\u6210\u7ACB\uFF1B\u4F20 `{ bg, fg }` \u65F6\u4E24\u4E2A\u4E3B\u9898\u90FD\u7528\u8C03\u7528\u65B9\u8FD9\u4E00\u5BF9\u989C\u8272\uFF08\u5BF9\u6BD4\u5EA6\u7531\u8C03\u7528\u65B9\u8D1F\u8D23\uFF09\u3002\u6BB5\u5185 `icon` \u662F\u524D\u7F6E\u56FE\u6807\u69FD\uFF08\u5B98\u65B9\u56FE\u6807\u7EC4\u4EF6 / \u6570\u7EC4 / \u81EA\u7ED8\u8282\u70B9\u5747\u53EF\uFF09\uFF0C`label` \u4E5F\u53EF\u4F20\u8282\u70B9\uFF1B\u987A\u5E8F\u56FA\u5B9A\u4E3A icon \u2192 label \u2192 count\u3002\u53EA\u6709\u56FE\u6807\uFF08\u65E0\u6587\u5B57 / \u8BA1\u6570 / \u89D2\u6807\uFF09\u65F6\u8BE5\u6BB5\u81EA\u52A8\u53D8\u6B63\u65B9\u5F62\uFF08\u5BBD = \u6BB5\u9AD8\uFF09\uFF0C\u8BFB\u5C4F\u540D\u7528 `ariaLabel`\uFF0C\u7F3A\u7701\u9000\u56DE `tooltip`\u3002\u6BB5\u5185 `count`\uFF08\u5F31\u5316\u7070\u5B57\uFF0C\u9009\u4E2D\u6BB5\u5185\u81EA\u52A8\u8DDF\u7740\u9009\u4E2D\u7247\u5B57\u8272\u63D0\u4EAE\uFF09/ `badge`\uFF08\u7EA2\u89D2\u6807\uFF09\u63A5\u53D7 `number | string`\uFF1A\u6570\u5B57 \u22640 \u4E0D\u663E\u793A\uFF0C\u5B57\u7B26\u4E32\u539F\u6837\u663E\u793A\uFF08\u5982 `1K` / `99+`\uFF09\u3002",
60132
60213
  "en": "Segmented: `items` (required) supports single or multiple selection; `size` (default lg; totals 24 / 28 / 32), `bordered` (1px outer frame, same total height), `multiple` (multi-select). One look only: grey track + white selected pill; its stroke ring and shadow come from the host elevation token (the offline fallback has no ring). The selected pill\u2019s colors go through `tone` only: a built-in color name (business / success / warning / danger / purple / pink / cyan / teal / orange / indigo / rose / slate, same names as Chip) lets the core pick background and text per theme; `{ bg, fg }` uses that pair verbatim in both themes (contrast is the caller\u2019s call). An item\u2019s leading `icon` takes any node (official icon component, array, or custom); `label` also accepts a node; order is always icon \u2192 label \u2192 count. With only an icon (no label / count / badge) the segment squares itself (width = segment height), and the accessible name comes from `ariaLabel`, falling back to `tooltip`. An item\u2019s `count` (muted text; auto-lightened to follow the selected pill\u2019s text color while selected) and `badge` (red pill) take `number | string`: numbers \u22640 render nothing, strings render as given (e.g. `'1K'` / `'99+'`)."
@@ -60190,6 +60271,15 @@ var docData = {
60190
60271
  "en": "Controlled loading: same-color spinner before the label plus auto-disable (an external refresh can light it up too); OR-ed with automatic click loading"
60191
60272
  }
60192
60273
  },
60274
+ {
60275
+ "name": "loadingText",
60276
+ "type": "boolean",
60277
+ "def": "true",
60278
+ "desc": {
60279
+ "zh": "\u4F20 false\uFF1Aloading \u65F6\u6E05\u6389\u6587\u6848\u3001\u628A\u6309\u94AE\u9501\u5728\u300C\u6709\u6587\u6848\u65F6\u300D\u7684\u5BBD\u5EA6\u4E0A\u3001\u53EA\u7559\u4E00\u679A\u5C45\u4E2D\u7684\u5708\uFF1Bsettle \u540E\u6587\u6848\u4E0E\u81EA\u9002\u5E94\u5BBD\u5EA6\u4E00\u8D77\u8FD8\u539F\u3002\u6587\u6848\u6E05\u6389\u540E\u8BFB\u5C4F\u9760 aria-label\uFF08\u5B57\u7B26\u4E32 children \u81EA\u52A8\u8865\uFF09\uFF0C\u9996\u5E27\u5C31\u662F loading \u65F6\u9501\u4E0D\u5230\u5BBD\uFF0C\u6539\u7528 width",
60280
+ "en": "Pass false to drop the label while loading, freeze the button at its labelled width and show a single centred spinner; label and auto width come back on settle. Screen readers fall back to aria-label (auto-filled for string children); a button that starts out loading has no labelled width to freeze \u2014 set width instead"
60281
+ }
60282
+ },
60193
60283
  {
60194
60284
  "name": "onClick",
60195
60285
  "type": "(...) => unknown",
@@ -60767,8 +60857,8 @@ var docData = {
60767
60857
  "type": "InputGroupAction[]",
60768
60858
  "def": "\u2014",
60769
60859
  "desc": {
60770
- "zh": "{ icon?, label?, variant?, disabled?, ariaLabel?, onClick }\uFF1B\u53EA\u7ED9 icon \u9000\u5316\u6210\u6B63\u65B9\u5F62\u56FE\u6807\u94AE\uFF08ariaLabel \u5FC5\u7ED9\uFF09\uFF0C\u7ED9 label \u8D70 Button\uFF1Bvariant \u9ED8\u8BA4 info\uFF0C\u8BED\u4E49\u8272\u5C31\u7528 Button \u73B0\u6210\u7684\u6863\uFF08success / info / warning / danger\uFF09\uFF0C\u4E0D\u53E6\u8C03\u8272",
60771
- "en": "{ icon?, label?, variant?, disabled?, ariaLabel?, onClick }; icon-only degrades to a square icon button (pass ariaLabel), a label renders a Button; variant defaults to info \u2014 for a semantic colour pass Button\u2019s own variant (success / info / warning / danger) instead of a custom colour"
60860
+ "zh": "{ icon?, label?, variant?, disabled?, width?, loadingText?, ariaLabel?, onClick }\uFF1B\u53EA\u7ED9 icon \u9000\u5316\u6210\u6B63\u65B9\u5F62\u56FE\u6807\u94AE\uFF08ariaLabel \u5FC5\u7ED9\uFF09\uFF0C\u7ED9 label \u8D70 Button\uFF1Bvariant \u9ED8\u8BA4 info\uFF0C\u8BED\u4E49\u8272\u5C31\u7528 Button \u73B0\u6210\u7684\u6863\uFF08success / info / warning / danger\uFF09\uFF0C\u4E0D\u53E6\u8C03\u8272\uFF1B**onClick \u8FD4\u56DE Promise \u65F6\u90A3\u679A\u6309\u94AE\u81EA\u52A8\u8F6C\u5708\u7981\u7528**\uFF0C\u4E0D\u7528\u81EA\u5DF1\u4F20 loading\uFF1B\u8F6C\u5708\u4F1A\u628A\u6309\u94AE\u6491\u5BBD\u5E76\u6324\u7A84\u8F93\u5165\u6846\uFF0C\u7528 width \u6216 loadingText={false} \u538B\u4F4F",
60861
+ "en": "{ icon?, label?, variant?, disabled?, width?, loadingText?, ariaLabel?, onClick }; icon-only degrades to a square icon button (pass ariaLabel), a label renders a Button; variant defaults to info \u2014 for a semantic colour pass Button\u2019s own variant (success / info / warning / danger) instead of a custom colour; **a Promise-returning onClick spins and disables that button** \u2014 no loading prop to manage; spinning widens the button and squeezes the input, so hold it with width or loadingText={false}"
60772
60862
  }
60773
60863
  },
60774
60864
  {
@@ -61631,6 +61721,14 @@ var docData = {
61631
61721
  {
61632
61722
  "zh": "\u906E\u7F69\u53F3\u8FB9\u754C\u8BFB `--dshpc-page-inset-right`\uFF08\u591A\u4E2A dock \u6C42\u548C\uFF09\uFF0C\u81EA\u52A8\u8BA9\u5F00\u53F3\u4FA7\u5206\u680F\uFF0C\u5F39\u7A97\u5728**\u5269\u4F59\u533A\u57DF**\u5C45\u4E2D\u3002\u5F39\u7A97\u65E0\u9700\u4EFB\u4F55\u906E\u7F69\u53C2\u6570\uFF1B\u4E5F\u522B\u81EA\u5DF1\u91CF\u5206\u680F\u5BBD\u5EA6\uFF08\u6302\u8F7D\u5F02\u6B65\uFF0C\u6052\u4E3A 0\uFF09\u3002",
61633
61723
  "en": "The mask\u2019s right edge reads `--dshpc-page-inset-right` (summed across docks) and yields to the right column, centering the dialog in the **remaining** area. The dialog needs no mask props; never measure the column yourself (mounting is async, it always reads 0)."
61724
+ },
61725
+ {
61726
+ "zh": "\u547D\u4EE4\u5F0F `confirmModal(opts)` / `alertModal(opts)` \u8FD4\u56DE Promise\uFF1A\u524D\u8005 resolve `true`\uFF08\u786E\u5B9A\uFF09\u6216 `false`\uFF08\u53D6\u6D88 / \u906E\u7F69 / Esc\uFF09\uFF0C\u540E\u8005\u5173\u95ED\u5373 resolve\u3002\u56DE\u8C03\u8FD4\u56DE Promise \u65F6\u5BF9\u5E94\u6309\u94AE\u81EA\u5DF1\u8F6C\u5708\u3001\u6574\u6846\u9501\u6B7B\uFF0Csettle \u540E\u624D\u5173\u3002",
61727
+ "en": "The imperative `confirmModal(opts)` / `alertModal(opts)` return a Promise: the former resolves `true` (confirmed) or `false` (cancel / mask / Esc), the latter resolves on close. When a callback returns a Promise, its button spins and the dialog locks until it settles."
61728
+ },
61729
+ {
61730
+ "zh": "\u56DE\u8C03\u7684\u8FD4\u56DE\u503C\u51B3\u5B9A\u5173\u4E0D\u5173\uFF1A**\u53EA\u6709 `false`**\uFF08\u540C\u6B65\u8FD4\u56DE\uFF0C\u6216 resolve \u6210 `false`\uFF09\u8868\u793A\u8FD9\u6B21\u6CA1\u6210 \u2014\u2014 \u6846\u7559\u7740\u8BA9\u4EBA\u91CD\u8BD5\uFF1B`true` / `undefined` / \u5176\u4ED6\u8FD4\u56DE\u503C\u7167\u5E38\u5173\uFF1Breject \u4E5F\u4E0D\u5173\uFF08\u9519\u8BEF\u6253\u5230\u63A7\u5236\u53F0\uFF09\u3002\u5931\u8D25\u63D0\u793A\u7531\u56DE\u8C03\u81EA\u5DF1\u51FA\uFF0C\u8C03\u7528\u70B9\u4E0D\u5FC5\u5305 `try/catch`\u3002",
61731
+ "en": "The callback\u2019s return value decides whether it closes: **only `false`** (returned directly, or resolved to `false`) means it did not succeed \u2014 the dialog stays for a retry; `true` / `undefined` / anything else closes as usual; a rejection also keeps it open (the error is logged). The callback owns its failure message, so call sites need no `try/catch`."
61634
61732
  }
61635
61733
  ],
61636
61734
  "api": [
@@ -61895,6 +61993,228 @@ var docData = {
61895
61993
  }
61896
61994
  }
61897
61995
  ]
61996
+ },
61997
+ {
61998
+ "id": "ui-confirm-dialog",
61999
+ "rows": [
62000
+ {
62001
+ "name": "title / message",
62002
+ "type": "ReactNode",
62003
+ "def": "\u2014",
62004
+ "desc": {
62005
+ "zh": "\u6807\u9898 / \u8BF4\u660E\u6587\u5B57\u6216\u4EFB\u610F\u5185\u5BB9\uFF1B\u65E0\u6807\u9898\u65F6\u6574\u6761\u5934\u90E8\u6D88\u5931",
62006
+ "en": "Title / body text or any content; no title means no header row"
62007
+ }
62008
+ },
62009
+ {
62010
+ "name": "tone",
62011
+ "type": "'primary' | 'danger' | 'warning'",
62012
+ "def": "'primary'",
62013
+ "desc": {
62014
+ "zh": "\u786E\u8BA4\u94AE\u8BED\u4E49\u6863\uFF08\u51B3\u5B9A\u6309\u94AE\u989C\u8272\uFF09",
62015
+ "en": "Confirm button tone (sets its colour)"
62016
+ }
62017
+ },
62018
+ {
62019
+ "name": "confirmText / cancelText",
62020
+ "type": "string",
62021
+ "def": "\u5185\u7F6E\u5B57\u5178\u300C\u786E\u5B9A\u300D/\u300C\u53D6\u6D88\u300D",
62022
+ "desc": {
62023
+ "zh": "\u6309\u94AE\u6587\u6848",
62024
+ "en": "Button labels"
62025
+ }
62026
+ },
62027
+ {
62028
+ "name": "confirmWidth / cancelWidth",
62029
+ "type": "number | string",
62030
+ "def": "\u2014",
62031
+ "desc": {
62032
+ "zh": "\u4E24\u9897\u94AE\u5404\u81EA\u5B9A\u5BBD\uFF08px \u6216\u4EFB\u610F CSS \u5BBD\u5EA6\uFF09\uFF1Bloading \u8F6C\u5708\u4F1A\u628A\u6309\u94AE\u6491\u5BBD\uFF0C\u5B9A\u5BBD\u540E\u4E0D\u8DF3",
62033
+ "en": "Per-button fixed width (px or any CSS width); loading would otherwise widen the button and shift its neighbour"
62034
+ }
62035
+ },
62036
+ {
62037
+ "name": "loadingText",
62038
+ "type": "boolean",
62039
+ "def": "true",
62040
+ "desc": {
62041
+ "zh": "\u4F20 false\uFF1Aloading \u65F6\u4E24\u9897\u94AE\u6E05\u6587\u6848\u3001\u9501\u4F4F\u6709\u6587\u6848\u7684\u5BBD\u5EA6\u3001\u53EA\u7559\u5C45\u4E2D\u7684\u5708\uFF08\u89C1 `Button.loadingText`\uFF09",
62042
+ "en": "Pass false: while loading, both buttons drop their labels, freeze at the labelled width and show a centred spinner (see `Button.loadingText`)"
62043
+ }
62044
+ },
62045
+ {
62046
+ "name": "onConfirm / onCancel",
62047
+ "type": "() => unknown",
62048
+ "def": "\u2014",
62049
+ "desc": {
62050
+ "zh": "\u786E\u8BA4 / \u53D6\u6D88\u56DE\u8C03\uFF1B\u8FD4\u56DE Promise \u65F6\u6309\u94AE\u8F6C\u5708\u3001\u6574\u6846\u9501\u6B7B\uFF0Csettle \u540E\u6062\u590D\uFF1B\u8FD4\u56DE `false` \u4E0D\u5173",
62051
+ "en": "Confirm / cancel callback; a Promise makes its button spin and locks the dialog until it settles; `false` keeps it open"
62052
+ }
62053
+ },
62054
+ {
62055
+ "name": "confirmLoading / cancelLoading",
62056
+ "type": "boolean",
62057
+ "def": "false",
62058
+ "desc": {
62059
+ "zh": "\u5916\u90E8\u9A71\u52A8\u5BF9\u5E94\u6309\u94AE loading\uFF0C\u4E0E\u6309\u94AE\u81EA\u8EAB\u5F02\u6B65\u72B6\u6001\u53D6\u6216",
62060
+ "en": "External loading for that button, OR-ed with its own async state"
62061
+ }
62062
+ },
62063
+ {
62064
+ "name": "closeOnMask",
62065
+ "type": "boolean",
62066
+ "def": "'true'",
62067
+ "desc": {
62068
+ "zh": "\u70B9\u906E\u7F69\u5173\u95ED\uFF08\u7B49\u4E8E\u53D6\u6D88\uFF09",
62069
+ "en": "Close on mask click (treated as cancel)"
62070
+ }
62071
+ },
62072
+ {
62073
+ "name": "size",
62074
+ "type": "ModalSize",
62075
+ "def": "'sm'",
62076
+ "desc": {
62077
+ "zh": "\u5C3A\u5BF8\u6863",
62078
+ "en": "Size tier"
62079
+ }
62080
+ },
62081
+ {
62082
+ "name": "translate",
62083
+ "type": "Translate",
62084
+ "def": "\u5185\u7F6E\u5B57\u5178",
62085
+ "desc": {
62086
+ "zh": "\u8986\u76D6\u786E\u5B9A / \u53D6\u6D88\u6587\u6848",
62087
+ "en": "Override confirm / cancel copy"
62088
+ }
62089
+ }
62090
+ ]
62091
+ },
62092
+ {
62093
+ "id": "ui-alert-dialog",
62094
+ "rows": [
62095
+ {
62096
+ "name": "title / message",
62097
+ "type": "ReactNode",
62098
+ "def": "\u2014",
62099
+ "desc": {
62100
+ "zh": "\u6807\u9898 / \u8BF4\u660E\u6587\u5B57\u6216\u4EFB\u610F\u5185\u5BB9\uFF1B\u65E0\u6807\u9898\u65F6\u6574\u6761\u5934\u90E8\u6D88\u5931",
62101
+ "en": "Title / body text or any content; no title means no header row"
62102
+ }
62103
+ },
62104
+ {
62105
+ "name": "severity",
62106
+ "type": "'info' | 'success' | 'warning' | 'error'",
62107
+ "def": "'info'",
62108
+ "desc": {
62109
+ "zh": "\u4FE1\u53F7\u6863\uFF1A\u5934\u90E8\u56FE\u6807\u4E0E\u914D\u8272\u7531\u5B83\u51B3\u5B9A",
62110
+ "en": "Signal tier: sets the header glyph and colour"
62111
+ }
62112
+ },
62113
+ {
62114
+ "name": "confirmText",
62115
+ "type": "string",
62116
+ "def": "\u5185\u7F6E\u5B57\u5178\u300C\u77E5\u9053\u4E86\u300D",
62117
+ "desc": {
62118
+ "zh": "\u6309\u94AE\u6587\u6848",
62119
+ "en": "Button label"
62120
+ }
62121
+ },
62122
+ {
62123
+ "name": "confirmWidth",
62124
+ "type": "number | string",
62125
+ "def": "\u2014",
62126
+ "desc": {
62127
+ "zh": "\u786E\u8BA4\u94AE\u5B9A\u5BBD\uFF08px \u6216\u4EFB\u610F CSS \u5BBD\u5EA6\uFF09\uFF1Bloading \u8F6C\u5708\u4F1A\u628A\u6309\u94AE\u6491\u5BBD\uFF0C\u5B9A\u5BBD\u540E\u4E0D\u8DF3",
62128
+ "en": "Fixed width for the confirm button (px or any CSS width); loading would otherwise widen it"
62129
+ }
62130
+ },
62131
+ {
62132
+ "name": "loadingText",
62133
+ "type": "boolean",
62134
+ "def": "true",
62135
+ "desc": {
62136
+ "zh": "\u4F20 false\uFF1Aloading \u65F6\u6E05\u6587\u6848\u3001\u9501\u4F4F\u6709\u6587\u6848\u7684\u5BBD\u5EA6\u3001\u53EA\u7559\u5C45\u4E2D\u7684\u5708\uFF08\u89C1 `Button.loadingText`\uFF09",
62137
+ "en": "Pass false: while loading, drop the label, freeze at the labelled width and show a centred spinner (see `Button.loadingText`)"
62138
+ }
62139
+ },
62140
+ {
62141
+ "name": "onConfirm",
62142
+ "type": "() => unknown",
62143
+ "def": "\u2014",
62144
+ "desc": {
62145
+ "zh": "\u786E\u8BA4 / \u906E\u7F69 / Esc \u7684\u7EDF\u4E00\u51FA\u53E3\uFF1B\u8FD4\u56DE Promise \u65F6\u8F6C\u5708\u9501\u6846\uFF0C\u8FD4\u56DE `false` \u4E0D\u5173",
62146
+ "en": "Single exit for confirm / mask / Esc; a Promise spins and locks it, `false` keeps it open"
62147
+ }
62148
+ },
62149
+ {
62150
+ "name": "confirmLoading",
62151
+ "type": "boolean",
62152
+ "def": "false",
62153
+ "desc": {
62154
+ "zh": "\u5916\u90E8\u9A71\u52A8\u6309\u94AE loading\uFF0C\u4E0E\u6309\u94AE\u81EA\u8EAB\u5F02\u6B65\u72B6\u6001\u53D6\u6216",
62155
+ "en": "External button loading, OR-ed with its own async state"
62156
+ }
62157
+ },
62158
+ {
62159
+ "name": "closeOnMask",
62160
+ "type": "boolean",
62161
+ "def": "'true'",
62162
+ "desc": {
62163
+ "zh": "\u70B9\u906E\u7F69\u5173\u95ED",
62164
+ "en": "Close on mask click"
62165
+ }
62166
+ },
62167
+ {
62168
+ "name": "size",
62169
+ "type": "ModalSize",
62170
+ "def": "'sm'",
62171
+ "desc": {
62172
+ "zh": "\u5C3A\u5BF8\u6863",
62173
+ "en": "Size tier"
62174
+ }
62175
+ },
62176
+ {
62177
+ "name": "translate",
62178
+ "type": "Translate",
62179
+ "def": "\u5185\u7F6E\u5B57\u5178",
62180
+ "desc": {
62181
+ "zh": "\u8986\u76D6\u6309\u94AE\u6587\u6848",
62182
+ "en": "Override the button copy"
62183
+ }
62184
+ }
62185
+ ]
62186
+ },
62187
+ {
62188
+ "id": "ui-imperative-dialog",
62189
+ "rows": [
62190
+ {
62191
+ "name": "confirmModal(opts)",
62192
+ "type": "Promise<boolean>",
62193
+ "def": "\u2014",
62194
+ "desc": {
62195
+ "zh": "\u547D\u4EE4\u5F0F\u786E\u8BA4\u6846\uFF1Bopts \u540C `ConfirmModal`\uFF0C\u53E6\u6709 `skin`\uFF1B`true` = \u786E\u5B9A",
62196
+ "en": "Imperative confirm; opts match `ConfirmModal` plus `skin`; `true` = confirmed"
62197
+ }
62198
+ },
62199
+ {
62200
+ "name": "alertModal(opts)",
62201
+ "type": "Promise<void>",
62202
+ "def": "\u2014",
62203
+ "desc": {
62204
+ "zh": "\u547D\u4EE4\u5F0F\u8B66\u544A\u6846\uFF1Bopts \u540C `AlertModal`\uFF0C\u53E6\u6709 `skin`\uFF1B\u5173\u95ED\u5373 resolve",
62205
+ "en": "Imperative alert; opts match `AlertModal` plus `skin`; resolves on close"
62206
+ }
62207
+ },
62208
+ {
62209
+ "name": "skin",
62210
+ "type": "'core' | 'host'",
62211
+ "def": "'core'",
62212
+ "desc": {
62213
+ "zh": "host \u8D70\u5BBF\u4E3B\u539F\u751F Modal\uFF08\u9700\u5148\u5F15\u5165\u9002\u914D\u5C42 `official.js`\uFF0C\u672A\u6CE8\u518C\u5219\u56DE\u843D core \u5E76\u544A\u8B66\uFF09",
62214
+ "en": "host uses the host\u2019s native Modal (requires the `official.js` adapter; falls back to core with a warning when unregistered)"
62215
+ }
62216
+ }
62217
+ ]
61898
62218
  }
61899
62219
  ]
61900
62220
  },
@@ -62886,7 +63206,10 @@ var CODE_BTN_STATE = `<Button variant="primary">\u9ED8\u8BA4</Button>
62886
63206
  <Button variant="outline" loading={refreshing}>\u4FDD\u5B58</Button>
62887
63207
 
62888
63208
  // \u628A\u300C\u5728\u8DD1\u300D\u62A5\u51FA\u53BB\uFF0C\u9501\u6B7B\u6240\u5728\u5F39\u7A97\uFF08\u5F39\u7A97\u4F20 busy\uFF09
62889
- <Button onBusyChange={setBusy} onClick={async () => { await save() }}>\u4FDD\u5B58</Button>`;
63209
+ <Button onBusyChange={setBusy} onClick={async () => { await save() }}>\u4FDD\u5B58</Button>
63210
+
63211
+ // loading \u65F6\u53EA\u5269\u4E00\u5708\uFF1A\u6587\u6848\u6E05\u6389\u3001\u5BBD\u5EA6\u9501\u5728\u300C\u6709\u6587\u6848\u300D\u65F6\u7684\u5C3A\u5BF8\uFF0Csettle \u540E\u8FD8\u539F\uFF08\u8F6C\u5708\u4E0D\u518D\u628A\u6309\u94AE\u6491\u5BBD\uFF09
63212
+ <Button variant="outline" loadingText={false} onClick={async () => { await save() }}>\u4FDD\u5B58</Button>`;
62890
63213
  var CODE_BTN_COLOR = `<Button variant="primary" color="#7c3aed">#7c3aed</Button>
62891
63214
  <Button variant="outline" color="#0ea5e9">#0ea5e9</Button>`;
62892
63215
  var CODE_BTN_WIDTH = `// \u56FA\u5B9A\u5BBD\uFF1A\u5199\u6B7B\u5BBD\u5EA6
@@ -63054,6 +63377,16 @@ function ButtonPage() {
63054
63377
  } }, "\u70B9\u4E86\u81EA\u5DF1\u8F6C\u5708\uFF081.4s\uFF09"),
63055
63378
  (0, import_react80.createElement)(Button, { variant: "outline", loading: extLoading, onClick: () => setExtLoading((v) => !v) }, extLoading ? "\u5916\u90E8\u5237\u65B0\u4E2D\u2026" : "\u70B9\u6211\u70B9\u4EAE\u53F3\u8FB9"),
63056
63379
  (0, import_react80.createElement)(Button, { variant: "outline", loading: extLoading }, "\u88AB\u522B\u5904\u5237\u65B0\u5E26\u6210 loading")
63380
+ ),
63381
+ // 文案长又不想被圈撑宽 ⇒ loadingText={false}:清文案、锁住有文案时的宽度,只留一圈
63382
+ (0, import_react80.createElement)(
63383
+ Labeled,
63384
+ { label: "loading \u53EA\u7559\u5708\uFF08\u5BBD\u5EA6\u4E0D\u8DF3\uFF09" },
63385
+ (0, import_react80.createElement)(Button, { variant: "outline", loadingText: false, onClick: async () => {
63386
+ await demoWait();
63387
+ } }, "\u70B9\u6211\u8F6C\u5708\uFF081.4s\uFF09"),
63388
+ (0, import_react80.createElement)(Button, { variant: "primary", loadingText: false, loading: true }, "\u8BA4\u9886"),
63389
+ (0, import_react80.createElement)(Button, { variant: "outline", loading: true }, "\u5BF9\u7167\uFF1A\u52A0\u8F7D\u4E2D")
63057
63390
  )
63058
63391
  )
63059
63392
  ),
@@ -63153,10 +63486,13 @@ var CODE_INPUT_GROUP = `// \u8F93\u5165\u6846 + \u6309\u94AE\u7EC4\u710A\u6210\u
63153
63486
  value={kw}
63154
63487
  onChange={setKw}
63155
63488
  actions={[
63156
- { icon: <IconRefreshOutlineRegular size={14} />, ariaLabel: '\u91CD\u7F6E', onClick: reset },
63157
- { icon: <IconSearchOutlineRegular size={14} />, label: '\u641C\u7D22', onClick: search },
63489
+ { icon: <IconRefreshOutlineRegular size={14} />, ariaLabel: '\u91CD\u7F6E', onClick: reset },
63490
+ { icon: <IconSearchOutlineRegular size={14} />, label: '\u641C\u7D22', onClick: search },
63158
63491
  ]}
63159
- />
63492
+ />
63493
+
63494
+ // \u52A8\u4F5C\u94AE\u8F6C\u5708\u4F1A\u53D8\u5BBD \u21D2 \u6324\u7A84\u8F93\u5165\u6846\u3002\u8981\u4E0D\u52A8\uFF1A\u5B9A\u5BBD\uFF0C\u6216\u8BA9\u5B83 loading \u65F6\u53EA\u5269\u4E00\u5708
63495
+ actions={[{ label: '\u521B\u5EFA\u7528\u6237', width: 116, loadingText: false, onClick: createUser }]}
63160
63496
 
63161
63497
  // \u9AD8\u5EA6\u81EA\u5B9A\u4E49\uFF1Aheight \u76F4\u63A5\u7ED9 px\uFF0C\u538B\u8FC7 size \u6863\uFF08\u5185\u4EF6\u8DDF\u7740\u6491\u6EE1\uFF09
63162
63498
  <InputGroup value={kw} onChange={setKw} height={44} actions={[{ label: '\u786E\u5B9A', onClick: save }]} />`;
@@ -63286,7 +63622,9 @@ function InputPage() {
63286
63622
  { label: "\u8FD4\u56DE", variant: "ghost", onClick: () => {
63287
63623
  setIgValue("");
63288
63624
  } },
63289
- { label: "\u786E\u5B9A", variant: "success", onClick: () => {
63625
+ // 返回 Promise ⇒ 这枚按钮自己转圈(同 Button),调用方不用管 loading
63626
+ { label: "\u786E\u5B9A", variant: "success", onClick: async () => {
63627
+ await demoWait(1e3);
63290
63628
  } }
63291
63629
  ]
63292
63630
  }),
@@ -63305,6 +63643,28 @@ function InputPage() {
63305
63643
  } }
63306
63644
  ]
63307
63645
  }),
63646
+ // 转圈会变宽 ⇒ 下面两条对照:不定宽时按钮变宽、输入框被挤;定宽 / 只留圈时纹丝不动
63647
+ (0, import_react80.createElement)(InputGroup, {
63648
+ value: igValue,
63649
+ onChange: setIgValue,
63650
+ placeholder: "\u4E0D\u5B9A\u5BBD\uFF1A\u70B9\u300C\u521B\u5EFA\u7528\u6237\u300D\uFF0C\u6309\u94AE\u8F6C\u5708\u540C\u65F6\u53D8\u5BBD\u3001\u8F93\u5165\u6846\u88AB\u6324\u7A84",
63651
+ actions: [{ label: "\u521B\u5EFA\u7528\u6237", onClick: async () => {
63652
+ await demoWait();
63653
+ } }]
63654
+ }),
63655
+ (0, import_react80.createElement)(InputGroup, {
63656
+ value: igValue,
63657
+ onChange: setIgValue,
63658
+ placeholder: "\u5B9A\u5BBD 116 / \u53EA\u7559\u5708\uFF1A\u8F6C\u5708\u65F6\u6309\u94AE\u5BBD\u5EA6\u4E0D\u52A8",
63659
+ actions: [
63660
+ { label: "\u521B\u5EFA\u7528\u6237", width: 116, onClick: async () => {
63661
+ await demoWait();
63662
+ } },
63663
+ { label: "\u521B\u5EFA\u7528\u6237", width: 116, loadingText: false, onClick: async () => {
63664
+ await demoWait();
63665
+ } }
63666
+ ]
63667
+ }),
63308
63668
  (0, import_react80.createElement)(InputGroup, {
63309
63669
  value: igValue,
63310
63670
  onChange: setIgValue,
@@ -64366,7 +64726,18 @@ const ok = await confirmModal({
64366
64726
  onCancel: async () => { await check() }, // \u53D6\u6D88\u94AE\u4E5F\u80FD\u8F6C\u5708
64367
64727
  })
64368
64728
  // \u7EC4\u4EF6\u5F62\u6001\u81EA\u5DF1\u63A7\uFF1AconfirmLoading / cancelLoading
64369
- <ConfirmModal message="\u2026" confirmLoading={saving} onConfirm={\u2026} />`;
64729
+ <ConfirmModal message="\u2026" confirmLoading={saving} onConfirm={\u2026} />
64730
+
64731
+ // \u8F6C\u5708\u4F1A\u628A\u6309\u94AE\u6491\u5BBD 18px\uFF08\u5708 12 + \u95F4\u8DDD 6\uFF09\u21D2 \u8981\u4E0D\u52A8\u5C31\u5B9A\u5BBD\uFF0C\u6216\u8BA9\u5B83 loading \u65F6\u53EA\u5269\u4E00\u5708
64732
+ await confirmModal({
64733
+ title: '\u8BA4\u9886\u4EFB\u52A1', confirmText: '\u8BA4\u9886', cancelText: '\u53D6\u6D88',
64734
+ confirmWidth: 96, cancelWidth: 88,
64735
+ onConfirm: async () => { await claim() },
64736
+ })
64737
+ await confirmModal({
64738
+ title: '\u91CA\u653E\u4EFB\u52A1', confirmText: '\u91CA\u653E', loadingText: false,
64739
+ onConfirm: async () => { await release() },
64740
+ })`;
64370
64741
  var CODE_LARGE_MODAL = `// \u5185\u5BB9\u5F39\u7A97\uFF1Asize md / lg\uFF0C\u627F\u8F7D\u4EFB\u610F\u5185\u5BB9\uFF08\u4E0D\u662F\u300C\u786E\u5B9A/\u53D6\u6D88\u300D\u547D\u4EE4\u5F0F\uFF09
64371
64742
  <Modal title="\u4EFB\u52A1\u8BE6\u60C5" onClose={close} footer={<Button variant="primary">\u77E5\u9053\u4E86</Button>}>
64372
64743
  <div>\u5F39\u7A97\u4E3B\u4F53\u5185\u5BB9\u2014\u2014\u4F1A\u8BDD\u9884\u89C8\u8FD9\u7C7B\u529F\u80FD\u5C31\u7528\u5B83\u6765\u627F\u8F7D\u3002</div>
@@ -64616,7 +64987,42 @@ function FeedbackPage() {
64616
64987
  });
64617
64988
  notify(ok ? "\u610F\u5916\u6210\u529F" : "\u5DF2\u53D6\u6D88\uFF08false\uFF09");
64618
64989
  }
64619
- }, "confirmModal() \xB7 \u5F02\u6B65\u5931\u8D25")
64990
+ }, "confirmModal() \xB7 \u5F02\u6B65\u5931\u8D25"),
64991
+ // 转圈会撑宽按钮 ⇒ 两颗钮定宽,点「认领」时宽度与位置都不动
64992
+ (0, import_react80.createElement)(Button, {
64993
+ variant: "outline",
64994
+ onClick: async () => {
64995
+ const ok = await confirmModal({
64996
+ title: "\u8BA4\u9886\u4EFB\u52A1",
64997
+ message: "\u70B9\u300C\u8BA4\u9886\u300D\u8F6C\u5708 1.4 \u79D2\uFF1A\u4E24\u9897\u94AE\u90FD\u5B9A\u5BBD\uFF0C\u5BBD\u5EA6\u4E0D\u8DF3\u3001\u53D6\u6D88\u94AE\u4E0D\u632A\u3002",
64998
+ confirmText: "\u8BA4\u9886",
64999
+ cancelText: "\u53D6\u6D88",
65000
+ confirmWidth: 96,
65001
+ cancelWidth: 88,
65002
+ onConfirm: async () => {
65003
+ await demoWait();
65004
+ }
65005
+ });
65006
+ notify(ok ? "\u5DF2\u8BA4\u9886" : "\u5DF2\u53D6\u6D88");
65007
+ }
65008
+ }, "confirmModal() \xB7 \u5B9A\u5BBD"),
65009
+ // loading 时只剩一圈:宽度锁在「有文案」时的大小,settle 后文案回来
65010
+ (0, import_react80.createElement)(Button, {
65011
+ variant: "outline",
65012
+ onClick: async () => {
65013
+ const ok = await confirmModal({
65014
+ title: "\u91CA\u653E\u4EFB\u52A1",
65015
+ message: "\u70B9\u300C\u91CA\u653E\u300D\u540E\u6309\u94AE\u53EA\u5269\u4E00\u5708\uFF1A\u6587\u6848\u6E05\u6389\u3001\u5BBD\u5EA6\u4E0D\u53D8\uFF0C1.4 \u79D2\u540E\u4E00\u8D77\u8FD8\u539F\u3002",
65016
+ confirmText: "\u91CA\u653E",
65017
+ cancelText: "\u53D6\u6D88",
65018
+ loadingText: false,
65019
+ onConfirm: async () => {
65020
+ await demoWait();
65021
+ }
65022
+ });
65023
+ notify(ok ? "\u5DF2\u91CA\u653E" : "\u5DF2\u53D6\u6D88");
65024
+ }
65025
+ }, "confirmModal() \xB7 loading \u53EA\u7559\u5708")
64620
65026
  )
64621
65027
  )
64622
65028
  )
@@ -66132,9 +66538,9 @@ function ReferencePage() {
66132
66538
  "tbody",
66133
66539
  null,
66134
66540
  [
66135
- [t3("buildCore"), `v${"0.22.0"}`],
66136
- [t3("buildDemo"), `v${"0.22.0"}`],
66137
- [t3("buildStamp"), "261103-114124-136"]
66541
+ [t3("buildCore"), `v${"0.23.0"}`],
66542
+ [t3("buildDemo"), `v${"0.23.0"}`],
66543
+ [t3("buildStamp"), "261103-134005-609"]
66138
66544
  ].map(
66139
66545
  ([label, value]) => (0, import_react85.createElement)(
66140
66546
  "tr",
@@ -66456,9 +66862,9 @@ function DemoPage() {
66456
66862
  lineHeight: "14px"
66457
66863
  }
66458
66864
  },
66459
- (0, import_react87.createElement)("span", null, `core v${"0.22.0"}`),
66460
- (0, import_react87.createElement)("span", null, `demo v${"0.22.0"}`),
66461
- (0, import_react87.createElement)("span", { style: { marginTop: "4px", fontSize: "9px" } }, "261103-114124-136")
66865
+ (0, import_react87.createElement)("span", null, `core v${"0.23.0"}`),
66866
+ (0, import_react87.createElement)("span", null, `demo v${"0.23.0"}`),
66867
+ (0, import_react87.createElement)("span", { style: { marginTop: "4px", fontSize: "9px" } }, "261103-134005-609")
66462
66868
  )
66463
66869
  )
66464
66870
  ),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-core-demo",
3
- "version": "0.22.0",
3
+ "version": "0.23.0",
4
4
  "description": "The shared UI foundation for DSH plugins, with a live component preview: design tokens, common controls, workspace browsing and notifications maintained in one place — install it to preview every component in a real host.",
5
5
  "icon": "./assets/icon-components.svg",
6
6
  "keywords": [