@qijenchen/design-system 0.1.0-beta.95 → 0.1.0-beta.96

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 (92) hide show
  1. package/dist/components/Calendar/calendar.d.ts.map +1 -1
  2. package/dist/components/Calendar/calendar.js +47 -23
  3. package/dist/components/Calendar/calendar.js.map +1 -1
  4. package/dist/components/DataTable/cell-registry.d.ts.map +1 -1
  5. package/dist/components/DataTable/cell-registry.js +1 -5
  6. package/dist/components/DataTable/cell-registry.js.map +1 -1
  7. package/dist/components/DataTable/data-table.d.ts.map +1 -1
  8. package/dist/components/DataTable/data-table.js +3 -2
  9. package/dist/components/DataTable/data-table.js.map +1 -1
  10. package/dist/components/DatePicker/date-picker.d.ts.map +1 -1
  11. package/dist/components/DatePicker/date-picker.js +183 -156
  12. package/dist/components/DatePicker/date-picker.js.map +1 -1
  13. package/dist/components/Dialog/dialog.d.ts.map +1 -1
  14. package/dist/components/Dialog/dialog.js +4 -2
  15. package/dist/components/Dialog/dialog.js.map +1 -1
  16. package/dist/components/Field/field-context.d.ts +12 -0
  17. package/dist/components/Field/field-context.d.ts.map +1 -1
  18. package/dist/components/Field/field-context.js +10 -1
  19. package/dist/components/Field/field-context.js.map +1 -1
  20. package/dist/components/Field/field-wrapper.d.ts.map +1 -1
  21. package/dist/components/Field/field-wrapper.js +7 -1
  22. package/dist/components/Field/field-wrapper.js.map +1 -1
  23. package/dist/components/Field/field.d.ts.map +1 -1
  24. package/dist/components/Field/field.js +11 -2
  25. package/dist/components/Field/field.js.map +1 -1
  26. package/dist/components/InlineEdit/inline-edit.d.ts +5 -0
  27. package/dist/components/InlineEdit/inline-edit.d.ts.map +1 -1
  28. package/dist/components/InlineEdit/inline-edit.js +65 -33
  29. package/dist/components/InlineEdit/inline-edit.js.map +1 -1
  30. package/dist/components/Input/input.d.ts.map +1 -1
  31. package/dist/components/Input/input.js +3 -2
  32. package/dist/components/Input/input.js.map +1 -1
  33. package/dist/components/LinkInput/link-input.d.ts.map +1 -1
  34. package/dist/components/LinkInput/link-input.js +2 -1
  35. package/dist/components/LinkInput/link-input.js.map +1 -1
  36. package/dist/components/Popover/popover.d.ts.map +1 -1
  37. package/dist/components/Popover/popover.js +4 -2
  38. package/dist/components/Popover/popover.js.map +1 -1
  39. package/dist/components/Select/select.d.ts.map +1 -1
  40. package/dist/components/Select/select.js +59 -37
  41. package/dist/components/Select/select.js.map +1 -1
  42. package/dist/components/Textarea/textarea.d.ts +11 -0
  43. package/dist/components/Textarea/textarea.d.ts.map +1 -1
  44. package/dist/components/Textarea/textarea.js +22 -5
  45. package/dist/components/Textarea/textarea.js.map +1 -1
  46. package/dist/components/TimePicker/time-picker.d.ts.map +1 -1
  47. package/dist/components/TimePicker/time-picker.js +4 -3
  48. package/dist/components/TimePicker/time-picker.js.map +1 -1
  49. package/dist/patterns/element-anatomy/item-anatomy.d.ts +9 -0
  50. package/dist/patterns/element-anatomy/item-anatomy.d.ts.map +1 -1
  51. package/dist/patterns/element-anatomy/item-anatomy.js +71 -27
  52. package/dist/patterns/element-anatomy/item-anatomy.js.map +1 -1
  53. package/ds-canonical/fork/consumer/lock.json +4 -4
  54. package/ds-canonical/fork/governance.lock +1 -1
  55. package/ds-canonical/fork/manifest.json +6 -6
  56. package/llms-full.txt +1 -1
  57. package/llms.txt +1 -1
  58. package/package.json +1 -1
  59. package/src/components/Accordion/accordion.principles.stories.tsx +16 -26
  60. package/src/components/Accordion/accordion.stories.tsx +22 -40
  61. package/src/components/Calendar/calendar.spec.md +1 -1
  62. package/src/components/Calendar/calendar.tsx +59 -25
  63. package/src/components/DataTable/cell-registry.tsx +3 -7
  64. package/src/components/DataTable/data-table.spec.md +1 -0
  65. package/src/components/DataTable/data-table.tsx +9 -2
  66. package/src/components/DatePicker/date-picker.spec.md +1 -1
  67. package/src/components/DatePicker/date-picker.tsx +203 -147
  68. package/src/components/Dialog/dialog.spec.md +1 -1
  69. package/src/components/Dialog/dialog.tsx +8 -2
  70. package/src/components/Field/field-context.ts +25 -1
  71. package/src/components/Field/field-wrapper.tsx +7 -1
  72. package/src/components/Field/field.spec.md +7 -0
  73. package/src/components/Field/field.tsx +13 -2
  74. package/src/components/InlineEdit/inline-edit.spec.md +12 -0
  75. package/src/components/InlineEdit/inline-edit.stories.tsx +28 -17
  76. package/src/components/InlineEdit/inline-edit.tsx +94 -31
  77. package/src/components/Input/input.tsx +7 -2
  78. package/src/components/LinkInput/link-input.spec.md +1 -1
  79. package/src/components/LinkInput/link-input.tsx +5 -1
  80. package/src/components/Popover/popover.tsx +7 -2
  81. package/src/components/Select/select.principles.stories.tsx +4 -3
  82. package/src/components/Select/select.stories.tsx +7 -6
  83. package/src/components/Select/select.tsx +61 -29
  84. package/src/components/Textarea/textarea.spec.md +10 -1
  85. package/src/components/Textarea/textarea.tsx +38 -5
  86. package/src/components/TimePicker/time-picker.tsx +11 -5
  87. package/src/components/Tooltip/tooltip.spec.md +6 -0
  88. package/src/patterns/element-anatomy/item-anatomy.spec.md +8 -1
  89. package/src/patterns/element-anatomy/item-anatomy.tsx +111 -30
  90. package/src/patterns/element-anatomy/truncated-text.spec.md +13 -2
  91. package/src/tokens/uiSize/uiSize.css +11 -0
  92. package/src/tokens/uiSize/uiSize.spec.md +1 -0
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/date-picker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAwB,UAAU,EAAE,MAAM,8CAA8C,CAAA;AAQ7H,OAAO,EAKL,KAAK,QAAQ,EACd,MAAM,oDAAoD,CAAA;AAK3D,MAAM,WAAW,iBAAiB;IAChC,4FAA4F;IAC5F,aAAa,CAAC,EAAE,IAAI,CAAC,qBAAqB,CAAA;IAC1C,yBAAyB;IACzB,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AA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9B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,CAAA;IACnB,uCAAuC;IACvC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,UAAU,CAAC,EAAE,QAAQ,CAAA;IACrB,UAAU,CAAC,EAAE,QAAQ,CAAA;IACrB,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAGD,QAAA,MAAM,eAAe,6FAscpB,CAAA;AAKD,QAAA,MAAM,mBAAmB;;CAAwD,CAAA;AAIjF,eAAO,MAAM,cAAc;;;;;;;;;;;CAiBjB,CAAA;AAEV,OAAO,EACL,mBAAmB,IAAI,UAAU,EACjC,eAAe,EACf,UAAU,GACX,CAAA"}
@@ -5,6 +5,9 @@ import { cn } from "../../lib/utils.js";
5
5
  import { nakedCellRowModeAlign, fieldWrapperStyles, bareInputStyles, fieldDisplayTextClass } from "../Field/field-wrapper.js";
6
6
  import { ICON_SIZE, ItemSuffix, ItemInlineAction } from "../../patterns/element-anatomy/item-anatomy.js";
7
7
  import { Popover, PopoverAnchor, PopoverContent, PopoverTrigger } from "../Popover/popover.js";
8
+ import { Tooltip, TooltipTrigger, TooltipContent } from "../Tooltip/tooltip.js";
9
+ import { useTruncated } from "../../hooks/use-truncated.js";
10
+ import { TruncatedText } from "../../patterns/element-anatomy/truncated-text.js";
8
11
  import { DateGrid } from "../DateGrid/date-grid.js";
9
12
  import { Button } from "../Button/button.js";
10
13
  import { SurfaceFooter } from "../../patterns/overlay-surface/overlay-surface.js";
@@ -230,10 +233,14 @@ const DatePicker = React.forwardRef(
230
233
  setDraft(iso);
231
234
  }
232
235
  }, [onChange, showTime]);
236
+ const { ref: triggerTruncationRef, isTruncated: triggerTruncated } = useTruncated({
237
+ deps: [!typeable && displayValue ? displayLive : ""]
238
+ });
239
+ const triggerTooltipActive = !typeable && !!displayValue && triggerTruncated && !open;
233
240
  if (resolvedMode === "view") {
234
241
  if (!showDisplayEndIcon) {
235
242
  if (!value) return /* @__PURE__ */ jsx("span", { className: cn(fieldDisplayTextClass(size), fieldEmptyColorClass(resolvedMode), className), children: emptyDisplay });
236
- return /* @__PURE__ */ jsx("span", { className: cn(fieldDisplayTextClass(size), "truncate", className), children: displayCommitted });
243
+ return /* @__PURE__ */ jsx(TruncatedText, { className: cn(fieldDisplayTextClass(size), className), children: displayCommitted });
237
244
  }
238
245
  return /* @__PURE__ */ jsxs(
239
246
  "div",
@@ -241,7 +248,7 @@ const DatePicker = React.forwardRef(
241
248
  className: cn(fieldWrapperStyles({ mode: "view", variant, width, size }), className),
242
249
  "data-field-mode": "view",
243
250
  children: [
244
- /* @__PURE__ */ jsx("span", { className: cn(bareInputStyles, "flex-1 min-w-0 truncate", !value && fieldEmptyColorClass(resolvedMode)), children: value ? displayCommitted : emptyDisplay }),
251
+ /* @__PURE__ */ jsx(TruncatedText, { className: cn(bareInputStyles, "flex-1 min-w-0", !value && fieldEmptyColorClass(resolvedMode)), children: value ? displayCommitted : emptyDisplay }),
245
252
  /* @__PURE__ */ jsx(ItemSuffix, { className: "pointer-events-none", children: /* @__PURE__ */ jsx(Calendar, { size: iconSize, className: "text-fg-muted", "aria-hidden": true }) })
246
253
  ]
247
254
  }
@@ -256,7 +263,7 @@ const DatePicker = React.forwardRef(
256
263
  "aria-disabled": resolvedMode === "disabled" ? true : void 0,
257
264
  ...props,
258
265
  children: [
259
- /* @__PURE__ */ jsx("span", { className: cn("flex-1 min-w-0 truncate", resolvedMode === "disabled" && "text-fg-disabled"), children: value ? displayCommitted : /* @__PURE__ */ jsx("span", { className: fieldEmptyColorClass(resolvedMode), children: emptyDisplay }) }),
266
+ /* @__PURE__ */ jsx(TruncatedText, { className: cn("flex-1", resolvedMode === "disabled" && "text-fg-disabled"), children: value ? displayCommitted : /* @__PURE__ */ jsx("span", { className: fieldEmptyColorClass(resolvedMode), children: emptyDisplay }) }),
260
267
  (variant === "naked" ? showDisplayEndIcon : resolvedMode === "disabled") && /* @__PURE__ */ jsx(ItemSuffix, { className: "pointer-events-none", children: /* @__PURE__ */ jsx(Calendar, { size: iconSize, className: resolvedMode === "disabled" ? "text-fg-disabled" : "text-fg-muted", "aria-hidden": true }) })
261
268
  ]
262
269
  }
@@ -276,121 +283,127 @@ const DatePicker = React.forwardRef(
276
283
  commitDraft(now);
277
284
  };
278
285
  return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
279
- /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
280
- "div",
281
- {
282
- ref,
283
- id: typeable ? void 0 : idProp ?? (fieldCtx == null ? void 0 : fieldCtx.id),
284
- role: typeable ? void 0 : "combobox",
285
- tabIndex: typeable ? void 0 : disabled ? -1 : 0,
286
- "aria-disabled": typeable ? void 0 : disabled || void 0,
287
- "aria-label": typeable ? void 0 : accessibleName,
288
- "aria-labelledby": typeable ? void 0 : ariaLabelledByProp ?? (fieldCtx == null ? void 0 : fieldCtx.labelId),
289
- "aria-invalid": typeable ? void 0 : error || void 0,
290
- "aria-required": typeable ? void 0 : (fieldCtx == null ? void 0 : fieldCtx.required) || void 0,
291
- "aria-describedby": typeable ? void 0 : ariaDescribedByProp ?? (fieldCtx == null ? void 0 : fieldCtx.descriptionId),
292
- "aria-errormessage": typeable ? void 0 : ariaErrorMessageProp ?? (error ? fieldCtx == null ? void 0 : fieldCtx.errorId : void 0),
293
- "aria-haspopup": typeable ? void 0 : "dialog",
294
- "aria-expanded": typeable ? void 0 : open,
295
- "data-field-mode": "edit",
296
- "data-error": error ? "" : void 0,
297
- onKeyDown: typeable ? void 0 : (e) => {
298
- if (e.key === "Enter" || e.key === " ") {
299
- e.preventDefault();
300
- setOpen(true);
301
- }
302
- if (e.key === "Escape") setOpen(false);
303
- },
304
- className: cn(
305
- fieldWrapperStyles({ mode: "edit", variant, width, size, error }),
306
- "text-left cursor-pointer",
307
- "focus-visible:outline-none",
308
- className
309
- ),
310
- ...props,
311
- children: [
312
- typeable ? (
313
- // Issue 10 typed input(2026-05-10):real `<input>` 接 user 鍵盤打字。
314
- // Click 在 input 上不 propagate 給外層 popover trigger(避免每次打字都開 popover)。
315
- // Calendar icon `<ItemSuffix>` 點才開 popover(Material/Ant typed-date idiom)。
316
- // a11y(2026-07-14 dim-10 修):input 持完整 combobox 語意(id/name/state,APG
317
- // editable-combobox)— 外層 div 已讓位(見上方 role/tabIndex 註解);ArrowDown
318
- // 開 popover 補鍵盤開啟路徑(原僅 icon click 可開,鍵盤 user 無入口)。
319
- /* @__PURE__ */ jsx(
320
- "input",
321
- {
322
- type: "text",
323
- id: idProp ?? (fieldCtx == null ? void 0 : fieldCtx.id),
324
- role: "combobox",
325
- "aria-haspopup": "dialog",
326
- "aria-expanded": open,
327
- "aria-label": accessibleName,
328
- "aria-labelledby": ariaLabelledByProp ?? (fieldCtx == null ? void 0 : fieldCtx.labelId),
329
- "aria-required": (fieldCtx == null ? void 0 : fieldCtx.required) || void 0,
330
- "aria-describedby": ariaDescribedByProp ?? (fieldCtx == null ? void 0 : fieldCtx.descriptionId),
331
- "aria-errormessage": ariaErrorMessageProp ?? (inputInvalid || error ? fieldCtx == null ? void 0 : fieldCtx.errorId : void 0),
332
- disabled,
333
- className: cn(bareInputStyles, "truncate", !inputDraft && "placeholder:text-fg-muted"),
334
- value: inputDraft,
335
- placeholder: resolvedPlaceholder,
336
- "aria-invalid": inputInvalid || error || void 0,
337
- onChange: (e) => {
338
- setInputDraft(e.target.value);
339
- setInputInvalid(false);
340
- },
341
- onCompositionStart: () => {
342
- composingRef.current = true;
343
- },
344
- onCompositionEnd: () => {
345
- composingRef.current = false;
346
- },
347
- onKeyDown: (e) => {
348
- if (composingRef.current) return;
349
- if (e.key === "Enter") {
350
- e.preventDefault();
351
- handleInputCommit(inputDraft);
352
- }
353
- if (e.key === "Escape") {
354
- setInputDraft(displayLive);
286
+ /* @__PURE__ */ jsxs(Tooltip, { open: triggerTooltipActive ? void 0 : false, children: [
287
+ /* @__PURE__ */ jsx(PopoverTrigger, { asChild: true, children: /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxs(
288
+ "div",
289
+ {
290
+ ref,
291
+ id: typeable ? void 0 : idProp ?? (fieldCtx == null ? void 0 : fieldCtx.id),
292
+ role: typeable ? void 0 : "combobox",
293
+ tabIndex: typeable ? void 0 : disabled ? -1 : 0,
294
+ "aria-disabled": typeable ? void 0 : disabled || void 0,
295
+ "aria-label": typeable ? void 0 : accessibleName,
296
+ "aria-labelledby": typeable ? void 0 : ariaLabelledByProp ?? (fieldCtx == null ? void 0 : fieldCtx.labelId),
297
+ "aria-invalid": typeable ? void 0 : error || void 0,
298
+ "aria-required": typeable ? void 0 : (fieldCtx == null ? void 0 : fieldCtx.required) || void 0,
299
+ "aria-describedby": typeable ? void 0 : ariaDescribedByProp ?? (fieldCtx == null ? void 0 : fieldCtx.descriptionId),
300
+ "aria-errormessage": typeable ? void 0 : ariaErrorMessageProp ?? (error ? fieldCtx == null ? void 0 : fieldCtx.errorId : void 0),
301
+ "aria-haspopup": typeable ? void 0 : "dialog",
302
+ "aria-expanded": typeable ? void 0 : open,
303
+ "data-field-mode": "edit",
304
+ "data-error": error ? "" : void 0,
305
+ onKeyDown: typeable ? void 0 : (e) => {
306
+ if (e.key === "Enter" || e.key === " ") {
307
+ e.preventDefault();
308
+ setOpen(true);
309
+ }
310
+ if (e.key === "Escape") setOpen(false);
311
+ },
312
+ className: cn(
313
+ fieldWrapperStyles({ mode: "edit", variant, width, size, error }),
314
+ "text-left cursor-pointer",
315
+ "focus-visible:outline-none",
316
+ className
317
+ ),
318
+ ...props,
319
+ children: [
320
+ typeable ? (
321
+ // Issue 10 typed input(2026-05-10):real `<input>` 接 user 鍵盤打字。
322
+ // Click 在 input 上不 propagate 給外層 popover trigger(避免每次打字都開 popover)。
323
+ // Calendar icon `<ItemSuffix>` 點才開 popover(Material/Ant typed-date idiom)。
324
+ // a11y(2026-07-14 dim-10 修):input 持完整 combobox 語意(id/name/state,APG
325
+ // editable-combobox)— 外層 div 已讓位(見上方 role/tabIndex 註解);ArrowDown
326
+ // 開 popover 補鍵盤開啟路徑(原僅 icon click 可開,鍵盤 user 無入口)。
327
+ /* @__PURE__ */ jsx(
328
+ "input",
329
+ {
330
+ type: "text",
331
+ id: idProp ?? (fieldCtx == null ? void 0 : fieldCtx.id),
332
+ role: "combobox",
333
+ "aria-haspopup": "dialog",
334
+ "aria-expanded": open,
335
+ "aria-label": accessibleName,
336
+ "aria-labelledby": ariaLabelledByProp ?? (fieldCtx == null ? void 0 : fieldCtx.labelId),
337
+ "aria-required": (fieldCtx == null ? void 0 : fieldCtx.required) || void 0,
338
+ "aria-describedby": ariaDescribedByProp ?? (fieldCtx == null ? void 0 : fieldCtx.descriptionId),
339
+ "aria-errormessage": ariaErrorMessageProp ?? (inputInvalid || error ? fieldCtx == null ? void 0 : fieldCtx.errorId : void 0),
340
+ disabled,
341
+ className: cn(bareInputStyles, "truncate", !inputDraft && "placeholder:text-fg-muted"),
342
+ value: inputDraft,
343
+ placeholder: resolvedPlaceholder,
344
+ "aria-invalid": inputInvalid || error || void 0,
345
+ onChange: (e) => {
346
+ setInputDraft(e.target.value);
355
347
  setInputInvalid(false);
356
- e.preventDefault();
357
- }
358
- if (e.key === "ArrowDown" && !open) {
359
- e.preventDefault();
360
- setOpen(true);
348
+ },
349
+ onCompositionStart: () => {
350
+ composingRef.current = true;
351
+ },
352
+ onCompositionEnd: () => {
353
+ composingRef.current = false;
354
+ },
355
+ onKeyDown: (e) => {
356
+ if (composingRef.current) return;
357
+ if (e.key === "Enter") {
358
+ e.preventDefault();
359
+ handleInputCommit(inputDraft);
360
+ }
361
+ if (e.key === "Escape") {
362
+ setInputDraft(displayLive);
363
+ setInputInvalid(false);
364
+ e.preventDefault();
365
+ }
366
+ if (e.key === "ArrowDown" && !open) {
367
+ e.preventDefault();
368
+ setOpen(true);
369
+ }
370
+ },
371
+ onBlur: () => {
372
+ if (!composingRef.current) handleInputCommit(inputDraft);
373
+ },
374
+ onClick: (e) => e.stopPropagation()
375
+ }
376
+ )
377
+ ) : (
378
+ // ref = 截斷量測點(值 span 是截斷元素;tooltip trigger 在外層 host div,見 triggerTruncationRef 註解)
379
+ /* @__PURE__ */ jsx("span", { ref: triggerTruncationRef, className: cn(bareInputStyles, "truncate", !displayValue && "text-fg-muted"), children: triggerText })
380
+ ),
381
+ showClear && /* @__PURE__ */ jsx(
382
+ ItemInlineAction,
383
+ {
384
+ size: size ?? "md",
385
+ action: {
386
+ icon: X,
387
+ label: "清除日期",
388
+ // i18n-allow: DS default inline-action label
389
+ // Clear = 立刻 commit + 同步 draft(對齊 user 體感 / Ant trigger X 慣例)
390
+ // 不走 needConfirm「等確定」語義 — X 在 trigger 上是 standard clear affordance,
391
+ // 應立刻清空。dual-state 必同步:value('') + draft(null),否則 popover 開
392
+ // 著時 displayValue=draft 仍顯示舊值(see line 318: displayValue = needConfirm ? draft : value)。
393
+ onClick: (e) => {
394
+ e == null ? void 0 : e.stopPropagation();
395
+ onChange == null ? void 0 : onChange("");
396
+ setDraft(null);
361
397
  }
362
- },
363
- onBlur: () => {
364
- if (!composingRef.current) handleInputCommit(inputDraft);
365
- },
366
- onClick: (e) => e.stopPropagation()
367
- }
368
- )
369
- ) : /* @__PURE__ */ jsx("span", { className: cn(bareInputStyles, "truncate", !displayValue && "text-fg-muted"), children: triggerText }),
370
- showClear && /* @__PURE__ */ jsx(
371
- ItemInlineAction,
372
- {
373
- size: size ?? "md",
374
- action: {
375
- icon: X,
376
- label: "清除日期",
377
- // i18n-allow: DS default inline-action label
378
- // Clear = 立刻 commit + 同步 draft(對齊 user 體感 / Ant trigger X 慣例)
379
- // 不走 needConfirm「等確定」語義 — X 在 trigger 上是 standard clear affordance,
380
- // 應立刻清空。dual-state 必同步:value('') + draft(null),否則 popover 開
381
- // 著時 displayValue=draft 仍顯示舊值(see line 318: displayValue = needConfirm ? draft : value)。
382
- onClick: (e) => {
383
- e == null ? void 0 : e.stopPropagation();
384
- onChange == null ? void 0 : onChange("");
385
- setDraft(null);
386
398
  }
387
399
  }
388
- }
389
- ),
390
- /* @__PURE__ */ jsx(ItemSuffix, { className: "pointer-events-none", children: /* @__PURE__ */ jsx(Calendar, { size: iconSize, className: "text-fg-muted", "aria-hidden": true }) })
391
- ]
392
- }
393
- ) }),
400
+ ),
401
+ /* @__PURE__ */ jsx(ItemSuffix, { className: "pointer-events-none", children: /* @__PURE__ */ jsx(Calendar, { size: iconSize, className: "text-fg-muted", "aria-hidden": true }) })
402
+ ]
403
+ }
404
+ ) }) }),
405
+ /* @__PURE__ */ jsx(TooltipContent, { children: triggerTooltipActive ? displayLive : null })
406
+ ] }),
394
407
  /* @__PURE__ */ jsx(
395
408
  PopoverContent,
396
409
  {
@@ -508,6 +521,14 @@ const DatePickerRange = React.forwardRef(
508
521
  const showClear = clearable && hasValue && isEditable;
509
522
  const startText = startIso ? formatDateOrDateTime(startIso, showTime, showSeconds, { formatOptions, locale }) : resolvedPlaceholder[0];
510
523
  const endText = endIso ? formatDateOrDateTime(endIso, showTime, showSeconds, { formatOptions, locale }) : resolvedPlaceholder[1];
524
+ const { ref: startTruncationRef, isTruncated: startTruncated } = useTruncated({
525
+ deps: [startIso ? startText : ""]
526
+ });
527
+ const { ref: endTruncationRef, isTruncated: endTruncated } = useTruncated({
528
+ deps: [endIso ? endText : ""]
529
+ });
530
+ const startTooltipActive = !!startIso && startTruncated && !open;
531
+ const endTooltipActive = !!endIso && endTruncated && !open;
511
532
  const activeIso = activeEnd === "start" ? startIso : endIso;
512
533
  const activeDate = activeEnd === "start" ? startDate : endDate;
513
534
  const activeTime = isoToTimeParts(activeIso) ?? { hours: 0, minutes: 0, seconds: 0 };
@@ -572,9 +593,9 @@ const DatePickerRange = React.forwardRef(
572
593
  const hasAny = !!(startIso || endIso);
573
594
  if (!hasAny) return /* @__PURE__ */ jsx("span", { className: cn(fieldEmptyColorClass(resolvedMode), className), children: emptyDisplay });
574
595
  return /* @__PURE__ */ jsxs("span", { className: cn("inline-flex items-center min-w-0", nakedCellRowModeAlign, className), children: [
575
- /* @__PURE__ */ jsx("span", { className: cn("truncate", !startIso && "text-fg-muted"), children: startIso ? formatDateOrDateTime(startIso, showTime, showSeconds, { formatOptions, locale }) : resolvedPlaceholder[0] }),
596
+ /* @__PURE__ */ jsx(TruncatedText, { className: cn(!startIso && "text-fg-muted"), children: startIso ? formatDateOrDateTime(startIso, showTime, showSeconds, { formatOptions, locale }) : resolvedPlaceholder[0] }),
576
597
  /* @__PURE__ */ jsx(ArrowRight, { size: iconSize, className: "shrink-0 text-fg-muted mx-2", "aria-hidden": true }),
577
- /* @__PURE__ */ jsx("span", { className: cn("truncate", !endIso && "text-fg-muted"), children: endIso ? formatDateOrDateTime(endIso, showTime, showSeconds, { formatOptions, locale }) : resolvedPlaceholder[1] })
598
+ /* @__PURE__ */ jsx(TruncatedText, { className: cn(!endIso && "text-fg-muted"), children: endIso ? formatDateOrDateTime(endIso, showTime, showSeconds, { formatOptions, locale }) : resolvedPlaceholder[1] })
578
599
  ] });
579
600
  }
580
601
  if (!isEditable) {
@@ -587,9 +608,9 @@ const DatePickerRange = React.forwardRef(
587
608
  "aria-disabled": resolvedMode === "disabled" ? true : void 0,
588
609
  ...props,
589
610
  children: [
590
- /* @__PURE__ */ jsx("span", { className: cn("flex-1 min-w-0 truncate", !startIso && "text-fg-muted", resolvedMode === "disabled" && "text-fg-disabled"), children: startIso ? formatDateOrDateTime(startIso, showTime, showSeconds, { formatOptions, locale }) : resolvedPlaceholder[0] }),
611
+ /* @__PURE__ */ jsx(TruncatedText, { className: cn("flex-1", !startIso && "text-fg-muted", resolvedMode === "disabled" && "text-fg-disabled"), children: startIso ? formatDateOrDateTime(startIso, showTime, showSeconds, { formatOptions, locale }) : resolvedPlaceholder[0] }),
591
612
  /* @__PURE__ */ jsx(ArrowRight, { size: iconSize, className: cn("shrink-0 mx-2", resolvedMode === "disabled" ? "text-fg-disabled" : "text-fg-muted"), "aria-hidden": true }),
592
- /* @__PURE__ */ jsx("span", { className: cn("flex-1 min-w-0 truncate", !endIso && "text-fg-muted", resolvedMode === "disabled" && "text-fg-disabled"), children: endIso ? formatDateOrDateTime(endIso, showTime, showSeconds, { formatOptions, locale }) : resolvedPlaceholder[1] }),
613
+ /* @__PURE__ */ jsx(TruncatedText, { className: cn("flex-1", !endIso && "text-fg-muted", resolvedMode === "disabled" && "text-fg-disabled"), children: endIso ? formatDateOrDateTime(endIso, showTime, showSeconds, { formatOptions, locale }) : resolvedPlaceholder[1] }),
593
614
  resolvedMode === "disabled" && /* @__PURE__ */ jsx(ItemSuffix, { className: "pointer-events-none", children: /* @__PURE__ */ jsx(Calendar, { size: iconSize, className: "text-fg-disabled", "aria-hidden": true }) })
594
615
  ]
595
616
  }
@@ -615,45 +636,51 @@ const DatePickerRange = React.forwardRef(
615
636
  ),
616
637
  ...props,
617
638
  children: [
618
- /* @__PURE__ */ jsx(
619
- "button",
620
- {
621
- type: "button",
622
- ref: startBtnRef,
623
- onClick: () => openWithActive("start"),
624
- "data-active-end": open && activeEnd === "start" ? "true" : void 0,
625
- "aria-label": resolvedPlaceholder[0],
626
- "aria-haspopup": "dialog",
627
- "aria-expanded": open && activeEnd === "start",
628
- className: cn(
629
- bareInputStyles,
630
- "truncate text-left cursor-pointer focus-visible:outline-none",
631
- "data-[active-end=true]:underline decoration-primary underline-offset-4 decoration-2",
632
- !startIso && "text-fg-muted"
633
- ),
634
- children: startText
635
- }
636
- ),
639
+ /* @__PURE__ */ jsxs(Tooltip, { open: startTooltipActive ? void 0 : false, children: [
640
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
641
+ "button",
642
+ {
643
+ type: "button",
644
+ ref: startBtnRef,
645
+ onClick: () => openWithActive("start"),
646
+ "data-active-end": open && activeEnd === "start" ? "true" : void 0,
647
+ "aria-label": resolvedPlaceholder[0],
648
+ "aria-haspopup": "dialog",
649
+ "aria-expanded": open && activeEnd === "start",
650
+ className: cn(
651
+ bareInputStyles,
652
+ "truncate text-left cursor-pointer focus-visible:outline-none",
653
+ "data-[active-end=true]:underline decoration-primary underline-offset-4 decoration-2",
654
+ !startIso && "text-fg-muted"
655
+ ),
656
+ children: /* @__PURE__ */ jsx("span", { ref: startTruncationRef, className: "block truncate", children: startText })
657
+ }
658
+ ) }),
659
+ /* @__PURE__ */ jsx(TooltipContent, { children: startTooltipActive ? startText : null })
660
+ ] }),
637
661
  /* @__PURE__ */ jsx(ArrowRight, { size: iconSize, className: "shrink-0 text-fg-muted mx-2", "aria-hidden": true }),
638
- /* @__PURE__ */ jsx(
639
- "button",
640
- {
641
- type: "button",
642
- ref: endBtnRef,
643
- onClick: () => openWithActive("end"),
644
- "data-active-end": open && activeEnd === "end" ? "true" : void 0,
645
- "aria-label": resolvedPlaceholder[1],
646
- "aria-haspopup": "dialog",
647
- "aria-expanded": open && activeEnd === "end",
648
- className: cn(
649
- bareInputStyles,
650
- "truncate text-left cursor-pointer focus-visible:outline-none",
651
- "data-[active-end=true]:underline decoration-primary underline-offset-4 decoration-2",
652
- !endIso && "text-fg-muted"
653
- ),
654
- children: endText
655
- }
656
- ),
662
+ /* @__PURE__ */ jsxs(Tooltip, { open: endTooltipActive ? void 0 : false, children: [
663
+ /* @__PURE__ */ jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx(
664
+ "button",
665
+ {
666
+ type: "button",
667
+ ref: endBtnRef,
668
+ onClick: () => openWithActive("end"),
669
+ "data-active-end": open && activeEnd === "end" ? "true" : void 0,
670
+ "aria-label": resolvedPlaceholder[1],
671
+ "aria-haspopup": "dialog",
672
+ "aria-expanded": open && activeEnd === "end",
673
+ className: cn(
674
+ bareInputStyles,
675
+ "truncate text-left cursor-pointer focus-visible:outline-none",
676
+ "data-[active-end=true]:underline decoration-primary underline-offset-4 decoration-2",
677
+ !endIso && "text-fg-muted"
678
+ ),
679
+ children: /* @__PURE__ */ jsx("span", { ref: endTruncationRef, className: "block truncate", children: endText })
680
+ }
681
+ ) }),
682
+ /* @__PURE__ */ jsx(TooltipContent, { children: endTooltipActive ? endText : null })
683
+ ] }),
657
684
  showClear && /* @__PURE__ */ jsx(
658
685
  ItemInlineAction,
659
686
  {