@sia.soul/sia-react-ui 0.1.152 → 0.1.153

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.
@@ -1556,7 +1556,7 @@ var LIST_IGNORE = /* @__PURE__ */ Symbol("SIA_UPLOAD_LIST_IGNORE");
1556
1556
  function useThumbnail(file, accept) {
1557
1557
  const [local, setLocal] = useState6();
1558
1558
  useEffect5(() => {
1559
- if (!file?.thumbUrl && file?.originFileObj?.type.startsWith("image/")) {
1559
+ if (!file?.thumbUrl && file?.originFileObj instanceof Blob && file.originFileObj.type.startsWith("image/")) {
1560
1560
  const url = URL.createObjectURL(file.originFileObj);
1561
1561
  setLocal(url);
1562
1562
  return () => URL.revokeObjectURL(url);
package/dist/core.cjs CHANGED
@@ -6044,7 +6044,7 @@ var LIST_IGNORE = /* @__PURE__ */ Symbol("SIA_UPLOAD_LIST_IGNORE");
6044
6044
  function useThumbnail(file, accept) {
6045
6045
  const [local, setLocal] = (0, import_react32.useState)();
6046
6046
  (0, import_react32.useEffect)(() => {
6047
- if (!file?.thumbUrl && file?.originFileObj?.type.startsWith("image/")) {
6047
+ if (!file?.thumbUrl && file?.originFileObj instanceof Blob && file.originFileObj.type.startsWith("image/")) {
6048
6048
  const url = URL.createObjectURL(file.originFileObj);
6049
6049
  setLocal(url);
6050
6050
  return () => URL.revokeObjectURL(url);
package/dist/core.css CHANGED
@@ -371,6 +371,12 @@ fieldset:disabled .sia-input-number__floating-placeholder {
371
371
  .sia-form--horizontal .sia-form-item--align-center > .sia-form-item__label {
372
372
  padding-top: 0;
373
373
  }
374
+ .sia-form--horizontal .sia-form-item--multiline-label {
375
+ align-items: center;
376
+ }
377
+ .sia-form--horizontal .sia-form-item--multiline-label > .sia-form-item__label {
378
+ padding-top: 0;
379
+ }
374
380
  .sia-form--horizontal .sia-form-item--align-center > .sia-form-item__control > .sia-floating > .sia-form-item__input-wrap {
375
381
  display: flex;
376
382
  flex-direction: column;
@@ -8265,8 +8271,20 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
8265
8271
  color: var(--sia-color-text);
8266
8272
  }
8267
8273
  .sia-form-item__label-content {
8268
- display: inline-block;
8274
+ display: flex;
8275
+ align-items: center;
8269
8276
  width: max-content;
8277
+ max-width: 180px;
8278
+ margin-left: auto;
8279
+ }
8280
+ .sia-form-item__label-text {
8281
+ display: -webkit-box;
8282
+ min-width: 0;
8283
+ -webkit-box-orient: vertical;
8284
+ -webkit-line-clamp: 2;
8285
+ overflow: hidden;
8286
+ overflow-wrap: anywhere;
8287
+ white-space: normal;
8270
8288
  }
8271
8289
  .sia-form-item__label {
8272
8290
  padding-top: 8px;
@@ -8275,6 +8293,7 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
8275
8293
  line-height: 1.45;
8276
8294
  }
8277
8295
  .sia-form-item__required-mark {
8296
+ flex: none;
8278
8297
  margin-right: 4px;
8279
8298
  color: var(--sia-color-error);
8280
8299
  }
@@ -8364,6 +8383,10 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
8364
8383
  padding-top: 0;
8365
8384
  text-align: left;
8366
8385
  }
8386
+ .sia-form--vertical .sia-form-item__label-content,
8387
+ .sia-form--inline .sia-form-item__label-content {
8388
+ margin-left: 0;
8389
+ }
8367
8390
  .sia-form--inline > fieldset {
8368
8391
  display: flex;
8369
8392
  align-items: start;
@@ -8393,6 +8416,9 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
8393
8416
  padding-top: 0;
8394
8417
  text-align: left;
8395
8418
  }
8419
+ .sia-form-item__label-content {
8420
+ margin-left: 0;
8421
+ }
8396
8422
  .sia-picker-range {
8397
8423
  align-items: stretch;
8398
8424
  flex-direction: column;
package/dist/core.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  Typography,
12
12
  Upload,
13
13
  message
14
- } from "./chunk-GA5HA2A4.js";
14
+ } from "./chunk-AWBINTI3.js";
15
15
  import "./chunk-RX242MUO.js";
16
16
  import {
17
17
  Select
package/dist/game.css CHANGED
@@ -422,6 +422,12 @@ fieldset:disabled .sia-input-number__floating-placeholder {
422
422
  .sia-form--horizontal .sia-form-item--align-center > .sia-form-item__label {
423
423
  padding-top: 0;
424
424
  }
425
+ .sia-form--horizontal .sia-form-item--multiline-label {
426
+ align-items: center;
427
+ }
428
+ .sia-form--horizontal .sia-form-item--multiline-label > .sia-form-item__label {
429
+ padding-top: 0;
430
+ }
425
431
  .sia-form--horizontal .sia-form-item--align-center > .sia-form-item__control > .sia-floating > .sia-form-item__input-wrap {
426
432
  display: flex;
427
433
  flex-direction: column;
package/dist/index.cjs CHANGED
@@ -8695,6 +8695,8 @@ function FormRoot({
8695
8695
  observed.add(label);
8696
8696
  }
8697
8697
  if (label.getClientRects().length) width = Math.max(width, label.offsetWidth);
8698
+ const multiline = label.getBoundingClientRect().height > parseFloat(getComputedStyle(label).lineHeight) * 1.5;
8699
+ label.closest(".sia-form-item")?.classList.toggle("sia-form-item--multiline-label", multiline);
8698
8700
  });
8699
8701
  const value = `${Math.ceil(width)}px`;
8700
8702
  if (root.style.getPropertyValue("--sia-form-auto-label-width") !== value) root.style.setProperty("--sia-form-auto-label-width", value);
@@ -8874,10 +8876,10 @@ function FormItem({
8874
8876
  if (noStyle) return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_jsx_runtime37.Fragment, { children: content });
8875
8877
  const inputWrap = /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "sia-form-item__input-wrap", onMouseEnter: () => setErrorHovered(true), onMouseLeave: () => setErrorHovered(false), children: content });
8876
8878
  return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { ref: itemRef, className: `sia-form-item${align === "center" ? " sia-form-item--align-center" : ""}${status ? ` sia-form-item--${status}` : ""} ${className}`.trim(), "data-sia-form-field": key || void 0, children: [
8877
- label ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { id: labelId, className: "sia-form-item__label", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "sia-form-item__label-content", children: [
8879
+ label ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { id: labelId, className: "sia-form-item__label", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(Tooltip, { title: label, children: /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("span", { className: "sia-form-item__label-content", children: [
8878
8880
  ruleRequired ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "sia-form-item__required-mark", "aria-hidden": "true", children: "*" }) : null,
8879
- label
8880
- ] }) }) : null,
8881
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", { className: "sia-form-item__label-text", children: label })
8882
+ ] }) }) }) : null,
8881
8883
  /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "sia-form-item__control", children: [
8882
8884
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
8883
8885
  Tooltip,
@@ -11306,7 +11308,7 @@ var LIST_IGNORE = /* @__PURE__ */ Symbol("SIA_UPLOAD_LIST_IGNORE");
11306
11308
  function useThumbnail(file, accept) {
11307
11309
  const [local, setLocal] = (0, import_react50.useState)();
11308
11310
  (0, import_react50.useEffect)(() => {
11309
- if (!file?.thumbUrl && file?.originFileObj?.type.startsWith("image/")) {
11311
+ if (!file?.thumbUrl && file?.originFileObj instanceof Blob && file.originFileObj.type.startsWith("image/")) {
11310
11312
  const url = URL.createObjectURL(file.originFileObj);
11311
11313
  setLocal(url);
11312
11314
  return () => URL.revokeObjectURL(url);
package/dist/index.css CHANGED
@@ -371,6 +371,12 @@ fieldset:disabled .sia-input-number__floating-placeholder {
371
371
  .sia-form--horizontal .sia-form-item--align-center > .sia-form-item__label {
372
372
  padding-top: 0;
373
373
  }
374
+ .sia-form--horizontal .sia-form-item--multiline-label {
375
+ align-items: center;
376
+ }
377
+ .sia-form--horizontal .sia-form-item--multiline-label > .sia-form-item__label {
378
+ padding-top: 0;
379
+ }
374
380
  .sia-form--horizontal .sia-form-item--align-center > .sia-form-item__control > .sia-floating > .sia-form-item__input-wrap {
375
381
  display: flex;
376
382
  flex-direction: column;
@@ -8265,8 +8271,20 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
8265
8271
  color: var(--sia-color-text);
8266
8272
  }
8267
8273
  .sia-form-item__label-content {
8268
- display: inline-block;
8274
+ display: flex;
8275
+ align-items: center;
8269
8276
  width: max-content;
8277
+ max-width: 180px;
8278
+ margin-left: auto;
8279
+ }
8280
+ .sia-form-item__label-text {
8281
+ display: -webkit-box;
8282
+ min-width: 0;
8283
+ -webkit-box-orient: vertical;
8284
+ -webkit-line-clamp: 2;
8285
+ overflow: hidden;
8286
+ overflow-wrap: anywhere;
8287
+ white-space: normal;
8270
8288
  }
8271
8289
  .sia-form-item__label {
8272
8290
  padding-top: 8px;
@@ -8275,6 +8293,7 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
8275
8293
  line-height: 1.45;
8276
8294
  }
8277
8295
  .sia-form-item__required-mark {
8296
+ flex: none;
8278
8297
  margin-right: 4px;
8279
8298
  color: var(--sia-color-error);
8280
8299
  }
@@ -8364,6 +8383,10 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
8364
8383
  padding-top: 0;
8365
8384
  text-align: left;
8366
8385
  }
8386
+ .sia-form--vertical .sia-form-item__label-content,
8387
+ .sia-form--inline .sia-form-item__label-content {
8388
+ margin-left: 0;
8389
+ }
8367
8390
  .sia-form--inline > fieldset {
8368
8391
  display: flex;
8369
8392
  align-items: start;
@@ -8393,6 +8416,9 @@ body:has(.sia-window-frame[data-sia-text-selectable=false]) img {
8393
8416
  padding-top: 0;
8394
8417
  text-align: left;
8395
8418
  }
8419
+ .sia-form-item__label-content {
8420
+ margin-left: 0;
8421
+ }
8396
8422
  .sia-picker-range {
8397
8423
  align-items: stretch;
8398
8424
  flex-direction: column;
package/dist/index.d.cts CHANGED
@@ -920,7 +920,7 @@ declare function FormRoot({ fill, form, initialValues, layout, size: sizeProp, p
920
920
  interface FormItemProps {
921
921
  /** 绑定到表单值的字段名或嵌套路径,例如 ["user", "name"]。 */
922
922
  name?: NamePath;
923
- /** 字段标签,支持文本或 React 节点;横向及行内布局未指定标签列宽时,与同一 Form 内最宽的可见标签对齐,测量包含必填标记。未渲染标签时,控件占据表单项整行宽度。 */
923
+ /** 字段标签,支持文本或 React 节点;默认最大宽度 180px(包含必填标记),文案自动换行并在超过两行时省略,悬停显示全文;必填星号与整块文案垂直居中。横向布局的两行标签作为整体与控件垂直居中;横向及行内布局按同一 Form 内最宽可见标签对齐,无标签时控件占整行。 */
924
924
  label?: ReactNode;
925
925
  /** 横向表单中标签与内容的垂直对齐:start 对齐首行控件,center 将标签与整个内容区居中,适合只读文字和多行信息。纵向、行内、窄屏堆叠及 noStyle 布局不受影响。
926
926
  * @defaultValue "start"
package/dist/index.d.ts CHANGED
@@ -920,7 +920,7 @@ declare function FormRoot({ fill, form, initialValues, layout, size: sizeProp, p
920
920
  interface FormItemProps {
921
921
  /** 绑定到表单值的字段名或嵌套路径,例如 ["user", "name"]。 */
922
922
  name?: NamePath;
923
- /** 字段标签,支持文本或 React 节点;横向及行内布局未指定标签列宽时,与同一 Form 内最宽的可见标签对齐,测量包含必填标记。未渲染标签时,控件占据表单项整行宽度。 */
923
+ /** 字段标签,支持文本或 React 节点;默认最大宽度 180px(包含必填标记),文案自动换行并在超过两行时省略,悬停显示全文;必填星号与整块文案垂直居中。横向布局的两行标签作为整体与控件垂直居中;横向及行内布局按同一 Form 内最宽可见标签对齐,无标签时控件占整行。 */
924
924
  label?: ReactNode;
925
925
  /** 横向表单中标签与内容的垂直对齐:start 对齐首行控件,center 将标签与整个内容区居中,适合只读文字和多行信息。纵向、行内、窄屏堆叠及 noStyle 布局不受影响。
926
926
  * @defaultValue "start"
package/dist/index.js CHANGED
@@ -82,7 +82,7 @@ import {
82
82
  Watermark,
83
83
  message,
84
84
  notification
85
- } from "./chunk-GA5HA2A4.js";
85
+ } from "./chunk-AWBINTI3.js";
86
86
  import "./chunk-RX242MUO.js";
87
87
  import {
88
88
  MarkdownEditor
@@ -2335,6 +2335,8 @@ function FormRoot({
2335
2335
  observed.add(label);
2336
2336
  }
2337
2337
  if (label.getClientRects().length) width = Math.max(width, label.offsetWidth);
2338
+ const multiline = label.getBoundingClientRect().height > parseFloat(getComputedStyle(label).lineHeight) * 1.5;
2339
+ label.closest(".sia-form-item")?.classList.toggle("sia-form-item--multiline-label", multiline);
2338
2340
  });
2339
2341
  const value = `${Math.ceil(width)}px`;
2340
2342
  if (root.style.getPropertyValue("--sia-form-auto-label-width") !== value) root.style.setProperty("--sia-form-auto-label-width", value);
@@ -2514,10 +2516,10 @@ function FormItem({
2514
2516
  if (noStyle) return /* @__PURE__ */ jsx12(Fragment4, { children: content });
2515
2517
  const inputWrap = /* @__PURE__ */ jsx12("div", { className: "sia-form-item__input-wrap", onMouseEnter: () => setErrorHovered(true), onMouseLeave: () => setErrorHovered(false), children: content });
2516
2518
  return /* @__PURE__ */ jsxs12("div", { ref: itemRef, className: `sia-form-item${align === "center" ? " sia-form-item--align-center" : ""}${status ? ` sia-form-item--${status}` : ""} ${className}`.trim(), "data-sia-form-field": key || void 0, children: [
2517
- label ? /* @__PURE__ */ jsx12("div", { id: labelId, className: "sia-form-item__label", children: /* @__PURE__ */ jsxs12("span", { className: "sia-form-item__label-content", children: [
2519
+ label ? /* @__PURE__ */ jsx12("div", { id: labelId, className: "sia-form-item__label", children: /* @__PURE__ */ jsx12(Tooltip, { title: label, children: /* @__PURE__ */ jsxs12("span", { className: "sia-form-item__label-content", children: [
2518
2520
  ruleRequired ? /* @__PURE__ */ jsx12("span", { className: "sia-form-item__required-mark", "aria-hidden": "true", children: "*" }) : null,
2519
- label
2520
- ] }) }) : null,
2521
+ /* @__PURE__ */ jsx12("span", { className: "sia-form-item__label-text", children: label })
2522
+ ] }) }) }) : null,
2521
2523
  /* @__PURE__ */ jsxs12("div", { className: "sia-form-item__control", children: [
2522
2524
  /* @__PURE__ */ jsx12(
2523
2525
  Tooltip,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sia.soul/sia-react-ui",
3
- "version": "0.1.152",
3
+ "version": "0.1.153",
4
4
  "description": "Sia Design components and tokens for React",
5
5
  "publishConfig": {
6
6
  "access": "public",