dsh-plugin-core-demo 0.35.22 → 0.35.24

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 +40 -10
  2. package/package.json +1 -1
package/dist/client.js CHANGED
@@ -8649,8 +8649,9 @@ function Input(props) {
8649
8649
  const locked = useOverlayLocked();
8650
8650
  const off = disabled === true || locked;
8651
8651
  const [focused, setFocused] = (0, import_react36.useState)(false);
8652
+ const [hovered, setHovered] = (0, import_react36.useState)(false);
8652
8653
  const search = type3 === "search";
8653
- const showClear = search && value !== "" && focused && !off;
8654
+ const showClear = search && value !== "" && (focused || hovered) && !off;
8654
8655
  const input = (0, import_react36.createElement)("input", {
8655
8656
  ref: props.inputRef,
8656
8657
  type: type3 ?? "text",
@@ -8678,7 +8679,15 @@ function Input(props) {
8678
8679
  return withHint(input, props.hint);
8679
8680
  return withHint((0, import_react36.createElement)(
8680
8681
  "span",
8681
- { className: `dshpc-iwrap dshpc-iwrap${sizeClass(size4)}${showClear ? " dshpc-iwrap--clear" : ""}` },
8682
+ {
8683
+ className: `dshpc-iwrap dshpc-iwrap${sizeClass(size4)}${showClear ? " dshpc-iwrap--clear" : ""}`,
8684
+ onMouseEnter: () => {
8685
+ setHovered(true);
8686
+ },
8687
+ onMouseLeave: () => {
8688
+ setHovered(false);
8689
+ }
8690
+ },
8682
8691
  hasIcon ? (0, import_react36.createElement)("span", { className: "dshpc-iwrap__icon" }, icon2) : null,
8683
8692
  input,
8684
8693
  // 只在 mousedown 上拦焦点:不拦的话 input 先 blur ⇒ 按钮被卸掉 ⇒ 随后的 click 落空。
@@ -62354,6 +62363,8 @@ var DICT2 = {
62354
62363
  btnHintHint: "\u72EC\u7ACB\u7EC4\u4EF6\uFF0C\u653E\u54EA\u90FD\u884C\uFF0C\u60AC\u505C\u6216\u805A\u7126\u6D6E\u51FA",
62355
62364
  demoInputFamily: "Input \u5BB6\u65CF",
62356
62365
  inputHint: "\u56DB\u79CD\u8F93\u5165\u4EF6\uFF0C\u90FD\u652F\u6301 error \u4E0E\u884C\u5C3E\u95EE\u53F7\u63D0\u793A",
62366
+ demoSearchClear: "\u641C\u7D22\u6846\u6E05\u9664\u94AE",
62367
+ demoSearchClearHint: 'type="search" \u4E14\u6709\u5185\u5BB9\u65F6\uFF0C\u9F20\u6807\u79FB\u4E0A\u53BB\u6216\u805A\u7126\u90FD\u4F1A\u663E\u793A\u5C3E\u90E8 \xD7\uFF0C\u70B9\u4E00\u4E0B\u5373\u6E05\u7A7A\u2014\u2014\u4E0D\u5FC5\u5148\u70B9\u8F93\u5165\u6846\u805A\u7126\u3002',
62357
62368
  inputGroupTitle: "InputGroup\uFF08\u7EC4\u5408\u8F93\u5165\u6846\uFF09",
62358
62369
  inputGroupHint: "\u8F93\u5165\u6846 + \u540E\u7F6E\u6309\u94AE\u7EC4\u710A\u6210\u4E00\u4F53",
62359
62370
  switchTip: "\u5B98\u65B9 Switch\uFF08\u542F\u7528\u8BED\u4E49\uFF0C\u4E0D\u662F\u52FE\u9009\uFF09+ Checkbox + Segmented",
@@ -62622,6 +62633,8 @@ var DICT2 = {
62622
62633
  btnHintHint: "Standalone; hover or focus to reveal",
62623
62634
  demoInputFamily: "Input family",
62624
62635
  inputHint: "Four field types, all with error and hint",
62636
+ demoSearchClear: "Search clear button",
62637
+ demoSearchClearHint: 'A type="search" field with content shows a trailing \xD7 on hover or focus; click it to clear \u2014 no need to focus the field first.',
62625
62638
  inputGroupTitle: "InputGroup (input with actions)",
62626
62639
  inputGroupHint: "Input plus trailing actions as one unit",
62627
62640
  switchTip: "Official Switch (enable semantics, not a tick) + Checkbox + Segmented",
@@ -68070,7 +68083,7 @@ const [kw, setKw] = useState('')
68070
68083
 
68071
68084
  // hint \u53C2\u6570\u7248\uFF1A\u95EE\u53F7\u63D0\u793A\u7531\u7EC4\u4EF6\u81EA\u5DF1\u6302\uFF0C\u4E0D\u7528\u624B\u52A8\u62FC FieldHint
68072
68085
  <Input value={text} onChange={setText} placeholder="\u8BF7\u8F93\u5165\u7528\u6237\u540D" hint="\u7528\u6237\u540D\u53EA\u80FD\u5305\u542B\u5B57\u6BCD\u3001\u6570\u5B57\u4E0E\u8FDE\u5B57\u7B26\u3002" />
68073
- // \u641C\u7D22\u6846\uFF1Atype="search" \u21D2 \u805A\u7126\u4E14\u6709\u5185\u5BB9\u65F6\u53F3\u4FA7\u624D\u51FA\u6E05\u7A7A\u94AE\uFF08\u6570\u5B57\u6846\u52A0\u51CF\u53F7\u540C\u6B3E\u7684 plain IconButton\uFF0C\u539F\u751F\u90A3\u679A\u5DF2\u9690\u6389\uFF09
68086
+ // \u641C\u7D22\u6846\uFF1Atype="search" \u21D2 \u6709\u5185\u5BB9\u65F6\uFF0C\u9F20\u6807\u79FB\u4E0A\u53BB\u6216\u805A\u7126\u90FD\u4F1A\u663E\u793A\u53F3\u4FA7\u6E05\u9664\u94AE\uFF08\u6570\u5B57\u6846\u52A0\u51CF\u53F7\u540C\u6B3E plain IconButton\uFF0C\u539F\u751F\u90A3\u679A\u5DF2\u9690\u6389\uFF09
68074
68087
  // icon \u662F\u5DE6\u4FA7\u56FE\u6807\u69FD\uFF08\u4E0D\u5403\u70B9\u51FB\uFF0C\u70B9\u5728\u56FE\u6807\u4E0A\u7167\u6837\u805A\u7126\uFF09\uFF1B\u56FE\u6807\u5C3A\u5BF8\u6309\u6863\u53D6 fieldMetricsOf(size).icon
68075
68088
  <Input type="search" icon={<IconSearchOutlineRegular />} value={kw} onChange={setKw} placeholder="\u641C\u7D22" />
68076
68089
  // \u6821\u9A8C\u5931\u8D25\u6001\uFF1A\u63CF\u7EA2
@@ -68079,6 +68092,11 @@ const [kw, setKw] = useState('')
68079
68092
  <NumberInput value={num} onChange={setNum} min={0} max={10} suffix="\u6B21" hint="\u8D85\u51FA\u8303\u56F4\u4F1A\u81EA\u52A8\u6536\u56DE\u5230 min / max\u3002" />
68080
68093
  // \u591A\u884C\u8F93\u5165\uFF1A\u95EE\u53F7\u7F6E\u53F3\u4E0B\u89D2
68081
68094
  <Textarea value={text} onChange={setText} placeholder="\u591A\u884C\u8F93\u5165" hint="\u591A\u884C\u8F93\u5165\u4E5F\u652F\u6301 hint \u53C2\u6570\u3002" />`;
68095
+ var CODE_SEARCH_CLEAR = `const [kw, setKw] = useState('\u793A\u4F8B\u6587\u672C')
68096
+
68097
+ // type="search" \u21D2 \u6709\u5185\u5BB9\u65F6\uFF0C\u9F20\u6807\u79FB\u4E0A\u53BB\u6216\u805A\u7126\u90FD\u4F1A\u663E\u793A\u5C3E\u90E8\u6E05\u9664\u94AE\uFF08\xD7\uFF09
68098
+ <Input type="search" icon={<IconSearchOutlineRegular />} value={kw} onChange={setKw} placeholder="\u641C\u7D22" />
68099
+ // \u79FB\u4E0A\u53BB / \u805A\u7126 \u2192 \u53F3\u4FA7 \xD7 \u51FA\u73B0\uFF0C\u70B9\u51FB\u5373\u6E05\u7A7A\uFF08\u4E0D\u5FC5\u5148\u70B9\u8F93\u5165\u6846\u805A\u7126\uFF09`;
68082
68100
  var CODE_INPUT_GROUP = `// \u8F93\u5165\u6846 + \u6309\u94AE\u7EC4\u710A\u6210\u4E00\u4F53\uFF1Blabel \u662F\u524D\u7F6E\u6807\u9898\uFF08\u540C\u683C\u7070\u5E95\uFF09\uFF0Cundoable \u5728\u6700\u524D\u9762\u52A0\u64A4\u9500\u94AE
68083
68101
  <InputGroup
68084
68102
  label="\u4EFB\u52A1\u540D"
@@ -68184,6 +68202,7 @@ function InputPage() {
68184
68202
  const [iconSeg, setIconSeg] = (0, import_react93.useState)("search");
68185
68203
  const [iconSeg2, setIconSeg2] = (0, import_react93.useState)("all");
68186
68204
  const [kw, setKw] = (0, import_react93.useState)("");
68205
+ const [kwClear, setKwClear] = (0, import_react93.useState)("\u793A\u4F8B\u6587\u672C");
68187
68206
  const [igValue, setIgValue] = (0, import_react93.useState)("");
68188
68207
  return (0, import_react93.createElement)(
68189
68208
  "div",
@@ -68206,7 +68225,7 @@ function InputPage() {
68206
68225
  "div",
68207
68226
  { style: { display: "flex", alignItems: "center", gap: "6px" } },
68208
68227
  (0, import_react93.createElement)("span", { style: { color: "var(--dshpc-fg-2)", fontSize: "13px", flex: "none" } }, "\u641C\u7D22"),
68209
- // 左侧图标槽(icon)+ 聚焦且有内容才出的清空钮(type="search")
68228
+ // 左侧图标槽(icon)+ 有内容时移上去或聚焦即出清除钮(type="search")
68210
68229
  (0, import_react93.createElement)(Input, { type: "search", icon: (0, import_react93.createElement)(import_dsh_client_ui_primitives2.IconSearchOutlineRegular, null), value: kw, onChange: setKw, placeholder: "\u641C\u7D22" })
68211
68230
  ),
68212
68231
  (0, import_react93.createElement)(Input, { value: "bad value", onChange: () => {
@@ -68217,6 +68236,17 @@ function InputPage() {
68217
68236
  (0, import_react93.createElement)(Textarea, { value: text2, onChange: setText, placeholder: "\u591A\u884C\u8F93\u5165", hint: "\u591A\u884C\u8F93\u5165\u4E5F\u652F\u6301 hint \u53C2\u6570\u3002" })
68218
68237
  )
68219
68238
  ),
68239
+ // 搜索框清除钮:有内容时,鼠标移上去或聚焦都会显示尾部 ×,点一下即清空(不必先聚焦)
68240
+ (0, import_react93.createElement)(
68241
+ Example,
68242
+ { title: t3("demoSearchClear"), hint: t3("demoSearchClearHint"), code: CODE_SEARCH_CLEAR },
68243
+ (0, import_react93.createElement)(
68244
+ "div",
68245
+ { style: { display: "flex", flexDirection: "column", gap: "10px", maxWidth: "380px" } },
68246
+ (0, import_react93.createElement)(Input, { type: "search", icon: (0, import_react93.createElement)(import_dsh_client_ui_primitives2.IconSearchOutlineRegular, null), value: kwClear, onChange: setKwClear, placeholder: "\u641C\u7D22" }),
68247
+ (0, import_react93.createElement)("span", { style: { color: "var(--dshpc-fg-2)", fontSize: "13px" } }, "\u4E0A\u9762\u5DF2\u9884\u586B\u5185\u5BB9\uFF1A\u9F20\u6807\u79FB\u5230\u6846\u4E0A\uFF0C\u5C3E\u90E8 \xD7 \u5373\u51FA\u73B0\uFF0C\u53EF\u76F4\u63A5\u6E05\u9664\u3002")
68248
+ )
68249
+ ),
68220
68250
  // 组合输入框:输入框 + 按钮组焊成一体(前置标题 / 撤销 / 图标按钮 / 自定义高度)
68221
68251
  (0, import_react93.createElement)(
68222
68252
  Example,
@@ -71490,9 +71520,9 @@ function ReferencePage() {
71490
71520
  "tbody",
71491
71521
  null,
71492
71522
  [
71493
- [t3("buildCore"), `v${"0.35.22"}`],
71494
- [t3("buildDemo"), `v${"0.35.22"}`],
71495
- [t3("buildStamp"), "261111-055540-723"]
71523
+ [t3("buildCore"), `v${"0.35.24"}`],
71524
+ [t3("buildDemo"), `v${"0.35.24"}`],
71525
+ [t3("buildStamp"), "261111-115642-456"]
71496
71526
  ].map(
71497
71527
  ([label, value]) => (0, import_react99.createElement)(
71498
71528
  "tr",
@@ -71808,9 +71838,9 @@ function DemoPage() {
71808
71838
  lineHeight: "14px"
71809
71839
  }
71810
71840
  },
71811
- (0, import_react101.createElement)("span", null, `core v${"0.35.22"}`),
71812
- (0, import_react101.createElement)("span", null, `demo v${"0.35.22"}`),
71813
- (0, import_react101.createElement)("span", { style: { marginTop: "4px", fontSize: "9px" } }, "261111-055540-723")
71841
+ (0, import_react101.createElement)("span", null, `core v${"0.35.24"}`),
71842
+ (0, import_react101.createElement)("span", null, `demo v${"0.35.24"}`),
71843
+ (0, import_react101.createElement)("span", { style: { marginTop: "4px", fontSize: "9px" } }, "261111-115642-456")
71814
71844
  )
71815
71845
  )
71816
71846
  ),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-core-demo",
3
- "version": "0.35.22",
3
+ "version": "0.35.24",
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": [